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 | u613292673 | 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\nB = [A[i+1] - A[i] for i in range(len(A)-1)]\nB.append(K-A[-1] + A[0])\n\nprint(B)\nprint(K - max(B))', 'K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nB = [A[i+1] - A[i] for i in range(len(A)-1)]\nB.append(K-A[-1] + A[0])\n\n\nprint(K - max(B))'] | ['Wrong Answer', 'Accepted'] | ['s250884785', 's606364061'] | [26444.0, 25452.0] | [117.0, 100.0] | [173, 165] |
p02725 | u613920660 | 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().strip().split()))\nK=KN[0]\nN=KN[1]\nA_list=list(map(int,input().strip().split()))\n\nDis_list=[A_list[n]-A_list[n-1] for n in range(1,N)]\nDis_list.append(K-(A_list[N-1]-A_list[0]))\n\nmin_distance=K-max(Dis_list)\n\nprint(Dis_list)\nprint(min_distance)\n', 'KN=list(map(int,input().strip().split()))\nK=KN[0]\nN=KN[1]\nA_list=list(map(int,input().strip().split()))\n\nDis_list=[A_list[n]-A_list[n-1] for n in range(1,N)]\nDis_list.append(K-(A_list[N-1]-A_list[0]))\n\nmin_distance=K-max(Dis_list)\n\nprint(min_distance)\n'] | ['Wrong Answer', 'Accepted'] | ['s273236692', 's685296020'] | [26444.0, 26444.0] | [109.0, 96.0] | [268, 252] |
p02725 | u615034089 | 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())\nl = list(map(int,input().split()))\ndif = []\nfor i in range(k):\n if(i==k-1):\n dif.append(abs(n-l[i]) + l[0])\n else:\n dif.append(abs(l[i]-l[i-1]))\n\nans = sum(dif)-max(dif)\nprint(ans)\n', 'n,k = map(int,input().split())\nl = list(map(int,input().split()))\nl = sorted(l)\ndif = []\nfor i in range(k):\n if(i==k-1):\n dif.append(abs(l[i]-(n+l[0])))\n else:\n dif.append(abs(l[i]-l[i+1]))\n \nprint(sum(dif) - max(dif))\n\n'] | ['Wrong Answer', 'Accepted'] | ['s171835027', 's823087479'] | [26436.0, 25840.0] | [145.0, 147.0] | [232, 247] |
p02725 | u617037231 | 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()))\nif K not in L:\n L.reverse()\n K = L[0]\n for i in range(1,len(L)):\n K-=L[i]\n print(K)\nelse:\n K = 0\n for i in range(len(L)-1):\n K += abs(L[i+1]-L[i])\n print(K)\n \n \n', 'K,N = map(int,input().split())\nL = [i for i in map(int,input().split())]\nL.append(L[0]+K)\ndist = []\nfor i in range(N):\n dist.append(L[i+1]-L[i])\nprint(sum(dist)-max(dist))'] | ['Wrong Answer', 'Accepted'] | ['s705538540', 's663520556'] | [26444.0, 26436.0] | [98.0, 121.0] | [246, 174] |
p02725 | u618107373 | 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\nfor i in range(n-1):\n ans=max(ans,a[i+1]-a[i])\nans=max(ans,k-a[-1])\nprint(k-ans)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\nans=0\nfor i in range(n-1):\n ans=max(ans,a[i+1]-a[i])\nans=max(ans,a[0]+k-a[-1])\nprint(k-ans)'] | ['Wrong Answer', 'Accepted'] | ['s313901215', 's949505660'] | [26444.0, 26060.0] | [147.0, 147.0] | [149, 154] |
p02725 | u619809897 | 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 = list(map(int, input().split()))\n\nx_list = A_list[:-1]\n\ny_list = A_list[1:]\n\ndiff_list = list(map(lambda x,y: y - x, x_list, y_list))\ndiff_list.append(int(K-A_list[-1]))\n\nprint(K - max(diff_list))', 'K,N = map(int, input().split())\nA_list = list(map(int, input().split()))\n\nx_list = A_list[:-1]\n\ny_list = A_list[1:]\n\ndiff_list = list(map(lambda x,y: y - x, x_list, y_list))\ndiff_list.append(int(K-A_list[-1]))\n\nprint(K - max(diff_list))', 'K,N = map(int, input().split())\nA_list = list(map(int, input().split()))\n\nx_list = A_list[:-1]\n\ny_list = A_list[1:]\n\ndiff_list = list(map(lambda x,y: y - x, x_list, y_list))\ndiff_list.append(int(K-A_list[-1]))\n\nprint(K - max(diff_list))', 'K,N = map(int, input().split())\nA_list = list(map(int, input().split()))\n\nx_list = A_list[:-1]\n\ny_list = A_list[1:]\n\ndiff_list = list(map(lambda x,y: y - x, x_list, y_list))\ndiff_list.append(int(K-A_list[-1] + A_list[0]))\n\nprint(K - max(diff_list))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s479952581', 's513334077', 's827282406', 's556007984'] | [26436.0, 25840.0, 26420.0, 26420.0] | [95.0, 97.0, 96.0, 94.0] | [236, 236, 236, 249] |
p02725 | u620464724 | 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\nsys.setrecursionlimit(4100000)\n\nk,n = map(int,input().split())\na = list(map(int,input().split()))\nb = []\nfor v in range(n-1):\n b.append(a[v+1]-a[v])\n\nb.append(k-a[n-1]+a[0])\nprint(b)\nanss = max(b)\nans = k - anss\nprint(str(ans))', 'import sys\nsys.setrecursionlimit(4100000)\n\nk,n = map(int,input().split())\na = list(map(int,input().split()))\nb = []\nfor v in range(n-1):\n b.append(a[v+1]-a[v])\n\nb.append(k-a[n-1]+a[0])\nanss = max(b)\nans = k - anss\nprint(str(ans))'] | ['Wrong Answer', 'Accepted'] | ['s461466618', 's624262575'] | [26444.0, 26420.0] | [127.0, 116.0] | [241, 232] |
p02725 | u621225737 | 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 = [int(input()) for i in range(N)]\n\nD = []\nfor i in range(N):\n\tD.append((K + A[i] - A[i - 1]) % K)\n \nprint(K - max(D))', '# K = int(input())\n# N = int(input())\n\nK, N = list(map(int,input().split()))\nA = list(map(int,input().split()))\n \nD = []\nfor i in range(N):\n\tD.append((K + A[i] - A[i - 1]) % K)\n \nprint(K - max(D))'] | ['Runtime Error', 'Accepted'] | ['s435234914', 's817240650'] | [3060.0, 26420.0] | [17.0, 136.0] | [157, 237] |
p02725 | u621345513 | 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()))\na_list = list(map(int, input().split()))\nprint(n , a_list[-1] , a_list[0])\n\nprint(\n n - \\\n max(\n [a_2 - a_1 \\\n for a_1, a_2 in \\\n zip(\n a_list[:-1], \n a_list[1:]\n )\n ] + \\\n [n - a_list[-1] + a_list[0]]\n )\n)', 'n, k = list(map(int, input().split()))\na_list = list(map(int, input().split()))\n\nprint(\n n - \\\n max(\n [a_2 - a_1 \\\n for a_1, a_2 in \\\n zip(\n a_list[:-1], \n a_list[1:]\n )\n ] + \\\n [n - a_list[-1] + a_list[0]]\n )\n)'] | ['Wrong Answer', 'Accepted'] | ['s415481446', 's486888604'] | [25804.0, 25840.0] | [87.0, 85.0] | [316, 282] |
p02725 | u624613992 | 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 \n s = list(map(int,input().split()))\n longest = 0\n for i in range(n-1):\n long = s[i+1] - s[i]\n if long > longest:\n longest = long\n if longest >= k - s[n-1] + s[0]:\n print(k - longest)\n else:\n print(s[n-1] - s[0])', 'k, n = map(int, input().split())\n\ns = list(map(int, input().split()))\nlongest = 0\nfor i in range(n - 1):\n long = s[i + 1] - s[i]\n if long > longest:\n longest = long\nif longest >= k - s[n - 1] + s[0]:\n print(k - longest)\nelse:\n print(s[n - 1] - s[0])'] | ['Runtime Error', 'Accepted'] | ['s712639637', 's097293117'] | [3064.0, 26436.0] | [18.0, 110.0] | [306, 268] |
p02725 | u624696727 | 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\nimport numpy as np\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep="\\n")\nprintH = lambda x: print(" ".join(map(str,x)))\ndef IS(): return sys.stdin.readline()[:-1]\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LI1(): return list(map(int1, sys.stdin.readline().split()))\ndef LII(rows_number): return [II() for _ in range(rows_number)]\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef LLI1(rows_number): return [LI1() for _ in range(rows_number)]\n\ndef main():\n\tK,N = MI()\n\tA = np.array(LI())\n\tA_LAST = K+A[0] - A[N-1]\n\tA[1:] = A[1:]-A[:N-1]\n\tnp.sort(A)\n\tprint(K-max(A[N-1],A_LAST)-A[0])\n\nif __name__ == \'__main__\':\n\tmain()', 'import sys\nimport numpy as np\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep="\\n")\nprintH = lambda x: print(" ".join(map(str,x)))\ndef IS(): return sys.stdin.readline()[:-1]\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LI1(): return list(map(int1, sys.stdin.readline().split()))\ndef LII(rows_number): return [II() for _ in range(rows_number)]\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef LLI1(rows_number): return [LI1() for _ in range(rows_number)]\n\ndef main():\n\tK,N = MI()\n\tA = np.array(LI())\n\tA_LAST = K - A[N-1]\n\tA[1:] = A[1:]-A[:N-1]\n\tnp.sort(A)\n\tprint(sum(A)+A_LAST-max(A[N-1],A_LAST))\n\nif __name__ == \'__main__\':\n\tmain()', 'import sys\nimport numpy as np\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep="\\n")\nprintH = lambda x: print(" ".join(map(str,x)))\ndef IS(): return sys.stdin.readline()[:-1]\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LI1(): return list(map(int1, sys.stdin.readline().split()))\ndef LII(rows_number): return [II() for _ in range(rows_number)]\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef LLI1(rows_number): return [LI1() for _ in range(rows_number)]\n\ndef main():\n\tK,N = MI()\n\tA = np.array(LI())\n\tA_LAST = K - A[N-1]\n\tA[1:] = A[1:]-A[:N-1]\n\tnp.sort(A)\n\tprint(K-max(A[N-1],A_LAST))\n\nif __name__ == \'__main__\':\n\tmain()', 'import sys\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep="\\n")\nprintH = lambda x: print(" ".join(map(str,x)))\ndef IS(): return sys.stdin.readline()[:-1]\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LI1(): return list(map(int1, sys.stdin.readline().split()))\ndef LII(rows_number): return [II() for _ in range(rows_number)]\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef LLI1(rows_number): return [LI1() for _ in range(rows_number)]\n\ndef main():\n\tk,n = MI()\n\ta = LI()\n\tb = [0]*n\n\tfor i in range(n):\n\t\tif i == n-1:\n\t\t\tb[i] = a[0]+k-a[i]\n\t\telse:\n\t\t\tb[i] = a[i+1]-a[i]\n\tb.sort()\n\tprint(k-b[-1])\n\n\nif __name__ == \'__main__\':\n\tmain()'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s191341655', 's371968057', 's907388003', 's938285380'] | [43068.0, 42888.0, 42672.0, 25692.0] | [354.0, 1623.0, 371.0, 121.0] | [813, 815, 803, 814] |
p02725 | u626228246 | 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 if a[i] >= k/2:\n a[i] = a[i] -k\nprint(max(a)-min(a))\n', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nfor i in range(n):\n if a[i] >= k/2\n a[i] = a[i] -k\nprint(max(a)-min(a))', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nl = []\nl.append(abs(k-abs(a[0]-a[n-1])))\nfor i in range(n-1):\n\tl.append(abs(a[i]- a[i+1]))\nprint(l)', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nl = []\nl.append(abs(k-abs(a[0]-a[n-1])))\nfor i in range(n-1):\n\tl.append(abs(a[i]- a[i+1]))\nprint(sum(l)-max(l))'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s201334876', 's215275789', 's363609732', 's846829635'] | [32292.0, 8676.0, 32236.0, 32216.0] | [111.0, 25.0, 129.0, 121.0] | [143, 141, 165, 177] |
p02725 | u629350026 | 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()\ntemp=a[0]+a[n-1]\nfor i in range(1,n):\n temp=max(temp,a[i]-a[i-1])\nprint(k-temp)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\ntemp=a[0]+a[n-1]\nfor i in range(1,n):\n temp=max(ans,a[i]-i[i-1])\nprint(k-temp)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\ntemp=a[0]+a[n-1]\nfor i in range(1,n):\n temp=max(temp,a[i]-i[i-1])\nprint(k-temp)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\ntemp=a[0]+k-a[n-1]\nfor i in range(1,n):\n temp=max(temp,a[i]-a[i-1])\nprint(k-temp)'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s239840672', 's484932814', 's767879901', 's821033284'] | [26436.0, 26444.0, 26444.0, 25836.0] | [140.0, 69.0, 67.0, 140.0] | [151, 150, 151, 153] |
p02725 | u638847754 | 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())\nmtrx=list(map(int,input().split()))\nmtrx.append(K)\nlength = []\nfor i in range(len(mtrx)-1):\n length.append(mtrx[i+1]-mtrx[i])\nprint(K-max(length))', 'K,N=map(int,input().split())\nmtrx=list(map(int,input().split())) \nmtrx.append(K+mtrx[0])\nlength = []\nfor i in range(len(mtrx)-1):\n length.append(mtrx[i+1]-mtrx[i])\nprint(length)\nprint(K-max(length))', 'K,N=map(int,input().split())\nmtrx=list(map(int,input().split())) \nmtrx.append(K+mtrx[0])\nlength = []\nfor i in range(len(mtrx)-1):\n length.append(mtrx[i+1]-mtrx[i])\nprint(K-max(length))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s278422301', 's445334994', 's623423089'] | [25840.0, 25836.0, 25796.0] | [117.0, 128.0, 119.0] | [178, 202, 188] |
p02725 | u641393644 | 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 = input().split(" ")\nj = input().split(" ")\nk = int(m[0])\nn = int(m[1])\nA = []\nfor i in range(j):\n d1 = j[i+1] - j[i]\n d2 = j[i+2] - j[i+1]\n min = min(d1,d2)\n A.append(int(min))\nprint(A)', "KN = input().split(' ')\nK = int(KN[0])\nN = int(KN[1])\nM = K/2\nAl = input().split(' ')\nA = []\n\n\ndef distance(d1,d2,M,K):\n if d1<=M and d2>=M:\n return d1+(K-d2)\n else:\n return abs(d2-d1)\n\nfor home in Al:\n A.append(int(home))\n\nm = distance(A[0],A[-1],M,K)\n\nfor i in range(N-1):\n m = max(m,distance(A[i],A[i+1],M,K))\n\nprint (10-m)\n", 'l = input().split(" ")\nj = input().split(" ")\nk = int(l[0])\nn = int(l[1])\nfor i in range(n-1):\n d1 = int(j[i+1]) - int(j[i])\n d2 = int(j[i+2]) - int(j[i+1])\n max = max(d1,d2)\ndt = k - int(max)\nprint(dt)\n', "KN = input().split(' ')\nK = int(KN[0])\nN = int(KN[1])\nM = K/2\nAl = input().split(' ')\nA = []\nfor home in Al:\n A.append(int(home))\nm = 0\n\nm = distance(A[0],A[-1],M,K)\n\nfor i in range(N-1):\n m = max(m,distance(A[i],A[i+1],M,L))\nprint (10-m)\n\ndef distance(d1,d2,M,K):\n if d1<=M and d2<=M:\n return abs(d2-d1)\n if d1<=M and d2>=M:\n return d1+(K-d2)\n if d1>=M and d2>=M:\n return abs(d2-d1)", 'l = input().split(" ")\nj = input().split(" ")\nk = int(m[0])\nn = int(m[1])\nfor i in range(j):\n d1 = j[i+1] - j[i]\n d2 = j[i+2] - j[i+1]\n max = max(d1,d2)\n dt = k - int(max)\nprint(dt)\n', 'l = input().split(" ")\nj = input().split(" ")\nk = int(l[0])\nn = int(l[1])\nx = 0\nfor i in range(n):\n d = int(j[i+1]) - int(j[i])\n x = max(x,d)\ndt = k - int(x)\nprint(dt)\n', 'l = input().split(" ")\nj = input().split(" ")\nk = int(l[0])\nn = int(l[1])\nfor i in range(j):\n d1 = j[i+1] - j[i]\n d2 = j[i+2] - j[i+1]\n max = max(d1,d2)\n dt = k - int(max)\nprint(dt)\n', 'l = input().split(" ")\nj = input().split(" ")\nk = int(l[0])\nn = int(l[1])\nx = 0\nfor i in range(n-1):\n d = int(j[i+1]) - int(j[i])\n x = max(x,d)\ndt = k - int(x)\nprint(dt)\n', 'l = input().split(" ")\nj = input().split(" ")\nk = int(l[0])\nn = int(l[1])\nfor i in range(n-1):\n d1 = int(j[i+1]) - int(j[i])\n d2 = int(j[i+2]) - int(j[i+1])\n max = max(d1,d2)\n dt = k - int(max)\nprint(dt)\n', 'l = input().split(" ")\nj = input().split(" ")\nk = int(l[0])\nn = int(l[1])\nx = 0\nm = k-int(j[-1])+int(j[0])\nfor i in range(n-1):\n d = int(j[i+1]) - int(j[i])\n x = max(x,d)\nx = max(x,m)\ndt = k - int(x)\nprint(dt)\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s169154146', 's412943941', 's451897698', 's512043309', 's533008007', 's558438919', 's761412097', 's773376168', 's857606226', 's121550992'] | [18508.0, 28720.0, 18484.0, 26444.0, 18508.0, 17948.0, 18508.0, 18508.0, 17948.0, 18508.0] | [34.0, 248.0, 34.0, 94.0, 34.0, 200.0, 33.0, 199.0, 33.0, 211.0] | [192, 337, 206, 397, 186, 170, 186, 172, 208, 212] |
p02725 | u641460756 | 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, l = map(int, input().split())\na = list(map(int, input().split()))\na.insert(0, 0)\na.append(k)\ne = []\nfor i in range(len(a)-1):\n e.append(a[i + 1] - a[i])\nans = sum(e) - max(e)-(e[1]-e[0])-(e[-1]-e[-2])\nprint(ans)', 'k, l = map(int, input().split())\na = list(map(int, input().split()))\ne = []\nfor i in range(len(a)-1):\n e.append(a[i + 1] - a[i])\ne.append(a[0] + (k - a[-1]))\nans = sum(e) - max(e)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s837565049', 's975240565'] | [26444.0, 26436.0] | [122.0, 118.0] | [217, 193] |
p02725 | u644568755 | 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())\nlist_a = list(map(int, input().split()))\n\nx = 0\nlongest = 0\nfor a in list_a:\n if a - x > longest:\n longest = a - x\n x = a - x\nif longest < a[0] + (k - a[n-1]):\n longest = a[0] + (k - a[n-1]):\nprint(k-longest)', 'k, n = map(int, input().split())\nlist_a = list(map(int, input().split()))\n \nx = 0\nlongest = 0\nfor a in list_a:\n if a - x > longest:\n longest = a - x\n x = a - x\nif longest < a[0] + (k - a[n-1]):\n longest = a[0] + (k - a[n-1])\nprint(k-longest)', 'k, n = map(int, input().split())\nlist_a = list(map(int, input().split()))\n \nx = 0\nlongest = 0\nfor a in list_a:\n if a - x > longest:\n longest = a - x\n x = a\nif longest < list_a[0] + (k - list_a[n-1]):\n longest = list_a[0] + (k - list_a[n-1])\nprint(k-longest)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s449482360', 's506809641', 's986878877'] | [2940.0, 26444.0, 26420.0] | [17.0, 117.0, 95.0] | [249, 249, 263] |
p02725 | u646203242 | 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()))\nj=[int(k+a[1]-a[-1])]\nfor i in range(n-1):\n j.append(a[i+1]-a[i])\nprint(k-max(j))\n', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\nj=[int(k-a[-1])]\nfor i in range(n-1):\n j.append(a[i+1]-a[i])\nprint(k-max(j))', 'k,n=map(int,input().split())\na=[map(int,input().split()]\nj=[k-a[n-1]]\nfor i in range(n-1):\n j.append(a[i+1]-a[i])\nprint(k-max(j))\n', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\nj=[int(k+a[0]-a[-1])]\nj.append(a[i+1]-a[i] for i in range(n-1))\nprint(k-max(j))\n\n\n', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\nj=[int(k+a[0]-a[-1])]\nfor i in range(n-1):\n j.append(a[i+1]-a[i])\nprint(k-max(j))\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s250545825', 's439952662', 's444879175', 's670745839', 's656032438'] | [26444.0, 25836.0, 2940.0, 26420.0, 26420.0] | [117.0, 120.0, 17.0, 66.0, 120.0] | [147, 141, 133, 144, 147] |
p02725 | u646892595 | 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 = [A[0]+K-A[N-1]]\nprint(A)\nfor _ in range(N-1):\n p = A.pop()\n sub.append(K-p)\n K = p\nprint(sub)\nsub.remove(max(sub))\nprint(sum(sub))', 'K, N = map(int,input().split())\nA = list(map(int, input().split()))\nsub = [A[0]]\n\nfor _ in range(N):\n p = A.pop()\n sub.append(K-p)\n K = p\n\nprint(sub)\nsub.remove(max(sub))\nprint(sum(sub))', 'K, N = map(int,input().split())\nA = list(map(int, input().split()))\na = A[0]\nsub = []\nfor _ in range(N):\n p = A.pop()\n sub.append(K-p)\n K = p\nsub[0] += a\nprint(sub)\nsub.remove(max(sub))\nprint(sum(sub))', 'K, N = map(int,input().split())\nA = list(map(int, input().split()))\na = A[0]\nsub = []\nfor _ in range(N):\n p = A.pop()\n sub.append(K-p)\n K = p\nsub[0] += a\nsub.remove(max(sub))\nprint(sum(sub))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s235407824', 's530756131', 's564557894', 's251668582'] | [25840.0, 26436.0, 25840.0, 25452.0] | [165.0, 152.0, 149.0, 134.0] | [213, 195, 210, 199] |
p02725 | u647287452 | 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, *A = map(int, open(0).read().split())\nB = []\nfor i in range(N - 1):\n B.append(A[i + 1] - A[i])\nB.append(K - A[-1] + A[0])\nprint(B)\nprint(K - max(B))\n', 'K, N, *A = map(int, open(0).read().split())\nB = []\nfor i in range(N - 1):\n B.append(A[i + 1] - A[i])\nB.append(K - A[-1] + A[0])\nprint(K - max(B))\n'] | ['Wrong Answer', 'Accepted'] | ['s627698927', 's584902510'] | [25124.0, 25124.0] | [130.0, 114.0] | [158, 149] |
p02725 | u647796955 | 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\nlines = sys.stdin.readlines() \n\nKN = lines[0].strip(" ")\nA = lines[1].strip(" ")\n\nK=int(KN[0])\n\nX = K - int(A[-1])\ntemp = 0\nfor Ai in A:\n Y = int(Ai) - temp\n if Y > X:\n X = Y\n temp = int(Ai)\n\nprint(K-X)\n \n', 'import sys\nlines = sys.stdin.readlines() \n\nKN = input().strip(" ")\nA = input().strip(" ")\n\nK=int(KN[0])\n\nX = K - int(A[-1])\ntemp = 0\nfor Ai in A:\n Y = int(Ai) - temp\n if Y > X:\n X = Y\n temp = int(Ai)\n\nprint(K-X)\n \n', 'import sys\nlines = sys.stdin.readlines() \n\nKN = lines[0].strip(" ")\nA = lines[1].strip(" ")\n\nK=KN[0]\n\nX = K - A[-1]\ntemp = 0\nfor Ai in A:\n Y = Ai - temp\n if Y > X:\n X = Y\n temp = Ai\n\nprint(K-X)\n ', 'K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nans = K - A[-1] + A[0]\nfor n in range(N-1):\n dis = A[n+1] - A[n]\n ans = max(ans, dis)\n \nprint(K-ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s003377444', 's591803279', 's982206344', 's708340538'] | [5748.0, 5748.0, 5876.0, 26444.0] | [19.0, 21.0, 20.0, 168.0] | [250, 248, 229, 179] |
p02725 | u648212584 | 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\ninput = sys.stdin.buffer.readline\n\ndef main():\n L,N = map(int,input().split())\n a = list(map(int,input().split()))\n \n ans = 0\n for i in range(N-1):\n ans = max(ans,a[i+1]-a[i])\n \n ans = max(ans,N+a[0]-a[-1])\n \n print(L-ans)\n \nif __name__ == "__main__":\n main()\n', 'import sys\ninput = sys.stdin.buffer.readline\n\ndef main():\n K,N = map(int,input().split())\n a = list(map(int,input().split()))\n \n a = [a[-1]-K] + a + [a[0]+K]\n \n ans = K\n \n for i in range(N):\n use = max(a[i+1]-a[i],a[i+2]-a[i+1])\n ans = min(ans,K-use)\n \n print(ans)\n \nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s312475574', 's508296448'] | [20420.0, 20428.0] | [135.0, 198.0] | [315, 352] |
p02725 | u654517927 | 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. | ['date0=input().rstrip().split(" ")\ndate1=input().rstrip().split(" ")\nlist0=[]\nlist1=[]\nfor i in range(int(date0[1])):\n list0.append(int(date1[i]))\n#print(list0)\nlist0=sorted(list0)\n#print(list0)\nfor j in range(int(date0[1])-1):\n list1.append(list0[j+1]-list0[j])\nlist1.append(int(date0[0])-list0[int(date0[1])-1])\nlist1=sorted(list1,reverse=True)\nprint(int(date0[0])-list1[0])', 'date0=input().rstrip().split(" ")\ndate1=input().rstrip().split(" ")\nlist0=[]\nlist1=[]\nfor i in range(int(date0[1])):\n list0.append(int(date1[i]))\nlist0=sorted(list0)\nfor j in range(int(date0[1])-1):\n list1.append(list0[j+1]-list0[j])\nlist1.append(int(date0[0])-list0[int(date0[1])-1]+list0[0])\nlist1=sorted(list1,reverse=True)\nprint(int(date0[0])-list1[0])'] | ['Wrong Answer', 'Accepted'] | ['s514983635', 's506544991'] | [28080.0, 28080.0] | [175.0, 182.0] | [377, 358] |
p02725 | u654697086 | 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\nper_dist = list(A[i+1]-A[i] for i in range(0,N-1))\nlast_dist = A[0] + K - A[N]\nper_dist = per_dist.append(last_dist)\nmax_dist = max(per_dist)\nprint(K - max_dist)', 'K_N_nyuryoku = input().split()\nK = int(K_N_nyuryoku[0])\nN = int(K_N_nyuryoku[1])\n\nA = list(map(int,input().split()))\n\nprint(A)\n\nkyori = 0\nfor i in A:\n kyori += i - kyori\n\nprint(kyori)', 'K_N_nyuryoku = input().split()\nK = K_N_nyuryoku[0]\nN = K_N_nyuryoku[1]\n\nA = list(map(int,input().split()))\n\nprint(A)\n\nkyori = 0\nfor i in A:\n kyori += i - kyori\n\nprint(kyori)\n', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\n\nper_dist = list(A[i+1]-A[i] for i in range(0,N-1))\nlast_dist = A[0] + K - A[N - 1]\nper_dist = per_dist.append(last_dist)\nmax_dist = max(per_dist)\nprint(K - max_dist)', 'K,N = map(int,input().split())\n\nA = list(map(int,input().split()))\n\nprint(A)\n\nkyori = 0\nfor i in A:\n kyori += i - kyori\n\nprint(kyori)\n', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\n\nper_dist = list(A[i+1]-A[i] for i in range(0,N-1))\nlast_dist = A[0] + K - A[N - 1]\ntype(last_dist)\nper_dist.append(last_dist)\nmax_dist = max(per_dist)\nprint(K - max_dist)'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s054894348', 's238196281', 's330998159', 's377425479', 's678549782', 's793669622'] | [26444.0, 26444.0, 26444.0, 26444.0, 26420.0, 26444.0] | [103.0, 115.0, 110.0, 98.0, 108.0, 103.0] | [228, 186, 177, 232, 137, 237] |
p02725 | u655048024 | 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\nfor i in range(N-1):\n if(a[i+1]>a[i]):\n k=a[i+1]-a[i]\n else:\n k=a[i]-a[i+1]\n ans = max(k,ans)\nans = K-ans\n\n ', 'K,N = map(int,input().split())\na = list(map(int,input().split()))\nans = 0\nfor i in range(N-1):\n m=a[i+1]-a[i]\n ans = max(ans,m)\nh = K - a[N-1]+a[0]\nans = max(ans,h)\nans = K-ans\n\n \n', 'K,N = map(int,input().split())\na = list(map(int,input().split()))\nans = 0\nfor i in range(N-1):\n m=a[i+1]-a[i]\n ans = max(ans,m)\nh = K - a[N-1]+a[0]\nans = max(ans,h)\nans = K-ans\nprint(ans)\n\n \n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s530018672', 's974188814', 's710431161'] | [26436.0, 26420.0, 25796.0] | [199.0, 154.0, 145.0] | [192, 187, 198] |
p02725 | u657183715 | 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(x) for x in input().split()]\na=[int(x) for x in input().split()]\na.append(k)\nl=[]\nfor i in range(len(a)-1):\n s = a[i+1]-a[i]\n if s<0:\n s=-s\n l.append(s)\nmax_value=max(l)\nprint(k-max_value)', 'k,n=[int(x) for x in input().split()]\na=[int(x) for x in input().split()]\n\nif a[0]==0:\n a.append(k)\nelse:\n a.append(k+a[0])\nl=[]\nfor i in range(len(a)-1):\n s = a[i+1]-a[i]\n if s<0:\n s=-s\n l.append(s)\nmax_value=max(l)\n#max_index=l.index(max_value)\nprint(k-max_value)'] | ['Wrong Answer', 'Accepted'] | ['s451974207', 's426945197'] | [25452.0, 26420.0] | [139.0, 138.0] | [213, 287] |
p02725 | u658525821 | 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())\nA = list(map(int, input().split()))\nm = K + A[0] - A[N-1]\nfor i in range(N-1):\n d = A[i+1] - A[i]\n if d > m:\n m = d\nprint(K-m)\n', 'K, N = int(input())\nA = list(map(int, input().split()))\nm = K + A[0] - A[N-1]\nfor i in range(N-1):\n d = A[i+1] - A[i]\n m = max([d, m])\nprint(K-m)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nm = K + A[0] - A[N-1]\nfor i in range(N-1):\n d = A[i+1] - A[i]\n m = max([d, m])\nprint(K-m)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s699952918', 's831581129', 's115096099'] | [3060.0, 3060.0, 26444.0] | [17.0, 17.0, 179.0] | [152, 147, 161] |
p02725 | u660018248 | 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. | ['if __name__ == "__main__":\n k, n = map(int, input().split())\n a = list(map(int, input().split()))\n import numpy as np\n a = np.array(a)\n\n kouho = a[0] + (k - a[-1])\n\n sa = a[1:] - a[0: -1]\n\n kouho1 = k - max(sa)\n\n print(max(kouho,kouho1))\n', 'if __name__ == "__main__":\n k, n = map(int, input().split())\n a = list(map(int, input().split()))\n import numpy as np\n a = np.array(a)\n\n sa_kouho = a[0] + (k - a[-1])\n\n sa = a[1:] - a[0: -1]\n\n sa_kouho1 = max(sa)\n\n print(k - max(sa_kouho, sa_kouho1))\n\n'] | ['Wrong Answer', 'Accepted'] | ['s268605576', 's966140465'] | [30136.0, 30632.0] | [1361.0, 407.0] | [262, 276] |
p02725 | u660640166 | 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. | ['\nfrom sys import stdin\nimport sys\nsys.setrecursionlimit(10**8)\n\ndef getInputs():\n\tinputs=[]\n\tfor line in stdin:\n\t\tline=line.split()\n\t\tinputs.append(line)\n\treturn inputs\n\ndef main(inputs):\n\tk,n=getIntList(inputs[0])\n\taList=getIntList(inputs[1])\n\t\n\td=k-aList[n-1]+aList[0]\n\tdi=n-1\n# \tprint(d,di)\n\tfor ai in range(n-1):\n\t\tdd=aList[ai+1]-aList[ai]\n# \t\tprint(dd)\n\t\tif dd>d:\n\t\t\tdi=ai\n\t\t\td=dd\n\t\n\tprint(k-d)\n\n\nif __name__=="__main__":\n\tinputs=getInputs()\n\n\tmain(inputs)\n', 'def getIntList(inp):\n\treturn [int(_) for _ in inp]\n\n\nfrom sys import stdin\nimport sys\nsys.setrecursionlimit(10**8)\n\ndef getInputs():\n\tinputs=[]\n\tfor line in stdin:\n\t\tline=line.split()\n\t\tinputs.append(line)\n\treturn inputs\n\ndef main(inputs):\n\tk,n=getIntList(inputs[0])\n\taList=getIntList(inputs[1])\n\t\n\td=k-aList[n-1]+aList[0]\n\tdi=n-1\n# \tprint(d,di)\n\tfor ai in range(n-1):\n\t\tdd=aList[ai+1]-aList[ai]\n# \t\tprint(dd)\n\t\tif dd>d:\n\t\t\tdi=ai\n\t\t\td=dd\n\t\n\tprint(k-d)\n\n\nif __name__=="__main__":\n\tinputs=getInputs()\n\n\tmain(inputs)\n'] | ['Runtime Error', 'Accepted'] | ['s740557315', 's115503373'] | [18292.0, 25308.0] | [35.0, 98.0] | [483, 535] |
p02725 | u660899380 | 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()\nK = int(K)\nN = int(N)\nhouses = list(map(int, input().split()))\nmaxDistance = 0\ndistance = 0\nfor i in range(N):\n firstHouse = houses[i]\n lastHouse = houses[i - 1]\n if lastHouse > firstHouse:\n distance = lastHouse - firstHouse\n else:\n distance = (K - firstHouse) + lastHouse\n if distance > maxDistance:\n maxDistance = distance\nprint(distance)', 'K, N = input().split()\nK = int(K)\nN = int(N)\nhouses = list(map(int, input().split()))\nfirst = True\ndistance = 0\nfor i in range(N):\n firstHouse = houses[i]\n lastHouse = houses[i - 1]\n if lastHouse > firstHouse:\n distance = lastHouse - firstHouse\n else:\n distance = (K - firstHouse) + lastHouse\n if first or distance < minDistance:\n minDistance = distance\n first = False\nprint(minDistance)'] | ['Wrong Answer', 'Accepted'] | ['s771541089', 's023911411'] | [26444.0, 26060.0] | [148.0, 158.0] | [377, 404] |
p02725 | u664907598 | 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 = [0] * n\nfor i in range(n-1):\n b[i] = a[i+1] - a[i]\nb[n-1] = k - a[n-1]\nprint(k-max(b))', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nb = [0] * n\nfor i in range(n-1):\n b[i] = a[i+1] - a[i]\nb[n-1] = k - a[n-1] + a[0]\nprint(k-max(b))'] | ['Wrong Answer', 'Accepted'] | ['s544649252', 's669600198'] | [26444.0, 26444.0] | [111.0, 117.0] | [160, 167] |
p02725 | u665038048 | 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)\na_sub = [0] * (n - 1)\nfor i in range(n):\n a_sub[i] = a[i+1] - a[i]\nprint(k - max(a_sub))\n', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\na.append(a[0] + k)\na_sub = [0] * (n - 1)\nfor i in range(n-1):\n a_sub[i] = a[i+1] - a[i]\nprint(k - max(a_sub))\n', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\na.append(a[0] + k)\na_sub = [0] * (n)\nfor i in range(n):\n a_sub[i] = a[i+1] - a[i]\nprint(k - max(a_sub))\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s257819359', 's353302889', 's012028281'] | [25580.0, 26444.0, 26444.0] | [113.0, 114.0, 118.0] | [180, 182, 176] |
p02725 | u667084803 | 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\nprint(min(K-A[0], A[-1]))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nans = A[-1] - A[0]\nfor i in range(N-1):\n ans = min(ans, A[i] - A[i+1] + K)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s348782170', 's063418009'] | [26420.0, 26420.0] | [67.0, 165.0] | [95, 156] |
p02725 | u670180528 | 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,*a=map(int,open(0).read().split())\na+=[k+a[0]]\nprint(min(y-x for x,y in zip(a,a[1:])))', 'k,n,*a=map(int,open(0).read().split())\na+=[k+a[0]]\nprint(k-max(y-x for x,y in zip(a,a[1:])))'] | ['Wrong Answer', 'Accepted'] | ['s978022515', 's374195805'] | [25124.0, 25124.0] | [82.0, 81.0] | [90, 92] |
p02725 | u672475305 | 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()))\nr = 0\nfor i in range(1, n):\n r = max(r, A[i]-A[i-1])\nr = max(r, k-A[-1])\nprint(k-r)', 'k,n = map(int,input().split())\nA = list(map(int,input().split()))\nr = 0\nfor i in range(1, n):\n r = max(r, A[i]-A[i-1])\nprint(k-r)', 'k,n = map(int,input().split())\nA = list(map(int,input().split()))\ndis = []\nfor i in range(1, n):\n dis.append(A[i]-A[i-1])\ndis.append(k-A[-1]+A[0])\nprint(k - max(dis))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s719811128', 's753507192', 's295683604'] | [26444.0, 26444.0, 26436.0] | [136.0, 142.0, 116.0] | [152, 132, 169] |
p02725 | u672898046 | 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.append(k+a[0])\n\nprint("k+a[0]:",k+a[0])\nd = 0\n\nfor i in range(n):\n d = max(d, a[i+1]-a[i])\n \nprint(k-d)', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\na.append(k+a[0])\n\nd = 0\n\nfor i in range(n):\n d = max(d, a[i+1]-a[i])\n \nprint(k-d)'] | ['Wrong Answer', 'Accepted'] | ['s259718439', 's789943987'] | [32296.0, 32168.0] | [127.0, 127.0] | [253, 229] |
p02725 | u674052742 | 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"""\nCreated on Sat Mar 28 21:11:28 2020\n\n@author: Kanaru Sato\n"""\n\nk,n = list(map(int, input().split()))\na = list(map(int, input().split()))\ndl = []\n\nfor i in range(n-1):\n d = a[i+1]-a[i]\n if d > k/2:\n d = k-d\n dl.append(d)\n\nd = a[n-1]-a[0]\nif d > k/2:\n d = k-d\ndl.append(d)\n\nprint(dl)\nans = k-max(dl)\n\nprint(ans)', '# -*- coding: utf-8 -*-\n"""\nCreated on Sat Mar 28 21:11:28 2020\n\n@author: Kanaru Sato\n"""\n\nk,n = list(map(int, input().split()))\na = list(map(int, input().split()))\ndl = []\n\nfor i in range(n-1):\n d = a[i+1]-a[i]\n if d > k/2:\n d = k-d\n dl.append(d)\n\nd = a[n-1]-a[0]\nif d > k/2:\n d = k-d\ndl.append(d)\n\nans = k-max(dl)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s531551897', 's773266745'] | [25840.0, 25836.0] | [180.0, 162.0] | [356, 346] |
p02725 | u674588203 | 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)\n\nD=[]\nfor i in range(len(A)-1):\n d=A[i+1]-A[i]\n D.append(D)\n\nprint(K-max(D))', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nA.append(A[0]+K)\n\nD=[]\nfor i in range(len(A)-1):\n d=A[i+1]-A[i]\n D.append(d)\n\nprint(K-max(D))'] | ['Runtime Error', 'Accepted'] | ['s121359995', 's742486567'] | [26420.0, 26824.0] | [2104.0, 125.0] | [161, 161] |
p02725 | u676458682 | 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)\nl=0\nfor i in range(N-1):\n l=max(l,A[i+1]-A[i])\n \nprint(K-l)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\n\nmax = K-A[-1]+A[0]\nfor i in range(N-1):\n if last < A[i+1]-A[i]:\n max = A[i+1]-A[i]\n\nprint(K-max)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nA.append(A[0]+K)\nfor i in range(N-1):\n l=0\n l=max(l,A[i+1]-A[i])\n\nprint(K-l)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\n \nA.append(K+A[0])\nl=0\nfor i in range(len(A)-1):\n l=max(l,A[i+1]-A[i])\n \nprint(K-l)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s509835988', 's645032848', 's711659892', 's857465833'] | [26444.0, 26436.0, 26444.0, 26444.0] | [163.0, 65.0, 143.0, 167.0] | [141, 169, 144, 148] |
p02725 | u676939443 | 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()))\n\na.append(k)\n\nbig = 0\nbig_count = a[0]\n\nfor i in range(n):\n b = a[i + 1] - a[i]\n print(b)\n if b > big_count:\n print('ここ')\n big_count = b\n big = i\n\nif big == 0:\n ans = a[n - 1] - a[0]\nelse:\n ans = a[i - 1] + (k - a[i])\n\nprint(ans)", 'k, n = map(int, input().split())\n\na = list(map(int, input().split()))\n\na.append(k + a[0])\n\nsection = []\n\nfor i in range(n):\n b = a[i + 1] - a[i]\n section.append(b)\n\nb_max = max(section)\nans = k - b_max\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s881248829', 's278271512'] | [26436.0, 25840.0] | [258.0, 126.0] | [339, 220] |
p02725 | u684267998 | 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\nS = [0]*(N+1)\n\nfor i in range(N):\n if i==N-1:\n S[i+1] = A[i] - K + A[0]\n else:\n S[i+1] = A[i+1] - A[i]\n\nSmax = S.index(max(S))\n\nans = sum(S)-S[Smax]\nprint(ans)', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\n\nS =[A[0]]+ [0]*(N)\n\nfor i in range(N):\n if i==N-1:\n S[i+1] = K- A[i]\n else:\n S[i+1] = A[i+1] - A[i]\n\nSmax = S.index(max(S))\n\nans = sum(S)-S[Smax]\nprint(ans)', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\n\nS = [0]*(N+1)\n\nfor i in range(N):\n if i==N:\n S[i+1] = A[i] - K + A[0]\n else:\n S[i+1] = A[i+1] - A[i]\n\nSmax = S.index(max(S))\n\nans = sum(S)-S[Smax]\nprint(ans)', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\n\nS = [0]*(N)\n\nfor i in range(N):\n \n if i==N-1:\n S[i] = K + A[0] -A[i]\n else:\n S[i] = A[i+1] - A[i]\n\nSmax = S.index(max(S))\n\nans = sum(S)-S[Smax]\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s082068165', 's176897794', 's794565501', 's442641529'] | [25840.0, 26444.0, 26444.0, 25836.0] | [144.0, 141.0, 130.0, 136.0] | [246, 243, 244, 246] |
p02725 | u686036872 | 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 = sorted(map(int, input().split()))\n\nlength = K//2\nfor i in range(N-1):\n length = max(A[i+1] - A[i] , length)\n if lenghth == A[i+1] - A[i]:\n ans = A[i] + K - A[i+1]\n \nif length == K//2:\n ans = A[-1] - A[0]\nprint(ans)', 'K, N = map(int, input().split())\nA = sorted(map(int, input().split()))\n\nlength = K//2\nfor i in range(N-1):\n length = max(A[i+1] - A[i], length)\n if lenghth == A[i+1] - A[i]:\n ans = A[i] + K - A[i+1]\n \nif length <= K//2:\n ans = A[-1] - A[0]\nprint(ans)', 'K, N = map(int, input().split())\nA = sorted(map(int, input().split()))\n\nlength = A[0] + K - A[-1]\nfor i in range(N-1):\n length = max(A[i+1] - A[i] , length)\n if length == A[i+1] - A[i]:\n ans = A[i] + K - A[i+1]\n \nif length == A[0] + K - A[-1]:\n ans = A[-1] - A[0]\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s577731582', 's954334276', 's438864516'] | [26444.0, 26444.0, 26444.0] | [70.0, 68.0, 215.0] | [272, 271, 295] |
p02725 | u687135117 | 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\nimport sys\nreadline = sys.stdin.buffer.readline\nK, N = map(int, readline().split())\nA = list(map(int,input().split()))\nN1= A[0]+K-A[N-1]\n\nfor i in range(1, N):\n N=max(N,A[i]-A[i-1])\n\nprint(N,N1)\nc = min(K-N1,K-N)\nprint(c)', 'import numpy as np\nimport sys\nreadline = sys.stdin.buffer.readline\nK, N = map(int, readline().split())\nA = list(map(int,input().split()))\nN1= A[0]+K-A[N-1]\n\nfor i in range(1, N):\n N1=max(N1,A[i]-A[i-1])\n\nprint(K-N1)'] | ['Wrong Answer', 'Accepted'] | ['s608319503', 's495319674'] | [34164.0, 34168.0] | [274.0, 271.0] | [240, 215] |
p02725 | u689890477 | 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(x) for x in input().split()]\nb = [0] *(n)\nfor i in range(n-1):\n b[i] =a[i+1]-a[i]\nb[n] = a[0] + k - a[n-1]\n\nprint(k - max(b))\n', 'k, n = map(int,input().split())\na = [int(x) for x in input().split()]\nb = [0] *(n)\nfor i in range(n-1):\n b[i] =a[i+1]-a[i]\nb[n-1] = a[0] + k - a[n-1]\n \nprint(k - max(b))'] | ['Runtime Error', 'Accepted'] | ['s290546020', 's124497495'] | [26444.0, 26436.0] | [118.0, 119.0] | [170, 172] |
p02725 | u692687119 | 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()))\nD = []\n\nfor i in range(0,N-1):\n d = A[i + 1] - A[i]\n D.append(abs(d))\n \nd2 = A[N-1] - K\nD.append(abs(d2))\n\nkankaku = max(D)\nsaitan = K - kankaku\n\nprint(saitan)', 'K, N = map(int, input().split())\n\nA = list(map(int, input().split()))\nD = []\n\nfor i in range(0,N-1):\n d = A[i + 1] - A[i]\n D.append(abs(d))\n \nd2 = A[N-1] - A[0]\nD.append(abs(d2))\n\nkankaku = max(D)\nsaitan = K - kankaku\n', 'K, N = map(int, input().split())\n\nA = list(map(int, input().split()))\nD = []\n\nfor i in range(0,N-1):\n d = A[i + 1] - A[i]\n D.append(abs(d))\n \nd2 = A[N-1] - (A[0] + K)\nD.append(abs(d2))\n\nkankaku = max(D)\nsaitan = K - kankaku\n\nprint(saitan)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s234527184', 's918716477', 's601780540'] | [26420.0, 26436.0, 26060.0] | [127.0, 130.0, 129.0] | [232, 221, 241] |
p02725 | u694665829 | 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()))]\ndel A[index(min(A))]\nfor a in A:\n a-=min(A)\nprint(max(A)-min(A))', 'K,N=map(int,input().split())\nA=[list(map(int,input().split()))]\nprint(max(A)-min(A))', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nB=sorted(A)\nC=[]\nfor i in range(N-1):\n C.append(B[i+1]-B[i])\nC.append(B[0]+K-B[N-1])\nprint(K-max(C))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s375726722', 's521579956', 's023521860'] | [26444.0, 26060.0, 26436.0] | [70.0, 65.0, 122.0] | [129, 84, 165] |
p02725 | u695261159 | 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\nmax_distance = k - a[-1] - a[0]\nstr_index = 0\ngl_index = -1\nfor i in range(n):\n if i == 0:\n continue\n elif max_distance < abs(a[i-1] - a[i]):\n max_distance = abs(a[i-1] - a[i])\n str_index = i-1\n gl_index = i\nprint(a[str_index] + (k - a[gl_index]))', 'k,n=map(int, input().split())\na=list(map(int, input().split()))\n\nif a[-1] <= k / 2:\n print(a[-1] - a[0])\n\nelse:\n max_distance = k - a[-1] - a[0]\n str_index = 0\n gl_index = -1\n for i in range(n):\n \tif i == 0:\n continue\n elif max_distance < abs(a[i-1] - a[i]):\n max_distance = abs(a[i-1] - a[i])\n str_index = i-1\n gl_index = i\n print(a[str_index] + (k - a[gl_index]))', 'k,n=map(int, input().split())\na=list(map(int, input().split()))\n\nmax_distance = k - a[-1] - a[0]\nstr_index = 0\ngl_index = -1\nfor i in range(n):\n \tif i == 0:\n continue\n elif max_distance < abs(a[i-1] - a[i]):\n max_distance = abs(a[i-1] - a[i])\n str_index = i-1\n gl_index = i\nprint(a[str_index] + (k - a[gl_index]))', 'k,n=map(int, input().split())\na=list(map(int, input().split()))\n\nmax_distance = abs(k - a[-1] + a[0])\nstr_index = 0\ngl_index = -1\nfor i in range(n):\n if i == 0:\n continue\n elif max_distance < abs(a[i-1] - a[i]):\n max_distance = abs(a[i-1] - a[i])\n str_index = i-1\n gl_index = i\nif gl_index == -1:\n print(a[gl_index] - a[str_index])\nelse:\n print(a[str_index] + (k - a[gl_index]))'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s165732521', 's553932228', 's642429409', 's241278031'] | [25840.0, 26444.0, 2940.0, 26444.0] | [124.0, 127.0, 17.0, 125.0] | [346, 440, 346, 418] |
p02725 | u695567036 | 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(float, input().split())\nm = list(map(float, input().split()))\nmin = float(0)\nhalf_k = k / 2\nfor i in range(n):\n first = m[i]\n last = m[i-1]\n len = last - first\n if len < 0:\n len = len + k\n if min < len:\n min = len\nprint(int(min))\n', 'k, n = map(float, input().split())\nm = list(map(float, input().split()))\nhalf_k = k / 2\nmin = float(1000000)\nfor i in range(int(n)):\n first = m[i]\n last = m[i-1]\n len = last - first\n if len < 0:\n len = len + k\n if min > len:\n min = len\nprint(int(min))\n'] | ['Runtime Error', 'Accepted'] | ['s902193442', 's874206476'] | [23916.0, 24780.0] | [67.0, 166.0] | [270, 281] |
p02725 | u698560572 | 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 = int(s[0])\nn = int(s[1])\n\nd = input().split(" ")\ndist = []\n\nfor i in range(0,n):\n dist.append(int(d[i]))\n\nex = dist[0] + k - dist[n-1]\nres = k - ex\n\nfor i in range(1, n):\n \tdiff = dist[i] - dist[i-1]\n aux = res + ex - diff\n \n if aux < res:\n res = aux\n \n\tex = diff\n\nprint(str(res))', 's = input().split(" ")\nk = int(s[0])\nn = int(s[1])\n\nd = input().split(" ")\ndist = []\n\nfor i in d:\n dist.append(int(i))\n\nres = dist[n-1] - dist[0]\n\nfor i in range(1, n):\n diff = dist[i] - dist[i-1]\n aux = k - diff\n if aux < res:\n res = aux\n\nprint(str(res))\n'] | ['Runtime Error', 'Accepted'] | ['s516069229', 's389990855'] | [3060.0, 26444.0] | [19.0, 151.0] | [332, 275] |
p02725 | u699296734 | 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()]\narray=[a[n-1]-a[0]]\narray.append(result)\nfor i in range(1,n):\n array.append(k+a[i-1]-a[i])\nprint(min(array))\n', 'k,n=map(int,input().split())\na=[int(i) for i in input().split()]\narray=[a[n-1]-a[0]]\narray.append(result)\nfor i in range(1,n):\n array.append(k+a[i-1]-a[i])\nprint(min(array))', 'k,n=map(int,input().split())\na=[int(i) for i in input().split()]\nlen_array=[]\nfor i in range(n):\n if i==n-1:\n length=a[0]-a[i]+k\n else:\n length=a[i+1]-a[i]\n len_array.append(length) \nprint(k-max(len_array))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s184515490', 's313711601', 's759979756'] | [26436.0, 26420.0, 26444.0] | [75.0, 74.0, 145.0] | [175, 176, 230] |
p02725 | u699696451 | 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()))\ngap = []\n\nfor i in range(N):\n if i < N - 1:\n sa = A[i+1] - A[i]\n else:\n sa = A[0] + (K - A[N-1])\n print(sa)\n gap.append(sa)\n i += 1\n \ndist = max(gap)\nans = K - dist\nprint(ans)\n', 'K, N = map(int,input().split())\nA = list(map(int,input().split()))\ngap = []\n\nfor i in range(N):\n if i + 1 < N - 1:\n sa = A[i+1] - A[i]\n else:\n sa = A[0] + (K - A[N-1])\n print(sa)\n gap.append(sa)\n i += 1\n \ndist = max(gap)\nans = K - dist\nprint(ans)\n', 'K, N = map(int,input().split())\nA = list(map(int,input().split()))\ngap = []\n\nfor i in range(N):\n if i < N - 1:\n sa = A[i+1] - A[i]\n else:\n sa = A[0] + (K - A[N-1])\n gap.append(sa)\n i += 1\n \ndist = max(gap)\nans = K - dist\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s155811831', 's766183647', 's645175673'] | [26444.0, 25840.0, 25452.0] | [303.0, 301.0, 160.0] | [275, 279, 261] |
p02725 | u699912843 | 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\nfor i, d in enumerate(a):\n if i != 0:\n a[i] = d - a[i - 1]\n else:\n a[i] = d + 20 - a[n - 1]\n\na.sort(reverse=True)\nprint(k - a[0])', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\na2 = []\nfor i, d in enumerate(a):\n if i != 0:\n a2.append(d - a[i - 1])\n else:\n a2.append(d + k - a[n - 1])\nprint(a, a2)\na2.sort(reverse=True)\nprint(a, a2)\nprint(k - a2[0])', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\na2 = []\nfor i, d in enumerate(a):\n if i != 0:\n a2.append(d - a[i - 1])\n else:\n a2.append(d + k - a[n - 1])\n# print(a, a2)\na2.sort(reverse=True)\n# print(a, a2)\nprint(k - a2[0])'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s680812280', 's717098333', 's198210318'] | [26444.0, 26444.0, 25840.0] | [147.0, 206.0, 146.0] | [219, 260, 264] |
p02725 | u699944218 | 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()))\nA = list(map(int,input().split()))\nd = [A[i+1]-A[i] for i in range(N-1)]\nde = K - A[N-1] + A[0]\ndis = 0\nfor i in range(N-2):\n dis += d[i]\nif d[N-2] <= de:\n dis += d[N-2]\nelse:\n dis += de\nprint(dis)', 'K, N = list(map(int,input().split()))\nA = list(map(int,input().split()))\nd = [A[i+1]-A[i] for i in range(N-1)]\nde = K - A[N-1] + A[0]\nd.append(de)\nD = sorted(d)\ndis = 0\nfor i in range(N-1):\n dis += D[i]\nprint(dis)'] | ['Runtime Error', 'Accepted'] | ['s055282581', 's448615969'] | [25840.0, 26444.0] | [93.0, 153.0] | [238, 214] |
p02725 | u701638736 | 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 = input().split()\n\na_list = list(A)\n\ndist = 0\nmax = 0\nsum = 0\n\nfor i in range(len(a_list)):\n if i == len(int(a_list)) - 1:\n dist = abs(int(a_list[i]) - int(a_list[0]))\n else:\n dist = abs(int(a_list[i]) - int(a_list[i + 1]))\n \n if max < dist:\n sum += max\n max = dist\n else:\n sum += dist\n \nprint(sum)\n ', 'K,N = input().split()\nA = input().split()\n \na_list = list(A)\n\ndist = 0\ndist_list = []\nmax = 0\nsum = 0\n \nfor i in range(len(a_list)):\n if i == len(a_list) - 1:\n dist = int(K) - abs(int(a_list[i]) - int(a_list[0]))\n else:\n dist = abs(int(a_list[i]) - int(a_list[i + 1]))\n if i != 0: \n if max < dist:\n sum += max\n max = dist\n else:\n sum += dist\n else:\n max = dist\n print(sum,dist)\n \nprint(sum)', 'K,N = input().split()\nA = input().split()\n \na_list = list(A)\n\ndist = 0\ndist_list = []\nmax = 0\nsum = 0\n \nfor i in range(len(a_list)):\n if i == len(a_list) - 1:\n dist = int(K) - abs(int(a_list[i]) - int(a_list[0]))\n else:\n dist = abs(int(a_list[i]) - int(a_list[i + 1]))\n if i != 0: \n if max < dist:\n sum += max\n max = dist\n else:\n sum += dist\n else:\n max = dist\n \n \nprint(sum)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s477262597', 's611708102', 's145051192'] | [19680.0, 21940.0, 20044.0] | [39.0, 497.0, 247.0] | [348, 436, 421] |
p02725 | u702018889 | 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)\nal=[a[i+1]-a[i] for i in range(n)]\nprint(k-max(al))', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\na.append(a[0]+k)\nal=[a[i+1]-a[i] for i in range(n)]\nprint(k-max(al))'] | ['Runtime Error', 'Accepted'] | ['s161217631', 's489526320'] | [2940.0, 26060.0] | [17.0, 97.0] | [129, 130] |
p02725 | u703461446 | 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 calc(K, N, A):\n A.sort()\n B = [A[i + 1] - A[i] for i in range(N - 1)]\n return K - max(B)\n\n\n(K, N) = tuple([int(s) for s in input().split()])\nA = [int(s) for s in input().split()]\nprint(calc(K, N, A))', 'def calc(K, N, A):\n B = [A[i + 1] - A[i] for i in range(N - 1)] + [A[0] + K - A[N - 1]]\n print(B)\n return K - max(B)\n\n\n(K, N) = tuple([int(s) for s in input().split()])\nA = [int(s) for s in input().split()]\nprint(calc(K, N, A))', 'def calc(K, N, A):\n B = [A[i + 1] - A[i] for i in range(N - 1)] + [A[0] + K - A[N - 1]]\n return K - max(B)\n\n\n(K, N) = tuple([int(s) for s in input().split()])\nA = [int(s) for s in input().split()]\nprint(calc(K, N, A))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s245627248', 's377357022', 's129624165'] | [26436.0, 26000.0, 26436.0] | [100.0, 114.0, 98.0] | [212, 236, 223] |
p02725 | u707030679 | 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=[]\nt=0\nfor a in A:\n B.append(a-t)\n t=a\nB[0] +=k-t\n\nprint(B, k-max(B) )', 'k,n = map(int,input().split())\nA = list(map(int,input().split()))\n\nB=[]\nt=0\nfor a in A:\n B.append(a-t)\n t=a\nB[0] +=k-t\n\nprint(k-max(B) )'] | ['Wrong Answer', 'Accepted'] | ['s127212729', 's018920720'] | [32240.0, 32368.0] | [110.0, 98.0] | [145, 142] |
p02725 | u707498674 | 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()))\ndiff_list = []\nsum_val = 0\n\ndiff_list.append(K-A[-1] + A[0])\nfor i in range(1, N):\n diff_list.append(A[i]-sum_val)\n sum_val += A[i]\n\nprint(sum(diff_list)-max(diff_list))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\ndiff_list = []\n\ndiff_list.append(K-A[-1] + A[0])\n\nfor i in range(1, N):\n diff_list.append(A[i]-A[i-1])\n\n\nprint(sum(diff_list)-max(diff_list))'] | ['Wrong Answer', 'Accepted'] | ['s899232895', 's796505789'] | [26444.0, 26436.0] | [146.0, 118.0] | [244, 213] |
p02725 | u708890186 | 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(_) for _ in input().split()]\na=0\nfor i in range(N-1):\n tmp=A[i+1]-A[i]\n if a<tmp:\n a=tmp\n\nprint(min(K-a,A[0]))\n', 'K,N=map(int,input().split())\nA=[int(_) for _ input().split()]\na=0\nfor i in range(N-1):\n tmp=A[i+1]-A[i]\n if a<tmp:\n a=tmp\nprint(K-a)', 'K,N=map(int,input().split())\nA=[int(_) for _ in input().split()]\na=A[0]\nfor i in range(N-1):\n tmp=A[i+1]-A[i]\n if a<tmp:\n a=tmp\n\nprint(K-a)\n', 'K,N=map(int,input().split())\nA=[int(_) for _ in input().split()]\na=0\nfor i in range(N-1):\n tmp=A[i+1]-A[i]\n if a<tmp:\n a=tmp\nprint(K-a)\n', 'K,N=map(int,input().split())\nA=[int(_) for _ in input().split()]\na=K-A[N-1]+A[0]\nfor i in range(N-1):\n tmp=A[i+1]-A[i]\n if a<tmp:\n a=tmp\n\nprint(K-a)\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s310490899', 's366322634', 's575244154', 's713431350', 's500696495'] | [24948.0, 2940.0, 26436.0, 26436.0, 26444.0] | [116.0, 18.0, 116.0, 116.0, 118.0] | [152, 137, 145, 141, 154] |
p02725 | u709040648 | 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 a=list(map(int,input().split()))\n max_d=0\n for i in range(n):\n x=0\n if i==n-1:\n if a[0]==0:\n x=k-a[i]\n else:\n x=k-a[i]+a[0]\n else:\n x=a[i+1]-a[i]\n if x>max_d:\n max_d=x\n print(k-max_d)', 't=int(input())\nwhile(t):\n t-=1\n k,n=map(int,input().split())\n a=list(map(int,input().split()))\n max_d=0\n for i in range(n):\n x=0\n if i==n-1:\n if a[0]==0:\n x=k-a[i]\n else:\n x=k-a[i]+a[0]\n else:\n x=a[i+1]-a[i]\n if x>max_d:\n max_d=x\n print(k-max_d)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\nmax_d=0\nfor i in range(n):\n x=0\n if i==n-1:\n if a[0]==0:\n x=k-a[i]\n else:\n x=k-a[i]+a[0]\n else:\n x=a[i+1]-a[i]\n if x>max_d:\n max_d=x\nprint(k-max_d)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s583792842', 's584097600', 's798028877'] | [2940.0, 3064.0, 26444.0] | [17.0, 18.0, 130.0] | [323, 361, 271] |
p02725 | u709799578 | 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(x) for x in input().split()]\na.append(K)\ndist = [0]*(N+1)\n\ndist[0] = a[N-1] - K - a[0]\nfor i in range(len(a)-1):\n dist[i+1] = a[i+1] - a[i]\n\ndist.pop()\ndist.remove(max(dist))\nans = abs(min(dist)) + abs(max(dist))\nprint(ans)', 'K, N = map(int, input().split())\na = [int(x) for x in input().split()]\n\ndist = [0] * (N + 1)\n\nfor i in range(N-1):\n dist[i] = a[i+1] - a[i]\n\ndist[N] = K - a[N - 1] + a[0]\n\nprint(K - max(dist))'] | ['Wrong Answer', 'Accepted'] | ['s081238907', 's421221633'] | [24948.0, 26444.0] | [134.0, 118.0] | [268, 195] |
p02725 | u711238850 | 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 = tuple([int(t)for t in input().split()])\n a = [int(t)for t in input().split()]\n\n l = 0\n dist = []\n for a_i in a[1:]:\n dist.append(a_i-l)\n l = a_i\n dist.append(k-a[-1]+a[0])\n print(dist)\n print(k-max(dist))\n\nif __name__ == "__main__":\n main()', 'def main():\n k,n = tuple([int(t)for t in input().split()])\n a = [int(t)for t in input().split()]\n\n l = a[0]\n dist = []\n for a_i in a[1:]:\n dist.append(a_i-l)\n l = a_i\n dist.append(k-a[-1]+a[0])\n\n print(k-max(dist))\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s685157744', 's400919594'] | [26420.0, 26444.0] | [107.0, 91.0] | [300, 288] |
p02725 | u713914478 | 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 = [0 for i in range(N)]\nprint(A)\nprint(B)\n\n\nfor i in range(N-1):\n\tB[i] = A[i+1] - A[i]\n\nB[N-1] = K - (A[N-1] - A[0])\nB_max = max(B)\nprint(B)\nprint(K - B_max)\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = [0 for i in range(N)]\n\nfor i in range(N-1):\n\tB[i] = A[i+1] - A[i]\n\nB[N-1] = K - (A[N-1] - A[0])\nB_max = max(B)\nprint(K - B_max)\n'] | ['Wrong Answer', 'Accepted'] | ['s543365849', 's129073236'] | [26444.0, 26420.0] | [164.0, 123.0] | [229, 201] |
p02725 | u714931250 | 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(x.strip()) for x in input().split()]\nfor i in range(n):\n if i != 0 and i != n-1:\n dist_r = a[i-1] + (k - a[i])\n dist_l = a[i] + (k - a[i+1])\n min_dist = min(dist_r,dist_l)\n elif i == 0:\n dist_r = a[n-1] + (k - a[i])\n dist_l = a[i] + (k - a[i+1])\n min_dist0 = min(dist_r,dist_l)\n else:\n dist_r = a[i-1] + (k - a[i])\n dist_l = a[i] + (k - a[0])\n min_distn = min(dist_r,dist_l)\nans = min(min_dist,min_dist0,min_distn)\nprint(ans)', 'k,n = map(int, input().split())\na = [int(x.strip()) for x in input().split()]\nmin_dist = k\nfor i in range(n):\n if i != 0 and i != n-1:\n dist_r = a[i-1] + (k - a[i])\n dist_l = a[i] + (k - a[i+1])\n if min_dist > min(dist_r,dist_l):\n min_dist = min(dist_r,dist_l)\n elif i == 0:\n dist_r = a[n-1] - a[i]\n dist_l = a[i] + (k - a[i+1])\n min_dist0 = min(dist_r,dist_l)\n else:\n dist_r = a[i-1] + (k - a[i])\n dist_l = a[i] - a[0]\n min_distn = min(dist_r,dist_l)\nans = min(min_dist,min_dist0,min_distn)\nprint(ans) '] | ['Wrong Answer', 'Accepted'] | ['s680236713', 's871138940'] | [33668.0, 33584.0] | [195.0, 197.0] | [496, 538] |
p02725 | u720636500 | 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-a[-1])\nl = max(a)\nprint(k-l)', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\na.append(a[0]+k)\nl = 0\nfor i in range(n):\n l = max(l,a[i+1]-a[i])\nprint(k-l)'] | ['Wrong Answer', 'Accepted'] | ['s629826762', 's844737067'] | [26420.0, 26444.0] | [68.0, 161.0] | [113, 146] |
p02725 | u723345499 | 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\nm = 0\nfor i in range(n-1):\n d = a[i+1] - a[i]\n m = max(m, d)\nd_last = k - a[n-1]\nm = max(m, d_last)\n\nres = k - m\nprint(res)', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nm = 0\nfor i in range(n-1):\n d = a[i+1] - a[i]\n m = max(m, d)\nd_last = k - a[n-1] + a[0]\nm = max(m, d_last)\n\nres = k - m\nprint(res)'] | ['Wrong Answer', 'Accepted'] | ['s905250152', 's592808814'] | [26436.0, 26100.0] | [148.0, 165.0] | [199, 206] |
p02725 | u726218285 | 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(x) for x in input().split()]\nA = list(filter(lambda x: x != 0, (int(x) for x in input().split())))\nprint(sum(A) / len(A))\n', 'K, N = [int(x) for x in input().split()]\nA = [int(x) for x in input().split()]\n\nm = A[min(((i, abs(max(A) / 2 - n)) for i, n in enumerate(A)), key=lambda x: x[1])[0]]\nprint(m)\nprint(max((max(A) - m), (m - min(A))))\n', 'import sys\nimport random\n\ndef test(K, N, A):\n ans = []\n maxp = N-1\n minp = 0\n for i in range(len(A)):\n ans.append(A[maxp] - A[minp])\n A[i] += K\n maxp = (maxp + 1) % (N)\n minp = (minp + 1) % (N)\n print(min(ans))\n\nif __name__ == "__main__":\n if "random" in sys.argv:\n K = int(random.random() * 20000)\n N = int(random.random() * 65536)\n A = sorted([int(random.random() * K) for _ in range(N)])\n else:\n K, N = [int(x) for x in input().split()]\n A = [int(x) for x in input().split()]\n test(K,N,A)\n pass\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s001170244', 's533558186', 's461898534'] | [26420.0, 26420.0, 26828.0] | [104.0, 2104.0, 156.0] | [134, 215, 588] |
p02725 | u731368968 | 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()))\n\na = [A[i + 1] - A[i] for i in range(N - 1)]\na.append(K + A[0] - A[-1])\n\na.sort()\nprint(a)\nprint(sum(a[:-1]))\n', 'K, N = map(int, input().split())\n\nA = list(map(int, input().split()))\n\na = [A[i + 1] - A[i] for i in range(N - 1)]\na.append(K + A[0] - A[-1])\n\na.sort()\nprint(sum(a[:-1]))\n'] | ['Wrong Answer', 'Accepted'] | ['s921799845', 's498669913'] | [25832.0, 26444.0] | [139.0, 122.0] | [180, 171] |
p02725 | u736641785 | 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\nMIN_LIST = A[0]+(K - A[N-1])\nfor i in range(N-1):\n MIN_LIST = max(MIN_LIST,(A[i+1]-A[i]))\n print(A[i+1]-A[i])\n\nprint(K - MIN_LIST)', 'K, N = map(int,input().split())\nA = list(map(int,input().split()))\n \nMIN_LIST = A[0]+(K - A[N-1])\nfor i in range(N-1):\n MIN_LIST = max(MIN_LIST,(A[i+1]-A[i]))\n \nprint(K - MIN_LIST)'] | ['Wrong Answer', 'Accepted'] | ['s686078685', 's467752836'] | [26436.0, 26060.0] | [305.0, 149.0] | [204, 189] |
p02725 | u738898077 | 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]*n\nfor i in range(n-1):\n ans[i] = a[i+1] - a[i]\nans[-1] = (k-a[-1])\nprint(k - max(ans) )', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\ndist = []\nkankaku_max = 0\nfor i in range(n-1):\n dist.append(a[i+1]-a[i]) \na.append(a[0]+(k-a[-1]))\nfor i in dist:\n kankaku_max = max(kankaku_max,i)\nprint(k-kankaku_max)', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\ndist = []\nkankaku_max = 0\nfor i in range(n-1):\n dist.append(a[i+1]-a[i]) \ndist.append(a[0]+(k-a[-1]))\nfor i in dist:\n kankaku_max = max(kankaku_max,i)\nprint(k-kankaku_max)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s351879883', 's527963070', 's009021229'] | [26060.0, 26444.0, 26444.0] | [115.0, 156.0, 159.0] | [166, 236, 239] |
p02725 | u745687363 | 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()))\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))', '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))\n'] | ['Runtime Error', 'Accepted'] | ['s176123803', 's090357039'] | [5824.0, 26444.0] | [26.0, 117.0] | [171, 157] |
p02725 | u746206084 | 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=map(int,input().split())\nli=list(map(int,input().split()))\nM=0\nfor i in range(n-1):\n if li[i+1]-li[i]>M:\n M=li[i+1]-li[i]\nif m-li[-1]>M:\n M=m-li[-1]\nprint(M)', 'm,n=map(int,input().split())\nli=list(map(int,input().split()))\nM=0\nfor i in range(n-1):\n if li[i+1]-li[i]>M:\n M=li[i+1]-li[i]\nif m-li[-1]>M:\n M=m-li[-1]\nprint(m-M)', 'm,n=map(int,input().split())\nli=list(map(int,input().split()))\nM=0\nli.append(li[0]+m)\nfor i in range(n):\n if abs(li[i+1]-li[i])>M:\n M=abs(li[i+1]-li[i])\nprint(m-M)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s189609397', 's641648845', 's562477616'] | [26420.0, 26444.0, 26420.0] | [102.0, 101.0, 115.0] | [174, 176, 173] |
p02725 | u747391638 | 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(" "))\nalist = list(map(int, input().split(" ")))\nglist = []\nfor i in range(n-1):\n glist.append(alist[i+1]-alist[i])\nglist.append(k+a[0]-a[n-1])\n\nprint(k-max(glist))\n', 'k ,n = map(int, input().split(" "))\nalist = list(map(int, input().split(" "))\nglist = []\nfor i in range(n-1):\n glist.append(alist[i+1]-alist[i])\nglist.append(k+alist[0]-alist[n-1])\n\nprint(int(k-max(glist)))\n \n ', 'k,n = map(int,input().split(" "))\nalist = list(map(int, input().split(" ")))\nglist = []\nfor i in range(n-1):\n glist.append(alist[i+1]-alist[i])\nglist.append(k+alist[0]-alist[n-1])\n\nprint(k-max(glist))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s097389674', 's318995783', 's655367911'] | [25836.0, 3064.0, 26420.0] | [113.0, 17.0, 114.0] | [194, 220, 201] |
p02725 | u747602774 | 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 = a[0] + k - a[-1]\nfor i in range(n-1):\n ans = max(ans, a[i+1]-a[i])\nprint(k-ans)', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nans = a[0] + k - a[-1]\nfor i in range(n-1):\n ans = max(ans, a[i+1]-a[i])\nprint(k-ans)'] | ['Runtime Error', 'Accepted'] | ['s898529239', 's611031676'] | [26436.0, 26420.0] | [160.0, 150.0] | [152, 152] |
p02725 | u748311048 | 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()))\nK=[]\nfor i in range(N):\n if i==N-1:\n K.append((K-A[i])+A[1])\n else:\n K.append(A[i+1]-A[i])\n\nprint(N-max(K))', 'K,N=map(int, input().split())\nA=list(map(int, input().split()))\nC=[]\nfor i in range(N):\n if i==N-1:\n C.append((K-A[i])+A[0])\n else:\n C.append(A[i+1]-A[i])\n\nprint(K-max(C))'] | ['Runtime Error', 'Accepted'] | ['s680927551', 's407077667'] | [26444.0, 26060.0] | [130.0, 135.0] | [179, 179] |
p02725 | u755545520 | 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\nx=0\nfor i in range(n-1):\n p=a[i+1]-a[i]\n if p >= x:\n x=p\n\nX=max(x,k-a[n-1]-a[0])\nprint(k-X)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\n\nx=0\nfor i in range(n-1):\n p=a[i+1]-a[i]\n if p >= x:\n x=p\n \nprint(k-x)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\n\nx=0\nfor i in range(n-1):\n p=a[i+1]-a[i]\n if p >= x:\n x=p\n\nX=max(x,k-a[n-1]-a[0])\nprint(k-X)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\n\nx=0\nfor i in range(n-1):\n p=a[i+1]-a[i]\n if p >= x:\n x=p\n\nX=max(x,k-a[n-1]+a[0])\nprint(k-X)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s243665492', 's612899048', 's875990689', 's606980851'] | [26420.0, 26420.0, 26444.0, 25832.0] | [110.0, 116.0, 109.0, 120.0] | [155, 134, 155, 155] |
p02725 | u759412327 | 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()))+[K]\nD = [abs(A[n+1]-A[n]) for n in range(N)]\nprint(K-max(D))', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\nB = [A[n+1]-A[n] for n in range(N-1)]\nprint(K-max(B))', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\nA+= [A[0]+K]\nD = [abs(A[n+1]-A[n]) for n in range(N)]\nprint(K-max(D))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s353502137', 's495442575', 's754668016'] | [32244.0, 26444.0, 32368.0] | [105.0, 99.0, 103.0] | [126, 119, 135] |
p02725 | u762523240 | 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()))\nAp = []\nl = 0\n\nfor n in A:\n if n != 0 and n > K/2:\n Ap.append(n-K)\n else:\n Ap.append(n)\n\n\nfor i in range(N-1):\n l += abs(A[i]-A[i+1])\n\n\nAp.sort()\nlp = 0\nfor j in range(N-1):\n lp += abs(Ap[i]-Ap[i+1])\n\n\nif l >= lp:\n result = lp\nelif l < lp:\n result = l \n\nprint(Ap)\nprint(result) ', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nlength = []\n\nfor i in range(N-1):\n length.append(abs(A[i]-A[i+1]))\n\n\nlength.append(K-sum(length))\n\nmax_l = length[0]\nfor j in range(N):\n if max_l <= length[j]:\n max_l = length[j]\n else:\n pass\n\n\nlength.remove(max_l)\nresult = sum(length)\nprint(result)'] | ['Wrong Answer', 'Accepted'] | ['s301499432', 's920802000'] | [33624.0, 32388.0] | [211.0, 137.0] | [359, 327] |
p02725 | u763249708 | 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\nr_ans = 10**9\nif a[0] + a[n-1] >= k:\n r_ans = a[n-1] - a[0]\n # print(a[n-1] - a[0])\n\n\nelse:\n max_n = 0\n for i in range(n-1):\n diff = abs(a[i] - a[i+1])\n max_n = max(diff, max_n)\n # print(k - max_n)\n l_ans = k - max_n\n\nprint(min(r_ans, l_ans))', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\n\nif a[0] + a[n-1] <= k - a[0] - a[n-1]:\n print(a[n-1] - a[0])\n\n\nelse:\n max_n = 0\n for i in range(n-1):\n diff = abs(a[i] - a[i+1])\n max_n = max(diff, max_n)\n print(k - max_n)', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nbef = a[0]\nmax_diff = 0\nfor i in range(1,n):\n diff = abs(bef - a[i])\n max_diff = max(diff, max_diff)\n bef = a[i]\n\nprint(k - max(max_diff, k - abs(a[n-1] - a[0])))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s262741500', 's626856891', 's734561484'] | [26444.0, 25840.0, 32368.0] | [164.0, 167.0, 146.0] | [376, 300, 241] |
p02725 | u763291354 | 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()))\nA = list(map(int, input().split()))\n\nanswer = []\n\nfor i,home in enumerate(A):\n kouho = home - A[i - 1]\n if kouho < 0:\n answer.append(20 + kouho)\n else:\n aanswer.append(kouho)\n\nprint(20 - max(answer))\n', 'KN = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nanswer = []\n\nfor i,home in enumerate(A):\n if home < A[i - 1]:\n answer.append(home - A[i - 1] + KN[0])\n else:\n answer.append(home - A[i - 1])\n\nprint(KN[0] - max(answer))\n'] | ['Runtime Error', 'Accepted'] | ['s237819798', 's522347296'] | [26444.0, 26444.0] | [65.0, 142.0] | [260, 263] |
p02725 | u763383823 | 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()))\nnew = []\nfor i in range(N-1):\n new.append(A[i+1]-A[i])\nnew.append(K + A[0] - A[-1])', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nnew = []\nfor i in range(N-1):\n new.append(A[i+1]-A[i])\nnew.append(K + A[0] - A[-1])\nnew.sort()\nprint(sum(new[:y-1]))', 'import numpy as np\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nnew = []\nfor i in range(N-1):\n new.append(A[i+1]-A[i])\nnew.append(K + A[0] - A[-1])\nnew.sort()\nprint(sum(new[:y-1]))', 'import numpy as np\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nnew = []\nfor i in range(N-1):\n new.append(A[i+1]-A[i])\nnew.append(K + A[0] - A[-1])\nnew.sort()\nprint(sum(new[:y-1]', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nnew = []\nfor i in range(N-1):\n new.append(A[i+1]-A[i])\nnew.append(K + A[0] - A[-1])\nnew.sort()\nprint(sum(new[:-1]))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s009576998', 's249429121', 's260810018', 's381370847', 's927220391'] | [34152.0, 26444.0, 35856.0, 2940.0, 26436.0] | [244.0, 142.0, 269.0, 17.0, 144.0] | [174, 188, 207, 205, 187] |
p02725 | u765401716 | 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()))\nA.sort()\nP=[A[0]]\nfor i in range(len(A)-1):\n a = abs(A[i+1] -A[i])\n P.append(a)\nP.append(abs(K - A[-1] + A[0]))\nP.sort()\ndel P[-1]\nans = sum(P)\nprint(ans)\n', 'K,N = list(map(int, input().split()))\nA = list(map(int, input().split()))\nA.sort()\nD = K - A[-1] \nif D > A[0]:\n print(K-D)\nelse:\n print(K-A[0])', 'K,N = list(map(int, input().split()))\nA = list(map(int, input().split()))\nA.sort()\nP=[A[0]]\nfor i in range(len(A)-1):\n a = abs(A[i+1] -A[i])\n P.append(a)\nP.append(K - A[-1] + A[0])\nP.sort()\ndel P[-1]\nans = sum(P)\nprint(ans)\n', 'K,N = list(map(int, input().split()))\nA = list(map(int, input().split()))\nA.sort()\nP=[A[0]]\nfor i in range(len(A)-1):\n a = abs(A[i+1] -A[i])\n P.append(a)\nP.append(K - A[-1] + A[0])\nP.sort()\ndel P[-1]\nsum(P)\nprint(P)', 'K,N = list(map(int, input().split()))\nA = list(map(int, input().split()))\nA.sort()\nP=[]\nfor i in range(len(A)-1):\n a = abs(A[i+1] -A[i])\n P.append(a)\nP.append(abs(K - A[-1] + A[0]))\nP.sort()\ndel P[-1]\nans = sum(P)\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s520177924', 's631540037', 's792582282', 's854569373', 's296336012'] | [26420.0, 26444.0, 26444.0, 26420.0, 26420.0] | [153.0, 71.0, 161.0, 172.0, 155.0] | [235, 149, 230, 221, 230] |
p02725 | u766566560 | 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()))\nsum = 0\n\nif A[0] == 0:\n for i in range(2, N):\n sum += abs(A[i-i] - A[i])\n print(sum)\nelse:\n for i in range(1, N):\n sum += abs(A[i-1] - A[i])\n print(i, sum)\n print(sum)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nmax_dist = 0\n\nfor i in range(N - 1):\n if i == N - 1:\n dist = A[0] + K - A[i]\n else:\n dist = A[i+1] - A[i]\n \n if dist > max_dist:\n max_dist = dist\n \nprint(K - max_dist)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\ndiff = [abs(A[i-1] - A[i]) for i in range(1, N)]\ndiff.append(abs(A[0] - A[N-1] + K))\n\nprint(K - max(diff))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s075063361', 's845033134', 's490786341'] | [26420.0, 26420.0, 25452.0] | [385.0, 128.0, 106.0] | [249, 252, 175] |
p02725 | u766646838 | 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()) \nc=list(map(int, input().split())) \na = 0\nb = 0\nfor i in range(N):\n print(a)\n if i == 0:\n a = min((c[N-1]-c[0]),K-(c[i+1]-c[0]))\n elif i == N-1:\n a = min(a,K-(c[i-1]-c[i]))\n a = min(a,K-(c[0]-c[i]))\n \n else:\n a = min(a,K-(c[i-1]-c[i]))\n a = min(a,K-(c[i+1]-c[i]))\n \nprint(a)', 'K,N=map(int, input().split()) \nc=list(map(int, input().split())) \na = 0\nb = 0\nfor i in range(N):\n if i == 0:\n a = min((c[N-1]-c[0]),K-(c[i+1]-c[0]))\n elif i == N-1:\n a = min(a,K-(c[i-1]-c[i]))\n a = min(a,K-(c[0]-c[i]))\n \n else:\n a = min(a,K-(c[i-1]-c[i]))\n a = min(a,K-(c[i+1]-c[i]))\n \nprint(a)\n '] | ['Wrong Answer', 'Accepted'] | ['s063705479', 's233266153'] | [26444.0, 26444.0] | [424.0, 277.0] | [329, 323] |
p02725 | u767752954 | 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 = input().split()\nK = int(K)\nN= int(N)\nA = [int(x) for x in input().split()]\n\ndis=[]\nnow = 0\n\nfor i in range(N):\n dis.append(A[i] - now)\n now = A[i]\n\ndis.append(K - A[N -1])\n\ndistance = K - max(dis)\n\nprint(distance)', 'K,N = input().split()\nK = int(K)\nN= int(N)\nA = [int(x) for x in input().split()]\n\ndis=[]\nnow = 0\n\nfor i in range(N):\n dis.append(A[i] - now)\n now = A[i]\n\ndis.append(K-A[N-1]+dis[0])\n\ndistance = K - max(dis)\n\nprint(distance)'] | ['Wrong Answer', 'Accepted'] | ['s268174886', 's755501225'] | [26420.0, 26420.0] | [126.0, 133.0] | [226, 229] |
p02725 | u767995501 | 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. | ['#!/usr/bin/env python3\n \nk, 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)', '#!/usr/bin/env python3\n \nK, 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)'] | ['Runtime Error', 'Accepted'] | ['s233753372', 's808266817'] | [26444.0, 25840.0] | [75.0, 84.0] | [175, 175] |
p02725 | u768256617 | 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.append(a[-1]+k)\nl=0\nfor i in range(n):\n l=max(l,a[i+1]-a[i])\n \ns=k-l\nprint(s)', '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])\n \ns=k-l\n\nprint(s)'] | ['Wrong Answer', 'Accepted'] | ['s899560778', 's077225971'] | [26436.0, 25832.0] | [151.0, 160.0] | [144, 145] |
p02725 | u769870836 | 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()))\nl=l+[l[0]]\nl=l[::-1]\nans=k\nfor i in range(n):\n ans=min(l[i+1]-l[i],k-(l[i+1]-l[i]))\nprint(ans)', 'k,n=map(int,input().split())\nimport numpy as np\nl=list(map(int,input().split()))\nl=np.array(l+[l[0]+k])\nprint(k-np.max(np.diff(l)))'] | ['Wrong Answer', 'Accepted'] | ['s937432201', 's715225118'] | [25836.0, 34144.0] | [189.0, 214.0] | [157, 131] |
p02725 | u771538568 | 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)\nd=[]\nfor i in range(len(a)-1):\n d.append([i,a[i+1]-a[i]])\nd[-1][1]+=a[0]\nl=sorted(d,key=lambda x:x[1])\n\no=l[-1][0]\nif o==len(a)-1:\n g=a[-2]-a[0]\nelse:\n g=a[o]+n-a[o+1]\nprint(g)', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\na.append(n)\nd=[]\nfor i in range(len(a)):\n d.append([i,a[i+1]-a[i]])\nl=sorted(d,key=lambda x:x[1])\n\no=l[-1][0]\ng=a[o]+n-a[o+1]\nprint(g)', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\na.append(n)\nd=[]\nfor i in range(len(a)-1):\n d.append([i,a[i+1]-a[i]])\nl=sorted(d,key=lambda x:x[1])\n\no=l[-1][0]\ng=a[o]+n-a[o+1]\nprint(g)', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\na.append(n)\nd=[]\nfor i in range(len(a)-1):\n d.append([i,a[i+1]-a[i]])\nl=sorted(d,key=lambda x:x[1])\nprint(l)\n\no=d[-1][0]\ng=a[o]+n-a[o+1]\n', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\na.append(n)\nd=[]\nfor i in range(len(a)-1):\n d.append([i,a[i+1]-a[i]])\nd[-1][1]+=a[0]\nl=sorted(d,key=lambda x:x[1])\n\no=l[-1][0]\nif o==len(a)-2:\n g=a[-2]-a[0]\nelse:\n g=a[o]+n-a[o+1]\nprint(g)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s537822078', 's706672818', 's791752114', 's884988022', 's675555999'] | [43188.0, 38732.0, 43152.0, 49096.0, 43188.0] | [249.0, 191.0, 254.0, 436.0, 248.0] | [266, 206, 208, 209, 266] |
p02725 | u773686010 | 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. | ['# Traveling Salesman around Lake https://atcoder.jp/contests/abc160/tasks/abc160_c\nN,K= map(int, input().split())\n\nTravel_List=list(map(int,input().split()))\nfor i in range(K):\n Travel_List.append(Travel_List[i]+N)\n\nAnswer =0 \nfor i in range(K):\n print(i)\n Temp = Travel_List[i+K-1]-Travel_List[i]\n if (i==0) or (Temp<Answer):\n Answer=Temp\n \n\n\n \nprint(Answer)', '# Traveling Salesman around Lake https://atcoder.jp/contests/abc160/tasks/abc160_c\nN,K= map(int, input().split())\n\nTravel_List=list(map(int,input().split()))\nfor i in range(K):\n Travel_List.append(Travel_List[i]+N)\n\nAnswer =0 \nfor i in range(K):\n Temp = Travel_List[i+K-1]-Travel_List[i]\n if (i==0) or (Temp<Answer):\n Answer=Temp\n \n\n\n \nprint(Answer)'] | ['Wrong Answer', 'Accepted'] | ['s469712002', 's788601968'] | [26420.0, 26000.0] | [322.0, 168.0] | [384, 371] |
p02725 | u776311944 | 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.insert(0, 0)\nA.append(K)\n\nprint(A)\n\nstart = A[1] - A[0]\ngoal = A[-1] - A[-2]\n\nmixi = 0\nsum_len = 0\n\nSorG = max(start, goal)\n\nfor i in range(len(A) - 1):\n if A[i+1] - A[i] > mixi:\n mixi = A[i+1] - A[i]\n sum_len += A[i+1] - A[i]\n\nif max(SorG, mixi) == SorG or SorG == mixi:\n result = sum_len - (start + goal)\nelif max(SorG, mixi) == mixi:\n result = sum_len - mixi\n\nprint(result)\n \n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.insert(0, 0)\nA.append(K)\n\n# print(A)\n\nstart = A[1] - A[0]\ngoal = A[-1] - A[-2]\n\nmixi = 0\nsum_len = 0\n\n# SorG = max(start, goal)\n\nSorG = start + goal\n\nfor i in range(len(A) - 1):\n if A[i+1] - A[i] > mixi:\n mixi = A[i+1] - A[i]\n sum_len += A[i+1] - A[i]\n\nif max(SorG, mixi) == SorG or SorG == mixi:\n result = sum_len - (start + goal)\nelif max(SorG, mixi) == mixi:\n result = sum_len - mixi\n\nprint(result)\n \n'] | ['Wrong Answer', 'Accepted'] | ['s797482784', 's007068968'] | [26444.0, 26444.0] | [164.0, 150.0] | [473, 498] |
p02725 | u779728630 | 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\nm = K - A[N-1] + A[0]\n\nfor i in range(N-1):\n m = min(m, A[i+1] - A[i])\n\nprint(K - m)\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nm = K - A[N-1] + A[0]\n\nfor i in range(N):\n m = min(m, A[i+1] - A[i])\n\nprint(K - m)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nm = K - A[N-1] + A[0]\n\nfor i in range(N-1):\n m = max(m, A[i+1] - A[i])\n\nprint(K - m)\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s673709387', 's889477697', 's331811617'] | [26444.0, 25840.0, 26436.0] | [164.0, 162.0, 150.0] | [156, 153, 156] |
p02725 | u780475861 | 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.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\nk, n, *lst = map(int, read().split())\nlst.sort()\ndis = 0\nfor i in range(n):\n if i == 0:\n dis = max(dis, k-lst[-1])\n else:\n dis = max(dis, lst[i] - lst[i - 1])\n\ndis = min(dis, k - dis)\nprint(dis)', 'import sys\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\nk, n, *lst = map(int, read().split())\nlst.sort()\ndis = k\nfor i in range(n):\n if i == 0:\n tmp=lst[-1] - lst[0]\n else:\n tmp=k - lst[i] + lst[i - 1]\n dis=min(dis, tmp)\nprint(dis)'] | ['Wrong Answer', 'Accepted'] | ['s833157976', 's578309074'] | [25124.0, 25124.0] | [152.0, 175.0] | [310, 294] |
p02725 | u785645123 | 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. | ['ddd = [input() for i in range(2)]\neee = ddd[0].split()\nfff = ddd[1].split()\nlongest_distance = 0\nfor i in range(len(fff) - 1):\n distance = int(fff[i+1]) - int(fff[i])\n if longest_distance < distance:\n longest_distance = distance\nshortest_road = int(eee[0]) - longest_distance\nprint(shortest_road)', 'ddd = [input() for i in range(2)]\neee = ddd[0].split()\nfff = ddd[1].split()\nlongest_distance = int(eee[0]) - int(fff[-1])\nfor i in range(len(fff) - 1):\n distance = int(fff[i+1]) - int(fff[i])\n if longest_distance < distance:\n longest_distance = distance\nshortest_road = int(eee[0]) - longest_distance\nprint(shortest_road)', 'ddd = [input() for i in range(2)]\neee = ddd[0].split()\nfff = ddd[1].split()\nlongest_distance = 0\n\nfor i in range(len(fff - 1)):\n distance = fff[i+1] - fff[i]\n if longest_distance < distance:\n longest_distance = distance\n\nshortest_road = eee[0] - longest_distance\n\nprint(shortest_road)\n', 'ddd = [input() for i in range(2)]\neee = ddd[0].split()\nfff = ddd[1].split()\nlongest_distance = int(eee[0]) + int(fff[0]) - int(fff[-1])\nfor i in range(len(fff) - 1):\n distance = int(fff[i+1]) - int(fff[i])\n if longest_distance < distance:\n longest_distance = distance\nshortest_road = int(eee[0]) - longest_distance\nprint(shortest_road)\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s042368514', 's073261047', 's709111949', 's808647852'] | [19112.0, 18508.0, 17948.0, 18508.0] | [176.0, 165.0, 34.0, 163.0] | [309, 334, 298, 349] |
p02725 | u785728112 | 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())\u3000\nA = list(map(int, input().split()))\nli = []\nfor i in range(N - 1):\n li.append(A[i + 1] - A[i]) \n\nli.append(abs(A[0] + (K - A[-1]))) \nprint(sum(li) - max(li))', 'K, N = map(int,input().split())\nA = list(map(int, input().split()))\nli = []\nfor i in range(N - 1):\n li.append(A[i + 1] - A[i]) \nli.append(abs(A[0] + (K - A[-1]))) \nprint(sum(li) - max(li))'] | ['Runtime Error', 'Accepted'] | ['s203594615', 's902822139'] | [9016.0, 32324.0] | [26.0, 109.0] | [193, 189] |
p02725 | u787131053 | 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 around(K,A):\n N2 = A.pop(0)\n A.append(N2+K)\n return A\n\nK,N = map(int, input().split(" "))\nA = list(map(int, input().split(" ")))\n\nX = 0\nX_min = 1000000000\nfor j in range(0,len(A)):\n X=0\n X = A[len(A)-1] - A[0]\n X_min = X\n A=around(K,A)\n \nprint(X_min)', 'def around(K,A):\n N2 = A.pop(0)\n A.append(N2+K)\n return A\n\nK,N = map(int, input().split(" "))\nA = list(map(int, input().split(" ")))\n\nX = 0\nX_min = 1000000000\nfor j in range(0,len(A)):\n X=\n X = A[len(A)-1] - A[0]\n if X_min > X:\n X_min = X\n A=around(K,A)\n \nprint(X_min)', 'K,N = map(int, input().split(" "))\nA = list(map(int, input().split(" ")))\n\nX = 0\nspace = 0\nidx = 0\nA.append(A[0]+K)\nfor j in range(0,len(A)-1):\n X=0\n X = A[j+1] - A[j]\n if space < X:\n space = X\n idx = j\n \nprint(A[idx] + K - A[idx+1] )'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s613565523', 's898595002', 's027544355'] | [26420.0, 2940.0, 25836.0] | [2104.0, 17.0, 116.0] | [278, 299, 260] |
p02725 | u792455295 | 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())\n\nA = []\n\nfor i in range(N):\n A.append(int(input()))\n \nmax = A[0]\nmemo = 0\n\nfor i in range(N-1):\n if max < A[i+1]-A[i]:\n max = A[i+1]-A[i]\n\nif max < K-A[N-1]+A[0]:\n max = K-A[N-1]+A[0]\n \nprint(K-max)\n \n', 'K = int(input())\nN = int(input())\n\nA = list(range(N))\n\nfor i in range(N):\n A[i]=int(input())\n \nmax = 0\n\nfor i in range(N-1):\n if max < A[i+1]-A[i]:\n max = A[i+1]-A[i]\n\nif max < K-A[N-1]+A[0]:\n max = K-A[N-1]+A[0]\n \nprint(K-max)', 'K = int(input())\nN = int(input())\n\nA = [0]\n\nfor i in range(N):\n A[i]=int(input())\n\nfor i in range(N-1):\n if max < A[i+1]-A[i]:\n max = A[i+1]-A[i]\n\nif max < K-A[N-1]+A[0]:\n max = K-A[N-1]+A[0]\n \nprint(K-max)\n \n', 'K = int(input())\nN = int(input())\n\nA = list(range(N))\n\nfor i in range(N):\n A[i]=int(input())\n \nmax = A[0]\n\nfor i in range(N-1):\n if max < A[i+1]-A[i]:\n max = A[i+1]-A[i]\n\nif max < K-A[N-1]+A[0]:\n max = K-A[N-1]+A[0]\n \nprint(K-max)\n \n', 'K = int(input())\nN = int(input())\n\nA = list(range(N))\n\nfor i in range(N):\n A[i]=int(input())\n \nmax = A[0]\n\nfor i in range(N-1):\n if max < A[i+1]-A[i]:\n max = A[i+1]-A[i]\n\nif max < K-A[N-1]+A[0]:\n max = K-A[N-1]+A[0]\n \nprint(K-max)\n \n', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\n \nmax = K-A[-1]+A[0]\n \nfor i in range(N-1):\n if max < A[i+1]-A[i]:\n max = A[i+1]-A[i]\n \nprint(K-max)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s013308983', 's044341885', 's074904822', 's125365493', 's456347190', 's174667061'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 26060.0] | [18.0, 17.0, 18.0, 18.0, 17.0, 105.0] | [260, 249, 231, 258, 258, 182] |
p02725 | u793010149 | 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()))\nli = []\n\nfor i in range(n):\n li.append(l[n-1]-l[n-2])\n\nli.sort(reverse=True)\nprint(k-li[0])', 'k,n = map(int,input().split())\nl= list(map(int,input().split()))\nli = []\n\nfor i in range(n-1):\n li.append(l[n-i-1]-l[n-i-2])\n\nli.sort(reverse=True)\nprint(k-li[0])\n', 'k,n = map(int,input().split())\nl= list(map(int,input().split()))\nli = []\n\nfor i in range(n):\n if i != n-1:\n li.append(l[n-i-1]-l[n-i-2])\n else:\n li.append(k-l[n-1]-l[0])\n\nli.sort(reverse=True)\nprint(k-li[0])', 'k,n = map(int,input().split())\nl= list(map(int,input().split()))\nli = []\n\nfor i in range(n):\n if i != n-1:\n li.append(l[n-i-1]-l[n-i-2])\n else:\n li.append(k-l[n-1]+l[0])\n\nli.sort(reverse=True)\nprint(k-li[0])'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s391723287', 's392579570', 's434937044', 's152266671'] | [26060.0, 26444.0, 26060.0, 26436.0] | [120.0, 173.0, 177.0, 181.0] | [157, 164, 215, 215] |
p02725 | u796708718 | 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(x) for x in input().split(" ")]\na = [int(x) for x in input().split(" ")]\na.sort()\na.insert(0,a[-1])\nmax_d = 0\nfor i in range(0,N-1):\n if abs(a[i+1] - a[i]) >= max_d:\n max_d = abs(a[i+1] - a[i])\n\nprint(max_d,K-max_d)\n', 'K, N = [int(x) for x in input().split(" ")]\na = [int(x) for x in input().split(" ")]\na.sort()\na.insert(0,a[-1])\nmax_d = 0\nfor i in range(0,N):\n if a[i] >= int(K/2):\n a[i] = a[i]-int(K/2)\n if abs(a[i+1] - a[i]) >= max_d:\n max_d = abs(a[i+1] - a[i])\n\nprint(K-max_d)\n ', 'K, N = [int(x) for x in input().split(" ")]\na = [int(x) for x in input().split(" ")]\na.sort()\na.insert(0,a[-1])\nmax_d = 0\nfor i in range(0,N):\n if a[i+1] - a[i] >= 0 and a[i+1] - a[i] >= max_d:\n max_d = a[i+1] - a[i]\n elif a[i+1] - a[i] < 0 and a[i+1] - a[i] +K >= max_d:\n max_d = a[i+1] - a[i] + K\n \nprint(K-max_d)\n '] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s136018960', 's955969382', 's860642617'] | [26444.0, 26444.0, 26444.0] | [121.0, 224.0, 179.0] | [232, 274, 339] |
p02725 | u797375364 | 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\nlst = []\nfor i in range(0, len(a)-1) :\n lst += [a[i + 1] - a[i]]\nlst += [k - a[-1] + a[0]]\nprint(lst)\n\nprint(sum(lst) - max(lst))\n', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nlst = []\nfor i in range(0, len(a)-1) :\n lst += [a[i + 1] - a[i]]\nlst += [k - a[-1] + a[0]]\n\nprint(sum(lst) - max(lst))\n'] | ['Wrong Answer', 'Accepted'] | ['s182725294', 's204506708'] | [26444.0, 26444.0] | [153.0, 142.0] | [203, 192] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.