problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 262k 1.05M | problem_description stringlengths 48 1.55k | codes stringlengths 35 98.9k | status stringlengths 28 1.7k | submission_ids stringlengths 28 1.41k | memories stringlengths 13 808 | cpu_times stringlengths 11 610 | code_sizes stringlengths 7 505 |
|---|---|---|---|---|---|---|---|---|---|---|
p02725 | u397638621 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split())\ndistances = {}\nfor i in range(1, len(A) + 1):\n\tdistances += (A[i] - A[i - 1]\nmost = max(distances.keys())\noutput = K - most\nprint(output)', 'K, N = map(int, input().split())\nA = list(map(int, input().split())\ndistances = {}\nfor i in range(1, N):\n\tdistances += (A[i] - A[i - 1]\nmost = max(distances.keys())\ndistances += (A[0] + K) - A[-1] \noutput = K - most\nprint(output)', 'K, N = map(int, input().split())\nA = list(map(int, input().split())\ndistances = {}\nfor i in range(1, len(A) + 1):\n\tdistances += (A[i] - A[i - 1]\nmost = max(distances.keys())\noutput = K - most\n print(output)', 'K, N = map(int, input().split())\nA = list(map(int, input().split())\ndistances = {}\nfor i in range(1, len(A)):\n\tdistances += (A[i] - A[i - 1]\nmost = max(distances.keys())\ndistance += (A[0] + K) - A[-1] \noutput = K - most\nprint(output)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ndistance = []\nfor i in range(1, N):\n\tdistance.append(A[i] - A[i - 1])\n\ndistance.append(A[0] + K - A[-1])\nmost = max(distance)\noutput = K - most\nprint(output)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s359109981', 's499615830', 's678193138', 's804025693', 's008661807'] | [2940.0, 2940.0, 2940.0, 2940.0, 25836.0] | [17.0, 17.0, 17.0, 18.0, 119.0] | [205, 247, 223, 251, 227] |
p02725 | u403331159 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N=map(int,input().split())\nA=list(map(int,input().split()))\nans=0\nans+=min(min(A[0],abs(A[0]-K)),abs(A[0]-A[1]))\nfor i in range(1,N-1):\n ans+=min(abs(A[i-1]-A[i]),abs(A[i]-A[i+1]))\nans+=min(min(A[-1],abs(A[-1]-K)),abs(A[-1]-A[-2]))\nprint(ans)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nans=0\ndist=[0]*N\ndist[0]=A[0]+abs(A[-1]-K)\nfor i in range(1,N):\n dist[i]=abs(A[i-1]-A[i])\nprint(K-max(dist))'] | ['Wrong Answer', 'Accepted'] | ['s581222875', 's542336204'] | [26444.0, 26420.0] | [207.0, 129.0] | [247, 173] |
p02725 | u405483159 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['L, k = map( int, input().split() )\na = list( map( int, input().split() ))\na[-1] = a[-1] - L\n\nret = L\nfor i in range( len(a) ):\n ret = min( ret, L - abs(a[i] - a[i-1]))\nprint( ret )', 'L, k = map( int, input().split() )\na = list( map( int, input().split() ))\n \nret = L\nfor i in range( len(a) ):\n if i == 0:\n ret = min( ret, L - abs(a[0] - ( a[-1] - L )))\n else:\n ret = min( ret, L - abs(a[i] - a[i-1]))\nprint( ret )'] | ['Wrong Answer', 'Accepted'] | ['s794437346', 's351081751'] | [26436.0, 26436.0] | [150.0, 160.0] | [181, 238] |
p02725 | u407158193 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n = map(int,input().split())\nA = [int(i) for i in input().split()]\n\nk = int(k/2)\n\n#print(list(map(lambda x:k -x,A)))\n\nprint(sum(list(map(lambda x:k -x,A))))', 'k,n = map(int,input().split())\nA = [int(i) for i in input().split()]\n\nA.append(A[0] + k)\n\nl = 0\nfor i in range(n):\n l = max(l,(A[i+1] - A[i]))\n\nprint(k - l)'] | ['Wrong Answer', 'Accepted'] | ['s367224788', 's292749678'] | [26444.0, 26444.0] | [96.0, 173.0] | [158, 157] |
p02725 | u408262366 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['hoge = input().split()\nK = int(hoge[0])\nN = int(hoge[1])\nA_list = list(map(int,input().split()))\n\nkankaku = []\nfor i in range(len(A_list) - 1):\n kankaku.append(A_list[i+1] - A_list[i])\nkankaku.append(A_list[0] - A_list[-1] + K)\n\nprint(kankaku)\n_kankaku_max = max(kankaku)\nprint(K - _kankaku_max)', 'hoge = input().split()\nK = int(hoge[0])\nN = int(hoge[1])\nA_list = list(map(int,input().split()))\n\nkankaku = []\nfor i in range(len(A_list) - 1):\n kankaku.append(A_list[i+1] - A_list[i])\nkankaku.append(A_list[0] - A_list[-1] + K)\n\n_kankaku_max = max(kankaku)\nprint(K - _kankaku_max)'] | ['Wrong Answer', 'Accepted'] | ['s904772668', 's230079488'] | [26420.0, 26444.0] | [133.0, 123.0] | [296, 281] |
p02725 | u408375121 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\nA.append(A[0]+K)\nmax_d = A[1] - A[0]\nfor i in range(n):\n d = A[i+1] - A[i]\n if max_d < d:\n max_d = d\nprint(K - max_d)\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nA.append(A[0]+K)\nmax_d = A[1] - A[0]\nfor i in range(n-1):\n d = A[i+1] - A[i]\n if max_d < d:\n max_d = d\nprint(K - max_d)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nA.append(A[0]+K)\nmax_d = A[1] - A[0]\nfor i in range(N):\n d = A[i+1] - A[i]\n if max_d < d:\n max_d = d\nprint(K - max_d)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s165396063', 's643496991', 's183965704'] | [26444.0, 26100.0, 26444.0] | [76.0, 67.0, 109.0] | [192, 193, 192] |
p02725 | u408849410 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N = map(int,input().split())\nA = list(map(int,input()))\nL = []\nT = K+A[0]-A[-1]\nfor i in range(N-1):\n L.append(A[i+1]-A[i])\nprint(K-max(L))', 'K,N = map(int,input().split())\nA = list(map(int,input()))\nL = 0\nfor i in range(0,N-1):\n if A[i+1]-A[i] >L:\n L = A[i+1]-A[i]\nprint(K-L)', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\nL = [K+A[0]-A[-1]]\nfor i in range(N-1):\n L.append(A[i+1]-A[i])\nprint(K-max(L))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s196223076', 's530000375', 's883451152'] | [7028.0, 7028.0, 26420.0] | [20.0, 20.0, 115.0] | [142, 144, 145] |
p02725 | u411858517 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\n\ntmp = 0\nfor i in range(N-1):\n tmp = max(tmp, A[i+1]-A[i])\n \ntmp = max(tmp, K - A[-1])\n\nprint(K - tmp)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ntmp = [0 for _ in range(N)]\nfor i in range(N-1):\n tmp[i] = A[i+1] - A[i]\n\ntmp[-1] = K - A[-1] + A[0]\n\nprint(K - max(tmp))'] | ['Wrong Answer', 'Accepted'] | ['s851708347', 's666495695'] | [26420.0, 25840.0] | [166.0, 122.0] | [183, 194] |
p02725 | u412197640 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\ndistances = list(map(int,input().split()))\ndistances.append(K-distances[-1])\n\nfor i in range(N-1, 0,-1):\n distances[i] -= distances[i-1]\nprint(sum(sorted(distances)[:-1]))\n', 'K, N = map(int, input().split())\ndistances = list(map(int,input().split()))\n\nvar = distances[0]\nfor i in range(N):\n distances[i] -= var\ndistances.append(K-distances[-1])\n\nfor i in range(N-1, 0,-1):\n distances[i] -= distances[i-1]\n\nprint(sum(sorted(distances)[:-1]))\n'] | ['Wrong Answer', 'Accepted'] | ['s533421177', 's471107286'] | [26436.0, 25840.0] | [134.0, 165.0] | [208, 272] |
p02725 | u412760429 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['p, n = map(int, input().split())\nl = list(map(int, input().split()))\nm = max(p - l[-1], l[0])\nfor i in range(1, n):\n m = max(m, l[i] - l[i - 1])\nprint(m)\n', 'p, n = map(int, input().split())\nl = list(map(int, input().split()))\nm = p - l[-1]\nfor i in range(1, n):\n m = max(m, l[i] - l[i - 1])\nprint(m)\n', 'p, n = map(int, input().split())\nl = list(map(int, input().split()))\nm = p - l[-1] + l[0]\nfor i in range(1, n):\n m = max(m, l[i] - l[i - 1])\nprint(p-m)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s543602385', 's851076910', 's521452635'] | [26444.0, 26420.0, 25840.0] | [135.0, 138.0, 136.0] | [157, 146, 155] |
p02725 | u414050834 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n=map(int,input().split())\na=list(map(int,input().split()))\nans=10**9\nfor i in range(n):\n s=a[i]\n t=0\n for j in range(1,n):\n m=min(abs(s-a[i-j]),abs(s+20-a[i-j]),abs(s-a[i+j]),abs(20-s+a[i+j]))\n t=t+m\n s=a[i-j]\n ans=min(ans,t)\nprint(ans)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\nt=0\nfor i in range(1,n):\n t=max(t,a[i]-a[i-1])\nprint(k-t)\n', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\nt=0\nfor i in range(1,n):\n t=max(t,a[i]-a[i-1])\ns=max(t,k-a[n])\nprint(k-s)\n', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\nt=0\nfor i in range(1,n):\n t=max(t,a[i]-a[i-1])\nk=max(t,k-a[n-1]+a[0])\nprint(k-t)\n', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\nt=0\nfor i in range(1,n):\n t=max(t,a[i]-a[i-1])\ns=max(t,k-a[n-1]+a[0])\nprint(k-s)\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s351157992', 's418691447', 's576803061', 's728427634', 's294194706'] | [26444.0, 26436.0, 26444.0, 26444.0, 26444.0] | [612.0, 136.0, 136.0, 136.0, 136.0] | [252, 121, 137, 144, 144] |
p02725 | u418149936 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ["K, N = map(int, input().split(' '))\nA_ls = list(map(int, input().split(' ')))\nrst = -1\nfor i in range(N):\n l = A_ls[(i + 1) % N] - A_ls[i]\n if i < 0:\n l = K - A_ls[i] + A_ls[(i + 1) % N]\n if rst == -1:\n rst = l\n else:\n rst = max(rst, l)\nprint(K - rst)", "K, N = map(int, input().split(' '))\nA_ls = list(map(int, input().split(' ')))\nrst = -1\nfor i in range(N):\n l = A_ls[(i + 1) % N] - A_ls[i]\n if l < 0:\n l = K - A_ls[i] + A_ls[(i + 1) % N]\n if rst == -1:\n rst = l\n else:\n rst = max(rst, l)\nprint(K - rst)"] | ['Wrong Answer', 'Accepted'] | ['s653982341', 's646613256'] | [32252.0, 32236.0] | [147.0, 144.0] | [284, 284] |
p02725 | u425762225 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N = map(int,input().split())\nA = list(map(int,input().split()))\nA.append(A[0])\n\nB = sorted([(A[i+1]- A[i]) for i in range(N)])\nans = K - B[-1]\nprint(ans)\n\n', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\nA.append(A[0]+K)\n\nB = sorted([(A[i+1]- A[i]) for i in range(N)])\nans = K - B[-1]\nprint(ans)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s737219806', 's340433992'] | [25452.0, 26444.0] | [124.0, 124.0] | [157, 159] |
p02725 | u427163848 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K = int(input())\nN = int(input())\nA = []\n\nfor i in range(N):\n A.append(int(input()))\n\nB = []\nfor i in range(N-1):\n B[i] = int(A[i] - A[i+1])\n\nB.append(int((K-A[0])-(A[N-1]-K)))\n\nB.sort()\n\nBig = B[N-1]\n\nprint(K-Big)\n\n', 'K,N = map(int, input().split())\nA = [int(N) for N in input().split()]\n\nB = []\nfor i in range(N-1):\n B.append(int(A[i+1] - A[i]))\n\nB.append(int(A[0]+(K-A[N-1])))\n\nB.sort()\n\nBig = B[N-1]\n\nprint(K-Big)'] | ['Runtime Error', 'Accepted'] | ['s442696613', 's284868444'] | [3060.0, 26420.0] | [18.0, 170.0] | [222, 202] |
p02725 | u428416104 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['kn = list(map(int, input().split()))\n\na= list(map(int, input().split()))\n\nl=[]\n\nl.append(kn[0]-a[-1])\n\nfor i in range(kn[1]-1):\n l.append(a[i+1]-a[i])\n\nprint(kn[0]-max(l))\n', 'kn = list(map(int, input().split()))\n\na= list(map(int, input().split()))\nl=[]\n\nl.append(kn[0]-a[-1])\n\nfor i in range(kn[1]-1):\n l.append(a[i+1]-a[i])\n\nprint(kn[0]-max(l))', 'kn = list(map(int, input().split()))\n\na= list(map(int, input().split()))\n\nl=[]\n\nl.append(kn[0]-a[-1]+a[0])\n\nfor i in range(kn[1]-1):\n l.append(a[i+1]-a[i])\n\nprint(kn[0]-max(l))\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s391218131', 's718537329', 's259197908'] | [25840.0, 26100.0, 26436.0] | [118.0, 118.0, 116.0] | [175, 173, 181] |
p02725 | u429029348 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n=map(int,input().split())\na=list(map(int,input().split()))\n\nlength=k-a[n-1]-a[0]\nfor i in range(n-1):\n length=max(length,a[i+1]-a[i])\n\nprint(k-length)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\n\nlength=k-a[n-1]+a[0]\nfor i in range(n-1):\n length=max(length,a[i+1]-a[i])\n\nprint(k-length)'] | ['Wrong Answer', 'Accepted'] | ['s696782544', 's413472374'] | [32296.0, 32312.0] | [123.0, 124.0] | [154, 154] |
p02725 | u431484963 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['\nk,n =list(map(int,input().split()))\na = list(map(int,input().split()))\nans = [0]*n \nfor i in range(n):\n if a[i]>k/2:\n a[i] = abs(k-a[i])\n\na.sort(reverse=True)\nkai = a[0]+a[1]\nprint(kai)', '\nk,n =map(int,input().split())\na = list(map(int,input().split()))\na.append(k+a[0])\n#print(a)\nl = 0\nfor i in range (n):\n l = max(l,a[i+1]-a[i])\nans = k-l\nprint(ans)\n\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s226682591', 's528553245'] | [26060.0, 26420.0] | [136.0, 163.0] | [196, 375] |
p02725 | u435480265 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n = map(int,input().split())\nlst_a = list(map(int,input().split()))\ndis_max = 0\nlo_last = lst_a[0]\nfor i in range(1,n):\n ilo = lst_a[i]\n dis_max = max(dis_max, ilo-lo_last)\n lo_last = ilo\nilo = lst_a[0]\ndis_max = max(dis_max, ilo-lo_last)\nprint(k-dis_max)', 'k,n = map(int,input().split())\nlst_a = list(map(int,input().split()))\ndis_max = 0\nlo_last = lst_a[0]\nfor i in range(1,n):\n ilo = lst_a[i]\n dis_max = max(dis_max, ilo-lo_last)\n lo_last = ilo\nilo = lst_a[0]\ndis_max = max(dis_max, ilo+k-lo_last)\nprint(k-dis_max)'] | ['Wrong Answer', 'Accepted'] | ['s196605768', 's647803789'] | [26436.0, 26444.0] | [147.0, 142.0] | [266, 268] |
p02725 | u438189153 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n=map(int,input().split())\ndis=list(map(int,input().split()))\nans=[]\nfor i in range(n):\n if i>=1:\n ans.append(dis[i]-dis[i-1])\nprint(k-max(ans))\n', 'k,n=map(int,input().split())\ndis=list(map(int,input().split()))\nans=[]\nfor i in range(n):\n if i>=1:\n ans.append(dis[i]-dis[i-1])\nans.append(dis[0]+(k-dis[n-1]))\nprint(k-max(ans))\n'] | ['Wrong Answer', 'Accepted'] | ['s909826577', 's461087181'] | [32312.0, 32232.0] | [112.0, 112.0] | [157, 189] |
p02725 | u440129511 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['import numpy as np\nk,n=map(int,input().split())\na=list(map(int,input().split()))\na=np.array(a)\na1=abs(a[1:]-a[:-1])\na2=list(a1)\na2.append(abs(a[0]-a[-1]))\nprint(k-max(a1))', 'import numpy as np\nk,n=map(int,input().split())\na=list(int,input().split())\na=np.array(a)\nif max(abs(a[1:]-a[:-1])) < k-abs(a[0]-a[-1]):b=k-abs(a[0]-a[-1])\nelse:b= max(abs(a[1:]-a[:-1]))\nprint(k-b)', 'import numpy as np\nk,n=map(int,input().split())\na=list(map(int,input().split()))\na=np.array(a)\na1=abs(a[1:]-a[:-1])\na1.append(abs(a[0]-a[-1]))\nprint(k-max(a1))\n', 'import numpy as np\nk,n=map(int,input().split())\na=list(map(int,input().split()))\na=np.array(a)\na1=abs(a[1:]-a[:-1])\na2=list(a1)\na2.append(abs(a[0]-a[-1])%k)\nprint(k-max(a1))', 'import numpy as np\nk,n=map(int,input().split())\na=list(map(int,input().split()))\na=np.array(a)\na1=abs(a[1:]-a[:-1])\na2=list(a1)\na2.append(abs(a[0]+k-a[-1]))\nprint(sum(a2)-max(a2))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s164304385', 's279929078', 's433750152', 's890968328', 's171514308'] | [36200.0, 34172.0, 34156.0, 34172.0, 34168.0] | [269.0, 365.0, 216.0, 254.0, 288.0] | [171, 197, 160, 173, 179] |
p02725 | u444722572 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N=map(int,input().split())\nA=list(map(int,input().split()))\nA+=[A[0]+K]\nmax_gap=max(y-x for x,y in zip(A,A[1:]))\nprint(max_gap)\nprint(K-max_gap)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nA+=[A[0]+K]\nmax_gap=max(y-x for x,y in zip(A,A[1:]))\nprint(K-max_gap)'] | ['Wrong Answer', 'Accepted'] | ['s776432393', 's303035377'] | [25836.0, 26420.0] | [83.0, 84.0] | [146, 131] |
p02725 | u446601167 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N = input().split()\n\nA = list(map(int, input().split()))\n\nint(K)\nint(N)\n\n\nB = []\nfor i in range(0, len(A)-1):\n B.insert(i,A[i+1]-A[i])\nB.insert(int(N)-1,int(K)-A[int(N)-1]+A[0])\n\nans = 0\n\nprint(B)\n\nfor j in range(int(N)):\n ans += B[j]\n\nans -= max(B)\n\nprint(ans)', 'K,N = input().split()\n\nA = list(map(int, input().split()))\n\nint(K)\nint(N)\n\n\nB = []\nfor i in range(0, len(A)-1):\n B.insert(i,A[i+1]-A[i])\nB.insert(int(N)-1,int(K)-A[int(N)-1]+A[0])\n\nans = 0\n\nfor j in range(int(N)):\n ans += B[j]\n\nans -= max(B)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s100550831', 's104640052'] | [26444.0, 25840.0] | [177.0, 183.0] | [292, 282] |
p02725 | u449697619 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['import statistics\nK,N = map(int,input().split())\nA = [int(n) for n in input().split()]\n\na1 = max(A)-min(A)\n\nmax_v = 0\nfor i in range(len(A)-1):\n A_i = None\n if (A[i+1]-A[i])>max_v:\n max_v = A[i+1]-A[i]\n A_i = i+1\n\na2 = A[A_i-1]+abs(K-A[A_i])\nprint(a2) if a1>a2 else print(a1)', 'import statistics\nK,N = map(int,input().split())\nA = [int(n) for n in input().split()]\n\na1 = max(A)-min(A)\n\nfor i in range(len(A)-1):\n max_v = 0\n index = None\n if (A[i+1]-A[i])>max_v:\n max_v = A[i+1]-A[i]\n index = i+1\n\na2 = A[index-1]+abs(K-A[index])\nprint(a1) if a1>a2 else print(a2)', 'import statistics\nK,N = map(int,input().split())\nA = [int(n) for n in input().split()]\n\na1 = max(A)-min(A)\n\nmax_v = 0\nA_i = None\nfor i in range(len(A)-1):\n if (A[i+1]-A[i])>max_v:\n max_v = A[i+1]-A[i]\n A_i = i+1\n\na2 = A[A_i-1]+abs(K-A[A_i])\nprint(a2) if a1>a2 else print(a1)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s173169812', 's920565475', 's977527164'] | [28272.0, 28272.0, 28272.0] | [142.0, 197.0, 140.0] | [295, 307, 291] |
p02725 | u453623947 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = map(int, input().split())\na = list(map(int, input().split())\nb = []\nfor i in range(N):\n d = int(a[i+1]-a[i])\n b.append(int(d))\n\nb.append(K - a[N-1] + a[0])\n\nans = K - max(b)\n\nprint(ans)', 'k,n=map(int,input().split())\na=list(map(int,input().split())\nlists=[]\nfor i in range(N):\n d=int(a[i+1]-a[i])\n lists.append(d)\nlists.append(K-a[N-1]+a[0])\nans=K-max(b)\nprint(ans)', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\na2 = []\nfor i in range(n-1):\n d = int(a[i+1]-a[i])\n a2.append(d)\na2.append(k-a[n-1]+a[0])\nans = k - max(a2)\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s346868783', 's458908390', 's568903171'] | [2940.0, 2940.0, 26436.0] | [18.0, 17.0, 149.0] | [198, 189, 194] |
p02725 | u454472984 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N=map(int,input().split())\nA=list(map(int,input().split()))\nl=0\nfor i in range(N-2):\n if (A[i+2]-A[i+1])>=(A[i+1]-A[i]):\n l=A[i+2]-A[i+1]\nif (20-A[N-1]+A[0])>=l:\nprint(K-l)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nd=[]\nfor i in range(N-1):\n d.append(A[i+1]-A[i])\nd.append(K-A[N-1]+A[0])\nprint(K-max(d))'] | ['Runtime Error', 'Accepted'] | ['s566638850', 's246214717'] | [2940.0, 26420.0] | [17.0, 116.0] | [184, 153] |
p02725 | u455477855 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k , n = map(int, input().split())\narr = list(map(int, input().split()))\n\ndist = 0\n\nfor i in range(len(arr)):\n if i is 0:\n if k - arr[i-1] > dist:\n dist = k - arr[i-1]\n \n if arr[i] - arr[i-1] > dist:\n dist = arr[i] - arr[i-1]\n\nprint(k - dist)', 'k , n = map(int, input().split())\narr = list(map(int, input().split()))\n\ndist = 0\n\nfor i in range(len(arr)):\n if i is 0:\n if k - arr[i-1] + arr[i] > dist:\n dist = k - arr[i-1] + arr[i]\n \n if arr[i] - arr[i-1] > dist:\n dist = arr[i] - arr[i-1]\n\nprint(k - dist)'] | ['Wrong Answer', 'Accepted'] | ['s270869538', 's745390408'] | [26436.0, 26060.0] | [113.0, 115.0] | [275, 293] |
p02725 | u457953718 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = map(int, input().split())\nl = list(map(int, input().split()))\nmaxi = [k-l[-1]+l[0]]\nfor i in range(1, n):\n maxi = max(l[i] - l[i-1], maxi)\nprint(k-maxi)', 'k, n = map(int, input())\nl = list(map(int, input()))\nmaxi = [k-l[-1]+l[0]]\nfor i in range(1, n):\n maxi = max(l[i] - l[i-1], maxi)\nprint(k-maxi)', 'k, n = map(int, input().split())\nl = list(map(int, input().split()))\nmaxi = k-l[-1]+l[0]\nfor i in range(1, n):\n maxi = max(l[i] - l[i-1], maxi)\nprint(k-maxi)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s180305194', 's232300058', 's032461484'] | [26436.0, 3060.0, 26444.0] | [66.0, 17.0, 136.0] | [160, 144, 160] |
p02725 | u459150945 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nAn = list(map(int, input().split()))\n\nans = 0\nfor i in range(len(An)-1):\n ans = max(ans, An[i+1]-An[i])\n\n\nans = max(ans, K - An[-1])\n\nprint(K-ans)\n', 'K, N = map(int, input().split())\nAn = list(map(int, input().split()))\n\n\nans = 0\nfor i in range(len(An)-1):\n ans = max(ans, An[i+1]-An[i])\n\n\nans = max(ans, An[0] - (An[-1]-K))\n\nprint(K-ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s153046303', 's125864759'] | [26444.0, 26444.0] | [165.0, 149.0] | [183, 192] |
p02725 | u459419927 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['from sys import stdin\nfrom collections import deque\nq=deque()\nK,N= list(map(int, (stdin.readline().strip().split())))\nA=list(map(int, (stdin.readline().strip().split())))\nB=A\nmax=A[1]-A[0]\nhome=0\nhome_B=0\nplace=0\nkyori=0\nfor i in range(N-1):\n if max< A[i+1]-A[i]:\n max=A[i+1]-A[i]\n place=i\n home+=A[i+1]-A[i]\nfor i in range(place+1,N):\n B.insert(0,abs(B[i]-K))\n del B[i+1]\nprint(B)\nfor i in range(N-1):\n home_B+=abs(B[i+1]-B[i])\nif home>home_B:\n print(home_B)\nelse:print(home)\n', 'from sys import stdin\nfrom collections import deque\nq=deque()\nK,N= list(map(int, (stdin.readline().strip().split())))\nA=list(map(int, (stdin.readline().strip().split())))\nmax=A[1]-A[0]\nhome=0\nhome_B=0\nplace=0\nkyori=0\nfor i in range(N-1):\n if max< A[i+1]-A[i]:\n max=A[i+1]-A[i]\n place=i\nB=A[place]\nC=A[place+1]-K\nD=B-C\nif A[-1]-A[0]>D:print(D)\nelse:print(A[-1]-A[0])'] | ['Wrong Answer', 'Accepted'] | ['s139847231', 's148050483'] | [25420.0, 25428.0] | [2104.0, 109.0] | [509, 382] |
p02725 | u460745860 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['# ABC160_c\n\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\nfor a in A:\n ans += min(a, K-a)\nprint(ans)\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\ndiff = []\nfor i in range(N):\n if A[i-1] > A[i]:\n diff.append(A[i]-(A[i-1]-K))\n else:\n diff.append(A[i]-(A[i-1]))\n\nprint(sum(sorted(diff)[:-1]))'] | ['Wrong Answer', 'Accepted'] | ['s371170105', 's977655733'] | [32340.0, 32364.0] | [121.0, 139.0] | [135, 232] |
p02725 | u464205401 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['n, k = map(int,input().split())\na = list(map(int,input().split()))\nb = [a[i+1]-a[i] for i in range(k-1)]\nb.append(n-a[-1]+a[0])\nprint(k-max(b))', 'n, k = map(int,input().split())\na = list(map(int,input().split()))\nb = [a[i+1]-a[i] for i in range(k-1)]\nb.append(n-a[-1]+a[0])\nprint(n-max(b))'] | ['Wrong Answer', 'Accepted'] | ['s083302983', 's342919317'] | [32240.0, 32276.0] | [95.0, 93.0] | [143, 143] |
p02725 | u469281291 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = map(int, input().split())\na = list(map(int, input().split()))\nans = k\nfor i in range(n):\n if (i == 0):\n tmp = a[-1] - a[0]\n else:\n tmp = k-a[i]+a[i-1]\n if (tmp < ans):\n ans = tmp\n print(ans)\nprint(ans)', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\nans = k\nfor i in range(n):\n if (i == 0):\n tmp = a[-1] - a[0]\n else:\n tmp = k-a[i]+a[i-1]\n if (tmp < ans):\n ans = tmp\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s983247146', 's638210345'] | [26420.0, 25840.0] | [296.0, 134.0] | [241, 226] |
p02725 | u470560351 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nans = A[N-1] - A[0]\nfor i in range(N-1):\n ans = min(ans, K - A[i+1] - A[i])\nprint(ans)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nans = A[N-1] - A[0]\nfor i in range(N-1):\n ans = min(ans, K - (A[i+1] - A[i]))\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s949481236', 's317359914'] | [25804.0, 26436.0] | [160.0, 163.0] | [157, 159] |
p02725 | u472197237 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ["def main():\n K, N = map(int, input().split(' '))\n half_k = K // 2\n A = list(map(int, input().split()))\n A.sort()\n A.append(A[0] + K)\n max_diff = A[-1] - half_k + A[0]\n for n in range(0, N - 1, 2):\n if max_diff < A[n + 1] - A[n]:\n max_diff = A[n + 1] - A[n]\n print(K - max_diff)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n K, N = map(int, input().split(' '))\n A = list(map(int, input().split()))\n A.sort()\n A.append(A[0] + K)\n max_diff = A[0] + K - A[-1]\n for a, b in zip(A, A[1:]):\n if (b - a) > max_diff:\n max_diff = b - a\n print(K - max_diff)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s606980362', 's306494388'] | [26444.0, 26420.0] | [79.0, 80.0] | [360, 315] |
p02725 | u472696272 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n = map(int,input().split())\na = list(map(int,input().split()))\nans = k\nfor i in range(-1,n-1):\n ans = min(ans, k-(n[i+1]-n[i]))\nprint(ans)\n', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nans = k\nfor i in range(1,n):\n ans = min(ans, k-max(a[i],a[i-1])+min(a[i],a[i-1]))\nprint(ans)', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nans = a[n-1]-a[0]\nfor i in range(1,n):\n ans = min(ans, k-max(a[i],a[i-1])+min(a[i],a[i-1]))\nprint(ans)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s179263310', 's527357514', 's285754549'] | [26420.0, 26444.0, 26436.0] | [65.0, 253.0, 251.0] | [143, 159, 170] |
p02725 | u474122160 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['s=input().split()\nk,n=int(s[0]),int(s[1])\ns=[]\na=input().split()\n\nfor i in range(0,n):\n \n if(i == n-1):\n s.append(abs(int(a[i])+k-int(a[0])))\n else:\n \ts.append(abs(int(a[i])-int(a[i+1])))\nprint(k-max(s))\n \n \n \n\n', 's=input().split()\nk,n=int(s[0]),int(s[1])\ns=[]\na=input().split()\n\nfor i in range(0,n):\n \n if(i == n-1):\n s.append(abs(k-int(a[i])+int(a[0])))\n else:\n \ts.append(abs(int(a[i])-int(a[i+1])))\nprint(k-max(s))\n \n \n \n\n'] | ['Wrong Answer', 'Accepted'] | ['s851886705', 's447379306'] | [18508.0, 20148.0] | [194.0, 198.0] | [220, 220] |
p02725 | u474484450 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ["k, n = map(int, input().split(' '))\na = list(map(int, input().split(' ')))\n\ndiffs = list()\nmax_diff = 0\nfor i in range(n):\n diff = 0\n if i == n-1:\n diff = k + a[0] - a[i]\n else:\n diff = a[i+1] - a[i]\n\n if max_diff < diff:\n max_diff = diff\n diffs.append(diff)\n\nsum(diffs) - max_diff", "k, n = map(int, input().split(' '))\na = list(map(int, input().split(' ')))\n\ndiffs = list()\nmax_diff = 0\nfor i in range(n):\n diff = 0\n if i == n-1:\n diff = k + a[0] - a[i]\n else:\n diff = a[i+1] - a[i]\n\n if max_diff < diff:\n max_diff = diff\n diffs.append(diff)\n\nprint(sum(diffs) - max_diff)"] | ['Wrong Answer', 'Accepted'] | ['s950051025', 's811950383'] | [26444.0, 26444.0] | [147.0, 156.0] | [317, 324] |
p02725 | u474561976 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['n, k = map(int, input().split(" "))\nhouses = list(map(int, input().split(" ")))\nprint(houses)\ndif_houses = [houses[x+1]-houses[x] for x in range(k-1)]\ndif_houses.append(houses[0]-houses[k-1]+n)\n\nmax_dif = max(dif_houses)\nprint(n-max_dif)', 'n, k = map(int, input().split(" "))\nhouses = list(map(int, input().split(" ")))\ndif_houses = [houses[x+1]-houses[x] for x in range(k-1)]\ndif_houses.append(houses[0]-houses[k-1]+n)\n\nmax_dif = max(dif_houses)\nprint(n-max_dif)'] | ['Wrong Answer', 'Accepted'] | ['s728392754', 's615813303'] | [26444.0, 26444.0] | [119.0, 99.0] | [237, 223] |
p02725 | u482157295 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n = map(int,input().split())\nn_inf = list(map(int,input().split()))\nn_inf.append(k)\nn_inf.insert(0,0)\n#print(n_inf)\nkyori_list = [j for j in range(n+1)]\nfor i in range(n+1):\n kyori_list[i] = n_inf[i+1]-n_inf[i]\n\nkyori_list.sort(reverse=1)\n\nprint(sum(kyori_list[1:n+1]))', 'k,n = map(int,input().split())\nn_inf = list(map(int,input().split()))\n#n_inf.append(k)\n#n_inf.insert(0,0)\nkyori_list = [j for j in range(n-1)]\nfor i in range(n-1):\n kyori_list[i] = n_inf[i+1]-n_inf[i]\n\nkyori_list.append((n_inf[0])+(k-n_inf[n-1]))\n\nkyori_list.sort(reverse=1)\nprint(sum(kyori_list[1:n+1]))'] | ['Wrong Answer', 'Accepted'] | ['s174499499', 's551411372'] | [26100.0, 25836.0] | [147.0, 149.0] | [308, 341] |
p02725 | u488178971 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['# 160\nK,N=map(int,input().split())\nA=[int(i) for i in input().split()]\n\nans =[]\n\nfor i in range(N-1):\n ans.append(A[i+1]-A[i])\nans.append(abs(A[0] - (K - A[-1])))\nprint(sum(ans) - max(ans))', '# 160\nK,N=map(int,input().split())\nA=[int(i) for i in input().split()]\n\nans =[]\nfor a in A:\n ans.append(min(a,K-a))\nprint(sum(ans))', '# 160\nK,N=map(int,input().split())\nA=[int(i) for i in input().split()]\n\nans =[]\n\nfor i in range(N-1):\n ans.append(A[i+1]-A[i])\nans.append(abs(A[0] + (K - A[-1])))\nprint(sum(ans) - max(ans))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s148070339', 's929053005', 's557588726'] | [26436.0, 26436.0, 26228.0] | [125.0, 142.0, 128.0] | [192, 134, 192] |
p02725 | u489153633 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['_in = list(map(int, input().split()))\nk = _in[0]\nn = _in[1]\np = 0\n_i = list(map(int, input().split()))\ndis = 0\nmdis = k - _i[n-1] + _i[0]\nprint(mdis)\nfor i in range(1,n):\n dis = _i[i] - _i[i-1]\n print(dis)\n if dis>mdis:\n mdis = dis\nprint(k-mdis)', '_in = list(map(int, input().split()))\nk = _in[0]\nn = _in[1]\np = 0\n_i = list(map(int, input().split()))\ndis = 0\nmdis = k - _i[n-1] + _i[0]\nprint(mdis)\nfor i in range(1,n-1):\n dis = _i[i] - _i[i-1]\n print(dis)\n if dis>mdis:\n mdis = dis\nprint(k-mdis)', '_in = list(map(int, input().split()))\nk = _in[0]\nn = _in[1]\np = 0\n_i = list(map(int, input().split()))\ndis = 0\nmdis = k - _i[n-1] + _i[0]\nfor i in range(1,n):\n dis = _i[i] - _i[i-1]\n if dis>mdis:\n mdis = dis\nprint(k-mdis)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s443026488', 's609997718', 's507909279'] | [26444.0, 26444.0, 26444.0] | [240.0, 251.0, 111.0] | [261, 263, 234] |
p02725 | u491550356 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['import math\n\nk, n = map(int, input().split())\nA = list(map(int, input().split()))\nA.append(k)\nans = 0\nfor i in range(0, n):\n ans = max(ans, abs(A[i] - A[i+1]))\n\nprint(k-ans)', 'k, n = map(int, input().split())\nA = list(map(int, input().split()))\nA.append(k+A[0])\n\nans = 0\nfor i in range(0, n):\n ans = max(ans, A[i+1] - A[i])\nprint(k-ans)'] | ['Wrong Answer', 'Accepted'] | ['s303973655', 's255689679'] | [26444.0, 26420.0] | [152.0, 157.0] | [176, 163] |
p02725 | u492414556 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['def solve():\n K = int(input())\n N = int(input())\n vals = [None] * N\n ans = 99999999\n for i in range(N):\n vals[i] = int(input())\n for i in range(N):\n cc = -1\n if i == 0:\n cc = vals[N-1] - vals[0]\n else:\n cc = vals[i-1] + K - vals[i]\n ans = min(ans, cc)\n print(ans)\nsolve()\n \n', 'def solve():\n raw = input().split()\n K = int(raw[0])\n N = int(raw[1])\n vals = [None] * N\n ans = 99999999\n raw = input().split()\n for i in range(N):\n vals[i] = int(raw[i])\n for i in range(N):\n cc = -1\n if i == 0:\n cc = vals[N-1] - vals[0]\n else:\n cc = vals[i-1] + K - vals[i]\n ans = min(ans, cc)\n print(ans)\nsolve()\n \n'] | ['Runtime Error', 'Accepted'] | ['s122418070', 's792228991'] | [3060.0, 26444.0] | [18.0, 161.0] | [307, 352] |
p02725 | u492749916 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\na = list(input().split())\n\na = [int(i) for i in a]\n\ndiff = list()\ndiff.insert(0,K-a[N-1]+a[0]) \nfor i in range(2,N+1): # seq 2 to N-1\n diff.insert(i-1,abs(a[i-1]-a[i-2]))\n\nprint (diff)\n\nprint (sum(diff)-max(diff))', 'K, N = map(int, input().split())\na = list(input().split())\n\na = [int(i) for i in a]\n\ndiff = list()\ndiff.insert(0,K-a[N-1]+a[0]) \nfor i in range(2,N+1): # seq 2 to N-1\n diff.insert(i-1,abs(a[i-1]-a[i-2]))\n\n# print (diff)\n\nprint (sum(diff)-max(diff))'] | ['Wrong Answer', 'Accepted'] | ['s997319855', 's225117391'] | [24908.0, 24856.0] | [186.0, 161.0] | [260, 262] |
p02725 | u493318999 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n = map(int,input().split())\na = list(map(int,input().split()))\nmin = 10000000\nfor i in range(n-1):\n if min > a[i+1]-a[i]:\n min = a[i+1]-a[i]\nif min > k-a[n-1]+a[0]:\n min = k-a[n-1]+a[0]\nprint(k-min)', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nmax = 0\nfor i in range(n-1):\n if max < a[i+1]-a[i]:\n max = a[i+1]-a[i]\nif max < k-a[n-1]+a[0]:\n max = k-a[n-1]+a[0]\nprint(k-max)'] | ['Wrong Answer', 'Accepted'] | ['s995608609', 's016199477'] | [25920.0, 25452.0] | [107.0, 104.0] | [214, 207] |
p02725 | u493555013 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N = map(int,input().split())\nA = list(map(int,input().split()))\n\nmx = K - A[N-1] +A[0]\nfor i in range(N-1):\n if A[i+1] - A[i] > mx:\n mx = A[i+1] - A[i]\n \nans = sum(A) - mx\nprint(ans)\n ', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\n\nmx = K - A[N-1] +A[0]\nfor i in range(N-1):\n if A[i+1] - A[i] > mx:\n mx = A[i+1] - A[i]\n \nans = K - mx\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s823909389', 's812616879'] | [26444.0, 25452.0] | [104.0, 107.0] | [194, 186] |
p02725 | u496687522 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nans_root = K\nfor i range(N):\n if i==0:\n root = A[N-1] - A[0]\n else:\n root = A[i-1]+K - A[i]\n if ans_root > root:\n ans_root = root\nprint(ans_root)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nans_root = K\nfor i in range(N):\n if i==0:\n root = A[N-1] - A[0]\n else:\n root = A[i-1]+K - A[i]\n if ans_root > root:\n ans_root = root\nprint(ans_root)'] | ['Runtime Error', 'Accepted'] | ['s553668075', 's150815893'] | [2940.0, 26100.0] | [17.0, 128.0] | [245, 248] |
p02725 | u498531348 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['A = list(map(int, input().split()))\n\n\n\nA = sorted(A)\nL = []\nANS = 0\n\nA_max = max(A)\n\nfor i in range(N-1):\n L.append(abs(A[i+1]-A[i]))\n \nL.append(K + A[0] - A_max)\n\nL = sorted(L)\n\n\nL.pop(-1)\n\nfor i in range(len(L)):\n ANS = ANS + L[i]\n \nprint(ANS)\n ', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\n\n\nA = sorted(A)\nL = []\nANS = 0\n\nA_max = max(A)\n\nfor i in range(N-1):\n L.append(abs(A[i+1]-A[i]))\n \nL.append(K - A_max)\n\nL = sorted(L)\nprint(L)\n\nL.pop(-1)\n\nfor i in range(len(L)):\n ANS = ANS + L[i]\n \nprint(ANS)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\n\n\nA = sorted(A)\nL = []\nANS = 0\n\nA_max = max(A)\n\nfor i in range(N-1):\n L.append(abs(A[i+1]-A[i]))\n \nL.append(K + A[0] - A_max)\n\nL = sorted(L)\n\n\nL.pop(-1)\n\nfor i in range(len(L)):\n ANS = ANS + L[i]\n \nprint(ANS)\n '] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s684965629', 's711307674', 's752097107'] | [9100.0, 32376.0, 32360.0] | [26.0, 160.0, 153.0] | [266, 295, 299] |
p02725 | u498575211 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['N, K = map(int, input().split())\na = list(map(int, input().split()))\na.append(N+a[0]-a[-1])\nmax = 0\nfor i in range(len(a)-1):\n p = abs(a[i]-a[i+1])\n max = p if max < p else max\nprint(N-max)\n', 'N, K = map(int, input().split())\na = list(map(int, input().split()))\na.append(N+a[0])\n#print(a)\nmax = 0\nfor i in range(len(a)-1):\n p = abs(a[i]-a[i+1])\n max = p if max < p else max\nprint(N-max)\n'] | ['Wrong Answer', 'Accepted'] | ['s951701890', 's740634277'] | [25452.0, 26004.0] | [128.0, 131.0] | [192, 196] |
p02725 | u501451051 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = map(int, input().split())\nclist = list(map(int, input().split()))\n \nmax1 = 0\nind = 0\nfor i in range(n-1):\n tmp = clist[i+1] - clist[i]\n if tmp > max1:\n max1 = tmp\n ind = i\n \nprint(clist[ind]+(k-clist[ind+1]))', 'k, n = map(int, input().split())\nclist = list(map(int, input().split()))\n \nmax1 = 0\nind = 0\nfor i in range(n-1):\n tmp = clist[i+1] - clist[i]\n if tmp > max1:\n ind = i\n \nprint(clist[ind]+(k-clist[ind+1]))', 'k, n = map(int, input().split())\nclist = list(map(int, input().split()))\n\ntmp = []\nfor i in range(1, n):\n tmp.append(clist[i] - clist[i-1])\n \ntmp.append(k- clist[n-1] + clist[0])\n\nprint(k -max(tmp))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s753543927', 's788998916', 's890958114'] | [26444.0, 25840.0, 25836.0] | [112.0, 122.0, 123.0] | [235, 216, 204] |
p02725 | u502389123 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nans = 1e9\nfor i in range(N):\n ans = min(ans, min(A[(i+N-1)%N] + K - A[i], A[i] + K - A[(i+1)%N]))\n\nprint(ans)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ndist = [K - A[N-1] + A[0]]\nfor i in range(N-1):\n dist.append(A[i+1] - A[i])\n\nprint(K - max(dist))'] | ['Wrong Answer', 'Accepted'] | ['s568684153', 's851257916'] | [26444.0, 25840.0] | [276.0, 114.0] | [182, 170] |
p02725 | u507457124 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['import numpy as np\nK, N = map(int, input().split())\nA = input().split()\ndiff = np.append(np.array(A[1:]) - np.array(A[:-1]), K - A[-1])\ndiff = np.delete(diff, np.argmax(diff))\nprint(diff.sum())', 'import numpy as np\nK, N = map(int, input().split())\nA = np.array(list(map(int, input().split())))\ndiff = np.append(A[1:] - A[:-1], K + A[0] - A[-1])\nprint(np.delete(diff, np.argmax(diff)).sum())'] | ['Runtime Error', 'Accepted'] | ['s680541149', 's773589796'] | [59568.0, 50796.0] | [171.0, 179.0] | [193, 194] |
p02725 | u508842013 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N=map(int,input().split())\nA=list(map(int,input().split()))\nC = A.sort()\nB=C[1:]-C[:-1]\nB.append(K+C[0]-C[N-1])\nprint(K-max(B))', 'import numpy as np\n\nK,N=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\nx=np.array(A[1:])\ny=np.array(A[:-1])\nB=x-y\nB.append(K+A[0]-A[N-1])\nprint(K-int(max(B))', 'import numpy as np\n\nK,N=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\nx=np.array(A[1:])\ny=np.array(A[:-1])\nB=x-y\nB.append(K+A[0]-A[N-1])\nprint(K-max(B))', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\nB=A[1:]-A[:-1]\nB.append(K+A[0]-A[N-1])\nprint(K-max(B))', 'import numpy as np\n\nK,N=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\nx=np.array(A[1:])\ny=np.array(A[:-1])\nB=list(map(x-y))\nB.append(K+A[0]-A[N-1])\nprint(K-max(B))', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\n\ndef distance(x):\n q=x[1:]-x[:-1]\n return q\n\nB=distance(A)\nB.append(K+A[0]-A[N-1])\nprint(K-max(B))', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\nB=A[1:]-x[:-1]\nB.append(K+A[0]-A[N-1])\nprint(K-max(B))', 'import numpy as np\n\nK,N=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\nx=np.array(A[1:])\ny=np.array(A[:-1])\nB=x-y\nC=B.tolist()\nC.append(K+A[0]-A[N-1])\nprint(K-int(max(C)))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s220934294', 's344335515', 's384317536', 's402932740', 's550064927', 's657481597', 's853561525', 's838975090'] | [25840.0, 3060.0, 42088.0, 25840.0, 34156.0, 26444.0, 26420.0, 34148.0] | [71.0, 17.0, 783.0, 71.0, 247.0, 73.0, 68.0, 248.0] | [129, 177, 173, 125, 184, 175, 125, 191] |
p02725 | u512099209 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\ndistance = [0] * N\n\nfor i in range(N - 1):\n distance[i] = A[i + 1] - A[i]\n\ndistance[-1] = K - A[-1]\n\nprint(K - max(distance))', 'K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\ndistance = [0] * N\n\nfor i in range(N - 1):\n distance[i] = A[i + 1] - A[i]\n\ndistance[-1] = K + A[0] - A[-1]\n\nprint(K - max(distance))\n'] | ['Wrong Answer', 'Accepted'] | ['s918665149', 's135919758'] | [26444.0, 26420.0] | [113.0, 111.0] | [202, 210] |
p02725 | u516554284 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['n,k=map(int,input().split())\na=list(map(int,input().split()))\nans=0\nfor x in range(n-1):\n b=a[x+1]-a[x]\n ans=max(ans,b)\n \nc=k-a[n-1]+a[0]\n\nprint(max(ans,c))\n', 'n,k=map(int,input().split())\na=list(map(int,input().split()))\nans=0\nfor x in range(n-1):\n b=a[x+1]-a[x]\n ans=max(ans,b)\n \nc=k-a[n]+a[0]\n\nprint(max(ans,c))', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\nans=0\nfor x in range(n-1):\n b=a[x+1]-a[x]\n ans=max(ans,b)\n \nc=k-a[n-1]+a[0]\n\nprint(k-max(ans,c))\n\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s435570907', 's531283999', 's771916183'] | [32232.0, 32388.0, 32204.0] | [130.0, 126.0, 130.0] | [160, 157, 163] |
p02725 | u516927307 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nd = [k-a[-1]+a[0]]\n\nfor i in range(n-1):\n d.append(a[i+1]-a[i])\n\nprint(a-max(dist))\n', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nd = [k-a[-1]+a[0]]\n\nfor i in range(n-1):\n d.append(a[i+1]-a[i])\n\nprint(k-max(d))\n\n'] | ['Runtime Error', 'Accepted'] | ['s011892606', 's292873393'] | [26060.0, 25928.0] | [112.0, 118.0] | [157, 155] |
p02725 | u518891382 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n = map(int, input().split())\nA = list(map(int, input().split()))\n\npath = 0\n\nfor i in range(n):\n if i == 0:\n path += min(abs(A[i]-A[n-1]),abs(A[i]-A[i+1]))\n elif i == n-1:\n path += min(abs(A[i]-A[i-1]),abs(A[i]-A[0]))\n else:\n path += min(abs(A[i]-A[i+1]),abs(A[i]-A[i-1]))\n\nprint(path)\n', 'k,n = map(int, input().split())\nA = list(map(int, input().split()))\n\nlongest = k - (A[-1] - A[0])\n\nfor i in range(n-1):\n if A[i+1] - A[i] > longest:\n longest = A[i+1] -A[i]\nprint(k-longest)'] | ['Wrong Answer', 'Accepted'] | ['s039305105', 's584178945'] | [33732.0, 32220.0] | [192.0, 101.0] | [318, 199] |
p02725 | u519922200 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB=[]\nfor i in range(N-1):\n B.append(A[i+1]-A[i])\nB.append(A[N-1]-A[0])\nprint(N-max(B))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB=[]\nfor i in range(N-1):\n B.append(A[i+1]-A[i])\nB.append(K-(A[N-1]-A[0]))\nprint(K-max(B))'] | ['Wrong Answer', 'Accepted'] | ['s388927333', 's720741252'] | [26436.0, 26436.0] | [118.0, 119.0] | [158, 162] |
p02725 | u520331522 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n = int(input().split())\n\nl = list(map(int, input().split()))\nm = [0]*n\ncount = 0\n\nfor i in range(n-1):\n m[count] = l[i+1] - l[i]\n count+=1\nm[n-1] = k - l(n-1) + l[0]\n\nprint(k - max(m))', 'k,n = input().split()\nk = int(k)\nn = int(n)\n\nl = list(map(int, input().split()))\nm = [0]*n\ncount = 0\n\nfor i in range(n-1):\n m[count] = l[i+1] - l[i]\n count+=1\nm[n-1] = k - l[n-1]+ l[0]\n\nprint(k - max(m))\n'] | ['Runtime Error', 'Accepted'] | ['s891744647', 's115603338'] | [3064.0, 26444.0] | [17.0, 130.0] | [193, 210] |
p02725 | u526094365 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nB = []\nfor i in range(N - 1):\n B.append(abs(A[i] - A[i + 1]))\n\n\nB.append(abs(K - A[-1] - A[0]))\n\nB = sorted(B)\n\nprint(sum(B[:-1]))\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nB = []\nA = sorted(A)\nfor i in range(N - 1):\n B.append(abs(A[i] - A[i + 1]))\n\n\nB.append(abs(K - A[-1] - A[0]))\n\nB = sorted(B)\n\nprint(sum(B[:-1]))\n', 'import numpy as np\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\nhalf = K / 2\nfor i in A:\n if i >= half:\n ans += K - i\n else:\n ans += i\n\nprint(ans)\n', 'import numpy as np\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\nif K % 2 == 0:\n half = K // 2\nelse:\n half = K // 2 + 1\n\nfor i in A:\n if i >= half:\n ans += K - i\n else:\n ans += i\n\nprint(ans)\n', 'import numpy as np\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\nA = sorted(A)\nnew = []\nfor i in range(N-1):\n new.append(A[i+1]-A[i])\nnew.append(K + A[0] - A[-1])\nnew = sorted(new)\nprint(sum(new[:-1]))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s081082585', 's201075988', 's437824339', 's509996541', 's625841854'] | [26436.0, 26436.0, 35924.0, 42708.0, 43772.0] | [155.0, 157.0, 260.0, 1116.0, 889.0] | [204, 218, 199, 248, 236] |
p02725 | u528887718 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N = map(int,input().split())\nA = list(map(int,input().split()))\nsub = [abs(A[i] - A[i+1]) for i in range(N-1)]\nsub.append(K-A[N-1])\nprint(K-max(sub))', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\nsub = [abs(A[i] - A[i+1]) for i in range(N-1)]\nsub.append(K-A[N-1]+A[0])\nprint(K-max(sub))\n'] | ['Wrong Answer', 'Accepted'] | ['s462867686', 's352517935'] | [25920.0, 26444.0] | [111.0, 108.0] | [151, 157] |
p02725 | u531219227 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N = map(int,input().split())\nA = []\nfor i in range(N):\n A.append(int(input()))\nA_m=[]\n\nfor i in range(1,N):\n A_m.append(int(A[i] - A[i-1]))\n \n\nif abs(A[N-1]-A[0]) > 10:\n A_m.append(A[0]-A[N-1] +20)\nelse:\n A_m.append(A[N-1]-A[0])\n \nX = sum(A_m) - max(A_m)\n\nprint(X)', 'K,N = map(int,input().split())\n\nA = []\n\nfor i in range(N):\n A.append(int(input()))\n \nA_m = []\n\nfor i in range(1,N):\n A_m.append(A[i]-A[i-1])\n \nA_m.append(K-A[N-1]+A[0])\n \nprint(sum(A_m)-max(A_m))\n', 'K,N = map(int,input().split())\n \nA = list(map(int,input().split()))\n\n \nA_m = []\n \nfor i in range(1,N):\n A_m.append(A[i]-A[i-1])\n \nA_m.append(K-A[N-1]+A[0])\n \nprint(sum(A_m)-max(A_m))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s177917274', 's448172335', 's443860727'] | [7092.0, 7092.0, 25452.0] | [26.0, 27.0, 119.0] | [274, 201, 186] |
p02725 | u531599639 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort()\nm = 0\nfor i in range(1, len(A)):\n if A[i]-A[i-1]>m:\n m=A[i]-A[i-1]\nif K-A[-1]+A[1]>m:\n print(A[-1]-A[1])\nelse:\n print(K-m)\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort()\nm = 0\nfor i in range(1, len(A)):\n if A[i]-A[i-1]>m:\n m=A[i]-A[i-1]\nif K-A[-1]>m:\n print(A[-1])\nelse:\n print(K-m)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort()\nm = 0\nfor i in range(1, len(A)):\n if A[i]-A[i-1]>m:\n m=A[i]-A[i-1]\nif K-A[-1]+A[0]>m:\n print(A[-1]-A[0])\nelse:\n print(K-m)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s062155381', 's242400732', 's707530874'] | [25840.0, 26444.0, 26444.0] | [109.0, 107.0, 106.0] | [217, 206, 217] |
p02725 | u536034761 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\nlongest = 0\nfor i in range(N):\n longest = max(longest, A[i + 1] - A[i])\nlongest = max(longest, A[0] + K - A[-1])\nprint(K - longest)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nlongest = 0\nfor i in range(N - 1):\n longest = max(longest, A[i + 1] - A[i])\nlongest = max(longest, A[0] + K - A[-1])\nprint(K - longest)'] | ['Runtime Error', 'Accepted'] | ['s390725127', 's581627038'] | [26444.0, 26436.0] | [160.0, 162.0] | [201, 205] |
p02725 | u536685012 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = input().split()\na = list(map(int, input().split()))\n\nmax = 0\n\nfor i in range(n - 1):\n if a[i + 1] - a[i] > max:\n max = a[i + 1] - a[i]\n\nif (k - a[n]) + a[0] >= max:\n max = (k - a[n]) + a[0]\n\nprint(k - max)', 'k, n = input().split()\nk, n = int(k), int(n)\na = list(map(int, input().split()))\n\nmax = 0\n\nfor i in range(n - 1):\n if a[i + 1] - a[i] > max:\n max = a[i + 1] - a[i]\n\nif (k - a[n]) + a[0] >= max:\n max = (k - a[n]) + a[0]\n\nprint(k - max)\n', 'k, n = input().split()\nk, n = int(k), int(n)\na = list(map(int, input().split()))\n\nmax = 0\n\nfor i in range(n - 1):\n if a[i + 1] - a[i] > max:\n max = a[i + 1] - a[i]\n\nif (k - a[n - 1]) + a[0] >= max:\n max = (k - a[n - 1]) + a[0]\n\nprint(k - max)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s246516325', 's271926592', 's538471195'] | [25836.0, 26436.0, 26444.0] | [65.0, 104.0, 102.0] | [217, 240, 248] |
p02725 | u537142137 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['I = input().split()\nK = int(I[0])\nN = int(I[1])\n\nI = input().split()\n\nA = [ int(I[0]) ]\nL = [ A[0] ]\nfor i in range(1,N):\n A.append( int(I[i]) )\n L.append( A[i] - A[i-1] )\n\nL[0] = A[0]+(K-A[N-1])\n\nA.sort()\nprint(L[N-1])\n\n \n', 'I = input().split()\nK = int(I[0])\nN = int(I[1])\n\nI = input().split()\n\nA = [ int(I[0]) ]\nL = [ A[0] ]\nfor i in range(1,N):\n A.append( int(I[i]) )\n L.append( A[i] - A[i-1] )\n\nL[0] = A[0]+(K-A[N-1])\n\nL.sort()\nprint(K - L[N-1])\n \n'] | ['Wrong Answer', 'Accepted'] | ['s102272063', 's773450920'] | [28792.0, 29584.0] | [161.0, 182.0] | [226, 229] |
p02725 | u538784937 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N = map(int,input().split())\ndis = list(map(int,input().split()))\nprint(sum(dis)-max(dis))\n\n', 'K,N = map(int,input().split())\ndis = list(map(int,input().split()))\ndif = []\nfor i in range(N-1):\n dif.append(int(dis[i+1]-dis[i]))\n \ndif.append(int(K-dis[N-1]+dis[0]))\nprint(K-max(dif))\n\n'] | ['Wrong Answer', 'Accepted'] | ['s716899592', 's283603025'] | [32352.0, 32304.0] | [76.0, 119.0] | [94, 190] |
p02725 | u540166312 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = map(int, input().split())\na = list(map(int, input().split()))\na.append(k+a[0])\ndist = [abs(a[i+1]-a[i]) for i in range(n)]\n\nprint(a)\nprint(k-max(dist))', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\na.append(k+a[0])\ndist = [abs(a[i+1]-a[i]) for i in range(n)]\n\nprint(k-max(dist))'] | ['Wrong Answer', 'Accepted'] | ['s039902553', 's061543131'] | [26436.0, 26420.0] | [122.0, 109.0] | [158, 149] |
p02725 | u548069143 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n=map(int,input().split())\nb=list(map(int, input().split()))\nb.sort()\na=[b[0]+k-b[n-1]]\nfor i in range(n-1):\n a.append(b[i+1]-b[i])\n print(b[i])\nprint(k-max(a))\n', 'k,n=map(int,input().split())\nb=list(map(int, input().split()))\nb.sort()\na=[b[0]+k-b[n-1]]\nfor i in range(n-1):\n a.append(b[i+1]-b[i])\nprint(k-max(a))\n'] | ['Wrong Answer', 'Accepted'] | ['s619833949', 's553246993'] | [26436.0, 26444.0] | [290.0, 120.0] | [169, 153] |
p02725 | u548545174 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\nA = [0] + A + [K] \n\ndiff = []\nfor i in range(len(A)):\n if i < N+1:\n diff.append(A[i+1] - A[i])\n\nlongest_interval = diff.index(max(diff))\ndiff.pop(longest_interval)\nans = sum(diff)\n\nprint(ans)\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ndiff = []\nfor i in range(len(A)):\n if i < N-1:\n diff.append(A[i+1] - A[i])\n\ndiff = diff + [K-A[-1]+A[0]]\nlongest_interval = diff.index(max(diff))\ndiff.pop(longest_interval)\nans = sum(diff)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s147607361', 's208512730'] | [26420.0, 26444.0] | [142.0, 136.0] | [282, 280] |
p02725 | u548976218 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nall_length = k*2\npoint = []\nfor i in range(n):\n a_left = k-a[i]\n a_right = k+a[i]\n point.append(a_left)\n point.append(a_right)\npoint = list(set(point))\npoint.sort()\n\nnum = len(point)\nnum = round(num)\ndistance = []\nfor i in range(num):\n dis = 0\n for j in range(n-1):\n dis += point[i+j+1] - point[i+j]\n distance.append(dis)\nmindis = min(distance)\nprint(mindis)', 'k, n = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.append(A[0]+k)\nl = 0\nfor i in range(n):\n l = max(l, A[i+1]-A[i])\nprint(k-l)'] | ['Runtime Error', 'Accepted'] | ['s695276556', 's743040755'] | [55724.0, 26444.0] | [2105.0, 163.0] | [457, 150] |
p02725 | u549494450 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ["a=input().split(' ')\nb=input().split(' ')\nc=0\nfor i in int(a[1]):\n if i != a[1]-1:\n if int(b[i+1]) - int(b[i]) > c:\n c = int(b[i+1]) - int(b[i])\n else:\n if int(a[0]) - int(b[-1])+ int(b[0]) > c:\n c = int(a[0]) - int(b[-1])+ int(b[0])\nprint(int(a[0])-c)", "a=input().split(' ')\nb=input().split(' ')\nc=0\nfor i in int(a[1]):\n if i != int(a[1])-1:\n if int(b[i+1]) - int(b[i]) > c:\n c = int(b[i+1]) - int(b[i])\n else:\n if int(a[0]) - int(b[-1])+ int(b[0]) > c:\n c = int(a[0]) - int(b[-1])+ int(b[0])\nprint(int(a[0])-c)\n", "a=input().split(' ')\nb=input().split(' ')\nc=0\nfor i in range(int(a[1])):\n if i != int(a[1])-1:\n if int(b[i+1]) - int(b[i]) > c:\n c = int(b[i+1]) - int(b[i])\n else:\n if int(a[0]) - int(b[-1])+ int(b[0]) > c:\n c = int(a[0]) - int(b[-1])+ int(b[0])\nprint(int(a[0])-c)\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s678086153', 's726403378', 's242399551'] | [18704.0, 18508.0, 18508.0] | [35.0, 36.0, 220.0] | [294, 300, 307] |
p02725 | u556589653 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N = map(int,input().split())\nnow = -10**9\nfor i in range(N):\n if i == N-1:\n if K-A[N-1]+A[i]>now:\n now = K-A[N-1]+A[i]\n else:\n if A[i+1]-A[i] > now:\n now = A[i+1]-A[i]\nprint(K-now)', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\nnow = K-A[N-1]+A[0]\nfor i in range(N-1):\n if A[i+1]-A[i] > now:\n now = A[i+1]-A[i]\nprint(K-now)\n'] | ['Runtime Error', 'Accepted'] | ['s866938366', 's770209586'] | [3060.0, 26060.0] | [17.0, 104.0] | [200, 166] |
p02725 | u561294476 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\n\n\nAN = A[0]+(K-sum(A))\nA2 = A[1:N]\nA2.append(AN)\n\nprint(sum(A2)-max(A2))\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\n\nA2 = [A[i+1] - A[i] for i in range(N-1)]\nAN = A[0]+(A[0]+(K-A[N-1]))\nA2.append(AN)\n\nprint(K-max(A2))\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\n\n\nAN = A[0]+A[N-1]\nA2 = A[1:N]\nA2.append(AN)\n\nprint(sum(A2)-max(A2))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\n\nA2 = [A[i+1] - A[i] for i in range(N-1)]\nAN = A[0]+(K-A[N-1])\nA2.append(AN)\n\nprint(K-max(A2))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s058937592', 's571132139', 's654120137', 's612761022'] | [26444.0, 26420.0, 26444.0, 26548.0] | [77.0, 100.0, 76.0, 101.0] | [187, 216, 182, 209] |
p02725 | u564657854 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N = map(int,input().split())\nA_str = input().split()\nA = [int(h) for h in A_str]\nprint(A)\nD = []\nfor i in range(1,N):\n D.append(A[i]-A[i-1])\nD.append(A[0]+(K-A[N-1]))\nprint(D)\nmaximum = max(D)\nprint(K-maximum)', 'K,N = map(int,input().split())\nA_str = input().split()\nA = [int(h) for h in A_str]\nD = []\nfor i in range(1,N):\n D.append(A[i]-A[i-1])\nD.append(A[0]+(K-A[N-1]))\nmaximum = max(D)\nprint(K-maximum)'] | ['Wrong Answer', 'Accepted'] | ['s399494126', 's484311182'] | [30536.0, 27980.0] | [158.0, 129.0] | [212, 194] |
p02725 | u569776981 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['N = int(input())\nx = 0\na = []\nfor i in range(2,N,2):\n while i % 2 == 0:\n i //= 2\n x += 1\n a.append(x)\n x = 0\na = sorted(a)\na = a[::-1]\nprint(a[0])', 'K, N = map(int,input().split())\nA = list(map(int,input().split()))\nx = []\n\nfor i in range(N - 1):\n x.append(A[i + 1] - A[i])\nx.append(A[0] + K - A[N - 1])\nx = sorted(x)\ndel x[N - 1]\nprint(sum(x))'] | ['Runtime Error', 'Accepted'] | ['s556812130', 's927618711'] | [9032.0, 32372.0] | [24.0, 117.0] | [169, 198] |
p02725 | u571395477 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['def main():\n K, N = [int(_) for _ in input().split()]\n A = map(int, input().split())\n mx = 0\n\n for i in range(N-1):\n dis = A[i+1]-A[i]\n if dis > mx:\n mx = dis\n se = A[N-1] - A[0]\n if (k-(se)) > mx:\n mx = k - se\n print(mx)\nmain()', 'def main():\n K, N = [int(_) for _ in input().split()]\n A = list(map(int, input().split()))\n mx = 0\n\n for i in range(N-1):\n dis = A[i+1] - A[i]\n if dis > mx:\n mx = dis\n se = A[N-1] - A[0]\n \n if K-se > mx:\n mx = K - se\n print(K - mx)\nmain()'] | ['Runtime Error', 'Accepted'] | ['s882082256', 's988152996'] | [18064.0, 25840.0] | [34.0, 94.0] | [281, 294] |
p02725 | u574464625 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n = map(int, input().split())\n\na= list(map(int,input().split()))\nsa=[0]*n\nfor i in range(n-1):\n sa[i]=a[i+1]-a[i]\n sa[n-1]=a[0]+(k-a[n-1])\nprint(sa)\nans=max(sa)\nans=k-ans\nprint(ans)', 'k,n = map(int, input().split())\n\na= list(map(int,input().split()))\nsa=[0]*n\nfor i in range(n-1):\n sa[i]=a[i+1]-a[i]\n sa[n-1]=a[0]+(k-a[n-1])\n#print(sa)\nans=max(sa)\nans=k-ans\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s528620043', 's734740771'] | [32180.0, 32148.0] | [150.0, 146.0] | [189, 190] |
p02725 | u574590381 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['\nk, n = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nres= a[n-1]\n\nmax=0\nn_prev=0\n\nfor nn in a:\n if (nn-n_prev) < (k-a[n-1]):\n res=(nn-n_prev)\n n_prev=nn\n\nprint(res)\n\n', '\nk, n = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nres= a[n-1]\n\nmax=0\nn_prev=0\n\nfor nn in a:\n if (nn-n_prev) > (k-a[n-1]):\n res=(nn-n_prev)\n n_prev=nn\n\nprint(res)\n\n', '\nk, n = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nn_prev= a[n-1]-k\n\nm=0\n\nfor nn in a:\n if (nn-n_prev) > m:\n m=nn-n_prev\n res=(k-m)\n n_prev=nn\n\nprint(res)\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s107179165', 's528314052', 's570282916'] | [25840.0, 25840.0, 26444.0] | [136.0, 115.0, 97.0] | [202, 202, 201] |
p02725 | u578647703 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\nresult = 0\nmx = -float("inf")\nfor i in range(N-1):\n mx = max(mx, A[i+1] - A[i])\nmx = max(mx, K - A[-1])\n\nresult = K - mx\nprint(result)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nresult = 0\nmx = -float("inf")\nfor i in range(N-1):\n mx = max(mx, A[i+1] - A[i])\nmx = max(mx, K - A[-1])\n\nresult = K - mx + A[0]\nprint(result)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nresult = 0\nmx = -float("inf")\nfor i in range(N-1):\n mx = max(mx, A[i+1] - A[i])\nmx = max(mx, K - A[-1] + A[0])\n\nresult = K - mx\nprint(result)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s045000033', 's841193084', 's201146422'] | [25840.0, 26420.0, 26436.0] | [154.0, 163.0, 157.0] | [206, 213, 213] |
p02725 | u581403769 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nspace = []\nfor i in range(n - 1):\n s = a[i + 1] - a[i]\n space.append(s)\nspace.append(k - a[n - 1])\n\nprint(k - max(space))', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nspace = []\nfor i in range(n - 1):\n s = a[i + 1] - a[i]\n space.append(s)\nspace.append(k +a[1] - a[n - 1])\n\nprint(k - max(space))\n', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nspace = []\nfor i in range(n - 1):\n s = a[i + 1] - a[i]\n space.append(s)\nspace.append(k - a[n - 1])\n\nprint(k + a[1] - max(space))', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nspace = []\nfor i in range(n - 1):\n s = a[i + 1] - a[i]\n space.append(s)\nspace.append(k +a[0] - a[n - 1])\n\nprint(k - max(space))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s504142992', 's525468933', 's998042736', 's009648425'] | [26436.0, 26444.0, 26444.0, 26004.0] | [124.0, 123.0, 124.0, 124.0] | [197, 204, 204, 204] |
p02725 | u589913372 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['import numpy as np\nk,n = map(int, input().split())\na = list(map(int, input().split()))\nb = np.zeros(n)\nfor i in range(0,n-1):\n b[i] = a[i+1] -a[i]\n\nb[n-1] = k - a[n-1] + a[0]\nprint(a,b)\nans = k - max(b)\nprint(int(ans))', 'import numpy as np\nk,n = map(int, input().split())\na = list(map(int, input().split()))\nb = np.zeros(n)\nfor i in range(0,n-1):\n b[i] = a[i+1] -a[i]\n \nb[n-1] = k - a[n-1] + a[0]\nprint(a,b)\nans = k - max(b)\nprint(ans)', 'k,n = map(int, input().split())\na = list(map(int, input().split()))\nb = [0 for i in range(n)]\nfor i in range(0,n-1):\n b[i] = a[i+1] -a[i]\n\nb[n-1] = k - a[n-1] + a[0]\nans = k - max(b)\nprint(int(ans))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s466989217', 's820863486', 's469408932'] | [34144.0, 42800.0, 26420.0] | [328.0, 458.0, 117.0] | [219, 216, 199] |
p02725 | u590198086 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['p, n = map(int,input().split())\nl = list(map(int,input().split()))\nans = min(max(l)-min(l), p-max(l)+ min(l))', 'p, n = map(int,input().split())\nl = list(map(int,input().split()))\nl.sort()\nval = l[-1]-l[0]\nfor i in range(1,n):\n val = min(val, l[-1] - l[i] + p-l[-1]+l[i-1])\nprint(val)\n'] | ['Wrong Answer', 'Accepted'] | ['s967784106', 's732806865'] | [25836.0, 25840.0] | [80.0, 178.0] | [109, 175] |
p02725 | u592035627 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['M,N = list(map(int,input().split()))\nA = input().split()\nA.append(M)\ndis = 0\nfor i in range(N):\n if A[i+1]-A[i] >= dis:\n dis = A[i+1]-A[i]\n \nprint(A[-2]-A[0]-(dis-A[1]-A[0]))', 'M,N = list(map(int,input().split()))\nA = list(map(int,input().split()))\nA.append(M+A[0])\ndis = 0\nfor i in range(N):\n if A[i+1]-A[i] >= dis:\n dis = A[i+1]-A[i]\nprint(M-dis)'] | ['Runtime Error', 'Accepted'] | ['s838326040', 's770121030'] | [18508.0, 26444.0] | [34.0, 127.0] | [191, 181] |
p02725 | u592248346 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['#include <stdio.h>\nint main(void){\n long k,n,i,max=-1,a[200000];\n scanf("%ld%ld",&k,&n);\n for(i=0;i<n;i++) scanf("%ld",&a[i]);\n for(i=0;i<n-1;i++){\n int tmp=a[i+1]-a[i];\n if(tmp>max) max=tmp;\n }\n printf("%ld",k-max);\n return 0;\n}', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nm = a[0]+k-a[n-1]\nfor i in range(n-1):\n m = max(m,a[i+1]-a[i])\nprint(k-m)'] | ['Runtime Error', 'Accepted'] | ['s528353964', 's053212540'] | [2940.0, 25836.0] | [17.0, 158.0] | [264, 142] |
p02725 | u595064211 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K, N = map(int, input().split())\nA = list(map(int, input().split()))\nmi = float("inf")\nma = 0\ntokei = 1\nans = 0\n\nfor index, tmp in enumerate(A):\n if index==0:\n left = tmp\n elif index == 1:\n right = tmp\n b1 = right - left\n b2 = left+K-right\n# print(b1)\n# print(b2)\n if b1>b2:\n ans = b2\n tokei = 0\n break\n else:\n ans = b1\n else:\n b1 = tmp-right\n b2 = left+K-tmp\n# print(b1)\n# print(b2)\n print(left)\n print(right)\n if b1<b2:\n ans += b1\n right = tmp\n else:\n ans += b2\n break\nprint(ans)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ninterval=[]\nfor i in range(N-1):\n interval+=[A[i+1]-A[i]]\n interval+=[A[0]+K-A[N-1]]\n# print(interval)\n \nprint(K-max(interval))'] | ['Wrong Answer', 'Accepted'] | ['s470087105', 's744722909'] | [26444.0, 26420.0] | [447.0, 227.0] | [694, 207] |
p02725 | u595289165 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = map(int, input().split())\na = list(map(int, input().split()))\nfor i in range(n):\n a.append(k+a[i])\nright = [0]\n\nfor i in range(1, 2*n):\n right.append(right[-1] + a[i] - a[0])\n\nans = abs(a[0] - a[-2])\nfor i in range(1, n):\n ans = min(ans, abs(a[i] - a[n+i-1]))\nprint(ans)\n\n\n', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\nfor i in range(n):\n a.append(k+a[i])\nright = [0]\n\nfor i in range(1, 2*n):\n right.append(right[-1] + a[i] - a[0])\n\nans = abs(a[0] - a[-2])\nfor i in range(1, n+1):\n ans = min(ans, abs(a[i] - a[n+i-1]))\nprint(ans)\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s631017670', 's220590884'] | [40292.0, 38348.0] | [341.0, 323.0] | [289, 291] |
p02725 | u595786324 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['n,k = map(int,input().split())\na = sorted([i for i in map(int,input().split())])\nmaxi = -1\nans = (n + (n - a[-1]%n))%n + a[0]\n#print(ans)\nfor i in range(1,len(a)):\n maxi = max(maxi,a[i] - a[i - 1])\n ans += a[i] - a[i - 1]\nmaxi = max(maxi,(a[-1] + (a[-1] - a[0]))%n)\nans -= maxi\nprint(ans)\n\n', 'n,k = map(int,input().split())\na = sorted([i for i in map(int,input().split())])\nmaxi = -1\nans = (n + (n - a[-1]%n))%n + a[0]\n#print(ans)\nfor i in range(1,len(a)):\n maxi = max(maxi,a[i] - a[i - 1])\n ans += a[i] - a[i - 1]\nmaxi = max(maxi,(n + (n - a[-1]%n))%n)\nans -= maxi\nprint(ans)\n\n', 'n,k = map(int,input().split())\na = sorted([i for i in map(int,input().split())])\nmaxi = -1\nans = (n + (n - a[-1]%n))%n + a[0]\n#print(ans)\nfor i in range(1,len(a)):\n maxi = max(maxi,a[i] - a[i - 1])\n ans += a[i] - a[i - 1]\nmaxi = max(maxi,(n + (n - a[-1]%n))%n + a[0])\nans -= maxi\nprint(ans)\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s271875428', 's688679360', 's412197545'] | [26420.0, 26444.0, 26444.0] | [216.0, 203.0, 208.0] | [296, 291, 298] |
p02725 | u598888192 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['n,k = list(map(int,input().split()))\narr = list(map(int,input().split()))\nmax_d = k-arr[-1] + arr[0]\nfor i in range(n):\n max_d = max(max_d,arr[i+1]-arr[i])\nprint(k-max_d)', 'n,k, = list(map(int,input().split()))\narr = list(map(int,input().split()))\nmax_d = k-arr[-1] + arr[0]\nfor i in range(n):\n max_d = max(max_d,arr[i+1]-arr[i])\nprint(k-max_d)\n', 'k,n = list(map(int,input().split()))\narr = list(map(int,input().split()))\nmax_d = k-arr[-1] + arr[0]\nfor i in range(n-1):\n max_d = max(max_d,arr[i+1]-arr[i])\nprint(k-max_d)\n\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s026693010', 's256673986', 's265913590'] | [25804.0, 26444.0, 26436.0] | [148.0, 150.0, 151.0] | [171, 173, 175] |
p02725 | u599669731 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k,n=map(int,input().split())\na=list(map(int,input().split()))\na.append(a[0])\ndis=[]\nfor i in range(n):\n d=abs(a[i]-a[i+1])\n if d>k/2:\n d=k-d\n dis.append(d)\nprint(dis,k-max(dis))', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\na.append(a[0])\ndis=[]\nfor i in range(n):\n d=abs(a[i]-a[i+1])\n if d>k/2:\n d=k-d\n dis.append(d)\nprint(k-max(dis))'] | ['Wrong Answer', 'Accepted'] | ['s560733109', 's382002256'] | [26444.0, 26444.0] | [192.0, 176.0] | [193, 189] |
p02725 | u601980345 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K = int(input())\nN = int(input())\nA = {}\nfor i in range(N):\n A[i] = int(input())\nmax = 0\nfor i in range(N):\n len = 0\n if i == 0:\n len = int(A[i] + (K - A[N - 1]))\n else:\n len = int(A[i] - A[i - 1])\n\n if len > max:\n max = len\n\nprint(K - max)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nmax = 0\nfor i in range(N):\n len = 0\n if i == 0:\n len = int(A[i] + (K - A[N - 1]))\n else:\n len = int(A[i] - A[i - 1])\n\n if len > max:\n max = len\n\nprint(K - max)'] | ['Runtime Error', 'Accepted'] | ['s362957388', 's339894002'] | [3064.0, 26444.0] | [17.0, 147.0] | [276, 261] |
p02725 | u602773379 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['# -*- coding: utf-8 -*-\n\nK,N = map(int,input().split())\nAn = list(map(int,input().split()))\n\nBn=An[1:]+[K+An[0]]\nprint(An)\nprint(Bn)\ndis = [x-y for x,y in zip(An,Bn)]\nprint(K-abs(min(dis)))\n', '# -*- coding: utf-8 -*-\n\nK,N = map(int,input().split())\nAn = list(map(int,input().split()))\n\nBn=An[1:]+[K+An[0]]\ndis = [x-y for x,y in zip(An,Bn)]\nprint(K-abs(min(dis)))\n'] | ['Wrong Answer', 'Accepted'] | ['s664691150', 's224355848'] | [25836.0, 26436.0] | [125.0, 89.0] | [190, 170] |
p02725 | u604114648 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['K,N=map(int,input().split())\nA=list(map(int,input().split()))\nn=2*10^6\nfor i in range(N):\n m = abs(A[i-1] - A[i])\n if n > m:\n n = m\nprint(m)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nn=2*10^6\nfor i in range(N):\n m = abs(A[i-1] - A[i])\n if n > m:\n n = m\nprint(m)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nn=0\nj=[-1, -1]\n\nfor i in range(N):\n if i + 1 < N:\n if A[i + 1] - A[i] > n:\n n = A[i + 1] - A[i]\n j = [i, i+1]\n else:\n if K - A[i] + A[0] > n:\n n = K - A[i] + A[0]\n j = [i, 0]\nprint(K - n)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s846665892', 's865456469', 's772430530'] | [26420.0, 26420.0, 25452.0] | [122.0, 121.0, 125.0] | [145, 145, 277] |
p02725 | u605601159 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = [int(i) for i in input().strip().split()]\narr = [int(i) for i in input().strip().split()] + [k + arr[0]]\nmax_d = 0\nfor i in range(1, n + 1):\n max_d = max(max_d, abs(arr[i] - arr[i - 1]))\nprint(k - max_d)', 'k, n = [int(i) for i in input().strip().split()]\narr = [int(i) for i in input().strip().split()]\narr += [k + arr[0]]\nmax_d = 0\nfor i in range(1, n + 1):\n max_d = max(max_d, abs(arr[i] - arr[i - 1]))\nprint(k - max_d)\n'] | ['Runtime Error', 'Accepted'] | ['s782467194', 's951867500'] | [24564.0, 26444.0] | [71.0, 151.0] | [213, 219] |
p02725 | u607729897 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ["import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\ndef main():\n K, N = map(int, readline().split())\n A = list(map(int, readline().split()))\n d = [A[i]-A[i-1] for i in range(1,N)]\n ans = min(K-max(d), max(d))\n print(ans)\n return\n\nif __name__ == '__main__':\n main()\n", "import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\ndef main():\n K, N = map(int, readline().split())\n A = map(int, readline().split())\n ans = max(K - max(A) + min(A),max(A) -min(A))\n print(ans)\n return\n\nif __name__ == '__main__':\n main()", "import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\ndef main():\n K, N = map(int, readline().split())\n A = list(map(int, readline().split()))\n d = [A[i]-A[i-1] for i in range(1,N)]\n d.append(K - max(A) + min(A))\n ans = min(K-max(d), max(d))\n print('d:',d)\n print(ans)\n return\n\nif __name__ == '__main__':\n main()\n", "import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\ndef main():\n K, N = map(int, readline().split())\n A = list(map(int, readline().split()))\n sorted(A)\n d = [A[i]-A[i-1] for i in range(1,N)]\n d.append(K - max(A) + min(A))\n ans = K-max(d)\n print(ans)\n return\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s052729330', 's862784109', 's886753593', 's587838674'] | [20456.0, 13964.0, 20424.0, 20424.0] | [92.0, 60.0, 117.0, 95.0] | [351, 320, 403, 386] |
p02725 | u608493167 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['a,b = map(int,input().split())\nList = [int(i) for i in input().split()]\ns = [0]*b\ns[b-1] = abs(a- List[b-1])\nfor i in range(b-1):\n s[i] = abs(List[i]-List[i+1])\nprint(a-max(s))', 'a,b = map(int,input().split())\nList = [int(i) for i in input().split()]\ns = [0]*b\ns[b-1] = abs(List[0] + a- List[b-1])\nfor i in range(b-1):\n s[i] = abs(List[i]-List[i+1])\nprint(a-max(s))'] | ['Wrong Answer', 'Accepted'] | ['s155015293', 's343562540'] | [26420.0, 24948.0] | [131.0, 129.0] | [179, 189] |
p02725 | u609814378 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['import itertools\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nA_list = list(itertools.permutations(l, N))\n\nprint(A_list)', 'import itertools\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nA_list = list(itertools.permutations(l, N))\nans = 10**8\nfor i in A_list:\n tmp = 0\n \n if i[0] == min(A) and i[2] == max(A):\n pass\n else:\n for j in range(N-1):\n if abs((i[j+1]) - (i[j])) <= abs(K-i[j+1]):\n tmp = tmp + abs((i[j+1]) - (i[j]))\n else:\n tmp = tmp + abs(K-i[j+1])\n \n if tmp <= ans:\n ans = tmp\nprint(ans)', 'K,N = map(int, input().split())\nA = [int(a) for a in input().split()]\n\nans = A[-1]-A[0]\nfor i in range(N-1):\n ans = min(ans, K-A[i+1]+A[i])\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s213981202', 's303522544', 's262383550'] | [26444.0, 26444.0, 26436.0] | [69.0, 65.0, 174.0] | [145, 503, 154] |
p02725 | u612261372 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['from fractions import gcd\nA, B, C, D = map(int, input().split())\n\nif A % C ==0:ca = A//C-1\nelse: ca = A//C\ncb = B//C\n\n\nif A % D ==0: ad = A//D-1\nelse:da = A//D \ndb = B//D\n\nlcm = C * D //gcd(C,D)\nif A % lcm==0: cda = A//lcm-1\nelse:cda = A//lcm\ncdb = B//lcm\n\nprint(B-A+1-((cb-ca)+(db-da)-(cdb-cda)))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nmini = K\nright = left = K\nfor i in range(N):\n\tl_begin = i-1\n\tr_begin = i+1\n\tif i == 0:\n\t\tl_begin = N-1\n\t\tright = A[l_begin] - A[i]\n\t\tleft = K - (A[r_begin]-A[i])\n\telif i == N-1:\n\t\tr_begin = 0\n\t\tright = K - (A[i]-A[l_begin])\n\t\tleft = A[i] - A[r_begin]\n\telse:\n\t\tright = K - (A[i]-A[l_begin])\n\t\tleft = K - (A[r_begin]-A[i])\n\tlocal = min(right, left)\n\tif local < mini:\n\t\tmini = local\n\t\t\n\nprint(mini)'] | ['Runtime Error', 'Accepted'] | ['s019989919', 's426083578'] | [5076.0, 26444.0] | [35.0, 262.0] | [297, 466] |
p02725 | u612895604 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['import numpy as np\n\nK, N = map(int, input().split(" "))\nloc = list(map(int, input().split(" ")))\nloc = np.array(loc)\n\ndist = np.diff(loc)\nnp.append(dist,K - loc[N-1] + loc[0])\n\nmost_far = np.max(dist)\nprint(K-most_far)', 'import numpy as np\n\nK, N = map(int, input().split(" "))\nloc = list(map(int, input().split(" ")))\nloc = np.array(loc)\n\ndist = np.diff(loc)\ndist = np.append(dist, K - loc[N - 1] + loc[0])\n\nmost_far = np.max(dist)\nprint(K - most_far)\n'] | ['Wrong Answer', 'Accepted'] | ['s108851209', 's836973313'] | [42420.0, 34168.0] | [1013.0, 211.0] | [218, 231] |
p02725 | u612975321 | 2,000 | 1,048,576 | There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses. | ['k, n = map(int,input().split())\na = list(map(int,input().split()))\n\nans = 10**6 + 1\nfor i in range(n):\n ans = min(a[-1] - a[i])\n a.append(a[i]+k)\nprint(ans)', 'k, n = map(int,input().split())\na = list(map(int,input().split()))\n\nans = 10**6 + 1\nfor i in range(n):\n ans = min(ans, a[-1] - a[i])\n a.append(a[i]+k)\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s285633524', 's028682477'] | [32204.0, 32156.0] | [69.0, 151.0] | [162, 168] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.