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
u176915127
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 , N_point = map(int,input().split())\nlist_point = input().split()\n\nfor i in range(len(list_point)):\n list_point[i] = int(list_point[i])\n\n\ndistance = []\nfor i in range(len(list_point)):\n \n if i == 0:\n distance.append(list_point[i])\n \n if i == len(list_point)-1:\n distance.append(N - list_point[i])\n break\n distance.append(list_point[i+1]-list_point[i])\n \ndistance.sort()\nprint(distance)\nanswer = []\nfor i in range(N_point):\n answer.append(distance[i])\n\nprint(sum(answer))', 'N , N_point = map(int,input().split())\nlist_point = input().split()\n\nfor i in range(len(list_point)):\n list_point[i] = int(list_point[i])\n\n\ndistance = []\nfor i in range(len(list_point)):\n if i == 0:\n distance.append(list_point[i] + N-list_point[len(list_point)-1])\n distance.append(list_point[i+1]-list_point[i])\n continue\n if i == len(list_point)-1:\n break\n distance.append(list_point[i+1]-list_point[i])\n\n\ndistance.sort()\n\ndistance.remove(max(distance))\n\n\nprint(sum(distance))']
['Wrong Answer', 'Accepted']
['s331872910', 's608589199']
[22348.0, 20276.0]
[249.0, 213.0]
[520, 525]
p02725
u180528413
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(' ')))\nx = k - a[-1]\nfor i in range(n-1):\n y = a[i+1]-a[i]\n if y > x:\n x = y\nprint(k-x)", "k,n = map(int,input().split())\na = list(map(int, input().split(' ')))\nx = k - a[-1] + a[0]\nfor i in range(n-1):\n y = a[i+1]-a[i]\n if y > x:\n x = y\nprint(k-x)"]
['Wrong Answer', 'Accepted']
['s933051485', 's176645111']
[25804.0, 26444.0]
[110.0, 109.0]
[163, 170]
p02725
u181295070
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['k,n = map(int,input().split())\nA = list(map(int,input().split()))\nA.append(k)\nA.sort()\nm = max(y-x for x,y in zip(A,A[1:]))\nans = k-m\nprint(ans)', 'import numpy as np\nk,n = map(int,input().split())\nA = list(map(int,input().split()))\nA.append(k)\nA.sort()\ndist = np.diff(A)\nans = k-max(dist)\nprint(ans)', 'k,n = map(int,input().split())\nA = list(map(int,input().split()))\nA.sort()\nA.append(k+A[0])\nm = max(y-x for x,y in zip(A,A[1:]))\nans = k-m\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s739042040', 's830403558', 's300650950']
[25840.0, 34148.0, 26436.0]
[90.0, 237.0, 87.0]
[144, 152, 149]
p02725
u183657342
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['import numpy as np\n\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nA_dist = [0]*N\n\nfor i in range(N-1):\n A_dist[i] = A[i+1]-A[i]\n \nA_dist[N-1] = (K-A[N-1])+A[0]\n\nprint(A_dist)\nA_dist_max = max(A_dist)\nprint(K-A_dist_max)\n ', 'import numpy as np\n\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nA_dist = [0]*N\n\nfor i in range(N-1):\n A_dist[i] = A[i+1]-A[i]\n \nA_dist[N-1] = (K-A[N-1])+A[0]\n\n\nA_dist_max = max(A_dist)\nprint(K-A_dist_max)']
['Wrong Answer', 'Accepted']
['s144995810', 's402105901']
[34164.0, 34168.0]
[265.0, 252.0]
[253, 235]
p02725
u185896732
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 pysnooper\n#import numpy\n\n#from collections import Counter,deque\n#from operator import itemgetter,mul\n#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations\nfrom sys import stdin,setrecursionlimit\n\n#from copy import deepcopy\n#import heapq\n#import math\n#import string\n#from time import time\n#from functools import lru_cache,reduce\n#from math import factorial,hypot\n#import sys\n#from fractions import gcd\nsetrecursionlimit(10**6+1)\ninput=stdin.readline\n\nk,n=map(int,input().split())\na=[int(i) for i in input().split()]\nabsdis=[min(abs(a[0]-a[-1]),abs(20-a[0]-a[-1]))]\nfor i in range(1,n):\n absdis.append(abs(a[i]-a[i-1]))\n#print(absdis)\nprint(sum(absdis)-max(absdis))', '#import pysnooper\n#import numpy\n\n#from collections import Counter,deque\n#from operator import itemgetter,mul\n#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations\nfrom sys import stdin,setrecursionlimit\n\n#from copy import deepcopy\n#import heapq\n#import math\n#import string\n#from time import time\n#from functools import lru_cache,reduce\n#from math import factorial,hypot\n#import sys\n#from fractions import gcd\nsetrecursionlimit(10**6+1)\ninput=stdin.readline\n\nk,n=map(int,input().split())\na=[int(i) for i in input().split()]\na=a+[k+a[0]]\nabsdis=[]\nfor i in range(n):\n absdis.append(a[i+1]-a[i])\n#print(absdis)\nprint(sum(absdis)-max(absdis))']
['Wrong Answer', 'Accepted']
['s172056435', 's317102644']
[25324.0, 24908.0]
[134.0, 130.0]
[788, 755]
p02725
u189056821
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 a[0] == 0:\n print(a[len(a) - 1] - a[1])\nelse:\n print(a[len(a) - 1] - a[0])', 'import numpy as np\n\nk, n = map(int,input().split())\na = np.array(list(map(int, input().split())))\ndiff = a[1:] - a[:-1]\ndiff = np.append(diff, k - a[-1] + a[0])\nif np.argmax(diff) == len(a) - 1:\n print(a[-1] - a[0])\nelse:\n print(k - a[np.argmax(diff) + 1] + a[np.argmax(diff)])']
['Runtime Error', 'Accepted']
['s824133830', 's844193339']
[2940.0, 34160.0]
[17.0, 215.0]
[83, 283]
p02725
u189171855
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()))\n\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))', 'try:\n K, N = map(int,input().split())\n A = list(map(int, input().split()))\n\n li = []\n for i in range(N - 1):\n li.append(A[i + 1] - A[i]) \n\n li.append(abs(A[0] + (K - A[-1])))\n print(sum(li) - max(li))\nexcept:\n pass']
['Runtime Error', 'Accepted']
['s694529842', 's645833660']
[8808.0, 31992.0]
[25.0, 110.0]
[193, 242]
p02725
u192433528
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,M = map(int,input().split())\nL = [list(map(int,input().split())) for i in range(M)]\ndict = {}\n \nif M == 0 :\n if N == 1 :\n print(0)\n else :\n print(10**(N-1))\n exit()\n \nfor x in L :\n dict.setdefault(x[0],[])\n dict[x[0]].append(x[1])\ndict.setdefault(1,[1])\n \nfor k,v in dict.items():\n dict[k] = set(v)\n \nansList = ["0"]*N\nfor i in range(N) :\n if i+1 in dict :\n ansList[i] = str(list(dict[i+1])[0])\n \nisZeroHead = 2 <= N and ansList[0] == "0"\nisOverlapping = any([ 2 <= len(v) for v in dict.values()]) \nans = -1 if isZeroHead or isOverlapping else int("".join(ansList))\n \n# print(dict)\n\n\nprint(ans)', 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\n\nl = [ A[i+1]-A[i] for i in range(N-1)]\nl.append( K-A[-1] + A[0] )\n\nl.remove(max(l))\nprint(sum(l))']
['Runtime Error', 'Accepted']
['s517286456', 's973852830']
[33776.0, 32384.0]
[68.0, 97.0]
[713, 164]
p02725
u196507615
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=[int(x) for x in input().split()]\na=[int(x) for x in input().split()]\n \nsol=[]\nfor i in range(n-1):\n sol.append(a[i+1]-a[i])\nsol.append(a[0]-a[n-1]+k)\n \nsorted(sol)\n#unwanted segment of max length removed while printing\nprint(sum(sol[0:n-1]))', 'l,n=[int(x) for x in input().split()]\na=[int(x) for x in input().split()]\n \nsol=[]\nfor i in range(n-1):\n sol.append(a[i+1]-a[i])\nsol.append(a[0]-a[n-1]+k)\nsol.sort()\n#unwanted segment of max length removed while printing\nprint(sum(sol[0:n-1]))', '=[int(x) for x in input.split()]\na=[int(x) for x in input.split()]\n \nsol=[]\nfor i in range(n-1):\n sol.append(a[i+1]-a[i])\nsol.append(a[0]-a[n-1]+k)\n \nsol.sort()\n#unwanted segment of max length removed while printing\nprint(sum(sol)[0:n-1])\n', 'n,k=[int(x) for x in input().split()]\na=[int(x) for x in input().split()]\n \nsol=[]\nfor i in range(n-1):\n sol.append(a[i+1]-a[i])\nsol.append(a[0]-a[n-1]+k)\n \nsol.sort()\n#unwanted segment of max length removed while printing\nprint(sum(sol[0:n-1]))', 'n,k=[int(x) for x in input.split()]\na=[int(x) for x in input.split()]\n \nsol=[]\nfor i in range(n-1):\n sol.append(a[i+1]-a[i])\nsol.append(a[0]-a[n-1]+k)\n \nsorted(sol)\n#unwanted segment of max length removed while printing\nprint(sum(sol[0:n-1]))\n', 'n,k=[int(x) for x in input.split()]\na=[int(x) for x in input.split()]\n\nsol=[]\nfor i in range(n-1):\n sol.append(a[i+1]-a[i])\nsol.append(a[0]-a[n-1]+k)\n\nsol.sorted()\n#unwanted segment of max length removed while printing\nprint(sum(sol)[0:n-1])', 'k,n=[int(x) for x in input().split()]\na=[int(x) for x in input().split()]\n \nsol=[]\nfor i in range(n-1):\n sol.append(a[i+1]-a[i])\nsol.append(a[0]-a[n-1]+k)\n \nsol.sort()\nprint(sum(sol[:n-1]))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s076347004', 's178864506', 's238471794', 's349905559', 's720532282', 's997919048', 's960902208']
[26444.0, 26444.0, 2940.0, 26444.0, 2940.0, 3060.0, 26444.0]
[117.0, 121.0, 17.0, 121.0, 17.0, 17.0, 147.0]
[247, 244, 240, 246, 244, 242, 190]
p02725
u199120400
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 in range(N):\n if A[i] > K/2:\n A[i] = K/2 - A[i]\n \nA.sort()\nprint(A)\n\nprint(int(A[N-1] - A[0]))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nD = [0]*N\n\nfor i in range(N-1):\n D[i] = A[i+1] - A[i]\nD[N-1] = A[0] - A[N-1] + K\n \nD.sort()\n\nprint(D)\nprint(K - D[N-1])', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n \nD = [0]*N\n \nfor i in range(N-1):\n D[i] = A[i+1] - A[i]\nD[N-1] = A[0] - A[N-1] + K\n \nD.sort()\nprint(K - D[N-1])']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s279496687', 's416582270', 's084759329']
[25804.0, 26444.0, 26444.0]
[197.0, 145.0, 136.0]
[174, 195, 187]
p02725
u200316926
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 = map(int, input("K,N:").split())\nAn_list = np.array(input("An:").split(), dtype=int)\n\n\nAn_delta_list = np.array([], dtype=int)\n\n\nfor i in range(len(An_list)-1):\n An_delta_list = np.append(An_delta_list, An_list[i+1] -An_list[i])\nAn_delta_list = np.append(An_delta_list, K - An_list[-1])\n\n\nAn_delta_max = np.max(An_delta_list)\nresult = np.sum(An_delta_list) - An_delta_max\n\n\nprint(result)', '\nK,N = map(int, input("K,N:").split())\nAn_list = np.array(input("An:").split(), dtype=int)\n\n\n\n\n\n\nAn_delta_list = np.array([], dtype=int)\n\n\nfor i in range(len(An_list)-1):\n An_delta_list = np.append(An_delta_list, An_list[i+1] -An_list[i])\nAn_delta_list = np.append(An_delta_list, K - An_list[-1])\n\n\nAn_delta_max = np.max(An_delta_list)\nresult = np.sum(An_delta_list) - An_delta_max\nprint(result)\n\n', 'import numpy as np', 'K,N = map(int, input().split())\nAn_list = np.array(input().split(), dtype=int)\n\nAn_delta_list = np.diff(An_list)\nAn_delta_list = np.append(An_delta_list, K - An_list[N-1])\nAn_delta_max = np.max(An_delta_list)\nresult = np.sum(An_delta_list) - An_delta_max\nprint(result)', 'import numpy as np\n\nK,N = map(int, input().split())\nAn_list = np.array(input().split(), dtype=int)\n\nAn_delta_list = np.diff(An_list)\nAn_delta_list = np.append(An_delta_list, (K - An_list[-1])+An_list[0])\nAn_delta_max = np.max(An_delta_list)\nresult = np.sum(An_delta_list) - An_delta_max\nprint(result)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s128524418', 's259664569', 's534916537', 's614943817', 's143484353']
[3064.0, 3064.0, 12432.0, 3060.0, 41296.0]
[17.0, 17.0, 150.0, 17.0, 357.0]
[502, 699, 18, 268, 300]
p02725
u205303316
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['A=input()\nLA=A.split()\nK=int(LA[0])\nN=int(LA[1])\n\nB=input()\nLB=B.split()\n\nC=0\nsamax=0\nstart=0\n\nfor n in LB:\n sa=int(int(n)-int(C))\n C=n\n if samax < sa:\n samax=sa\n start=int(n)-int(samax)\n\nans1=int(LB[N-1])-int(LB[0])\nans2=int((K-int(LB[N-1]))+int(start))\n\nif ans2 > ans1:\n ans=ans1\nelse :\n ans=ans2\nprint(ans)\n', 'A=input()\nLA=A.split()\nK=int(LA[0])\nN=int(LA[1])\n\nB=input()\nLB=B.split()\n\nC=0\nsamax=0\nstart=0\n\nfor n in LB:\n sa=int(int(n)-int(C))\n C=n\n if samax < sa:\n samax=sa\n start=int(n)-int(samax)\n goal=int(n)\nans1=int(LB[N-1])-int(LB[0])\nans2=int((K-goal)+int(start))\n\nif ans2 > ans1:\n ans=ans1\nelse :\n ans=ans2\nprint(ans)']
['Wrong Answer', 'Accepted']
['s772821343', 's907122719']
[18900.0, 19032.0]
[171.0, 170.0]
[321, 327]
p02725
u208120643
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.
['"""Boot-camp-for-Beginners_Easy012_C_Next-Prime_30-August-2020.py"""\nimport numpy as np\n\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ntheta = []\nfor i in range(len(A)):\n if i == len(A)-1:\n theta.append(2*np.pi*(K-A[i]+A[0])/K)\n else:\n theta.append(2*np.pi*(A[i+1]-A[i])/K)\n\n\n\ntheta.remove(max(theta))\n\ns=0\nfor j in range(len(theta)):\n s+=theta[j]\n#print(s)\nl_min=(s*K)/(2*np.pi)\nprint(int(l_min)+1)', '"""Boot-camp-for-Beginners_Easy012_C_Next-Prime_30-August-2020.py"""\nimport numpy as np\n\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ntheta = []\nfor i in range(len(A)):\n if i == len(A)-1:\n theta.append(2*np.pi*(K-A[i]+A[0])/K)\n else:\n theta.append(2*np.pi*(A[i+1]-A[i])/K)\n\n\n\ntheta.remove(max(theta))\n\ns=0\nfor j in range(len(theta)):\n s+=theta[j]\n#print(s)\nl_min=(s*K)/(2*np.pi)\nprint(int(l_min)+1)', '"""Boot-camp-for-Beginners_Easy012_C_Next-Prime_30-August-2020.py"""\nimport numpy as np\n\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ntheta = []\nfor i in range(len(A)):\n if i == len(A)-1:\n theta.append(2*np.pi*(K-A[i]+A[0])/K)\n else:\n theta.append(2*np.pi*(A[i+1]-A[i])/K)\n\ntheta.remove(max(theta))\n\ns=0\nfor j in range(len(theta)):\n s+=theta[j]\n#print(s)\nl_min=(s*K)/(2*np.pi)\nprint(l_min)\n', '"""Boot-camp-for-Beginners_Easy012_C_Next-Prime_30-August-2020.py"""\nimport numpy as np\n\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ntheta = []\nfor i in range(len(A)):\n if i == len(A)-1:\n theta.append(2*np.pi*(K-A[i]+A[0])/K)\n else:\n theta.append(2*np.pi*(A[i+1]-A[i])/K)\n\n\n\ntheta.remove(max(theta))\n\ns=0\nfor j in range(len(theta)):\n s+=theta[j]\n#print(s)\nl_min=(s*K)/(2*np.pi)\nprint(l_min)', '"""Boot-camp-for-Beginners_Easy012_C_Next-Prime_30-August-2020.py"""\nimport numpy as np\n\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ntheta = []\nfor i in range(len(A)):\n if i == len(A)-1:\n theta.append((K-A[i]+A[0]))\n else:\n theta.append((A[i+1]-A[i]))\n\ntheta.remove(max(theta))\n\ns=0\nfor j in range(len(theta)):\n s+=theta[j]\n#print(s)\nl_min=s\nprint(l_min)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s011819090', 's028053379', 's184192410', 's747759906', 's353566368']
[50748.0, 50756.0, 50628.0, 50988.0, 50988.0]
[258.0, 265.0, 261.0, 266.0, 234.0]
[483, 483, 451, 476, 440]
p02725
u209313313
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=map(int, input().split())\nA=list(map(int, input().split()))\n\nA_sorted=sorted(A)\n\nif sorted_A[N-1]-sorted_A[0] <K/2:\n print(sorted_A[N-1]-sorted_A[0])\n\nelse:\n for i in range (0, N-1):\n if A[i] > K/2:\n A[i]=A[i]-K\n else:\n A[i]=A[i]\n\n a=A_sorted[N-1]-A_sorted[0]\n b=K-a\n\n print(min(a, b))', 'K, N=map(int, input().split())\nA=list(map(int, input().split()))\n\nfor i in range (N-2):\n A_length=list(A[i+1]-A[i])\nA_length.append = [K-(A[N-1]-A[0])]\nprint(K-(max(A_length)))', '\nK, N=map(int, input().split())\nA=list(map(int, input().split()))\n\nfor i range (0, N-1):\n if A[i] > K/2:\n A[i]=K-A[i]\n else:\n A[i]=A[i]\n\nA_sorted=sorted(A)\n\nprint(A_sorted[N-1]-A_sorted[0])', 'K, N=map(int, input().split())\nA=list(map(int, input().split()))\n\nfor i range (0, N-1):\n if A[i] > K/2:\n A[i]=A[i]-K\n else:\n A[i]=A[i]\n\nA_sorted=sorted(A)\n\nprint(A_sorted[N-1]-A_sorted[0])', 'K, N=map(int, input().split())\nA=list(map(int, input().split()))\n\nA_length_max = K-A[N-1]+A[0]\nfor i in range (N-1): #0, 1, 2, ...N-2\n A_length_max=max(A_length_max, A[i+1]-A[i])\nprint(K-A_length_max)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s010298976', 's318066609', 's701037441', 's720844151', 's694088325']
[26444.0, 26436.0, 2940.0, 2940.0, 26444.0]
[78.0, 66.0, 17.0, 17.0, 153.0]
[342, 179, 209, 208, 203]
p02725
u211805975
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,m = map(int,input().split())\na = input().split()\na =[int(s) for s in a]\n\na.insert(0,k)\n\ndis = []\n\nfor i in range(m):\n part = int(a[i]) - int(a[i+1])\n dis.append(part)\n del part\n\ndis.append(int(a[m-1]))\ndistance = dis*2\n\nc =[]\nfor j in range(m):\n c = sum(distance[j:j+5])\n\nprint(min(c))', 'k,m = map(int,input().split())\na = input().split()\na =[int(s) for s in a]\na.sort(reverse=True)\na.insert(0,k)\n\ndis = []\n\nfor i in range(m):\n part = int(a[i]) - int(a[i+1])\n dis.append(part)\n del part\n\ndis.append(int(a[m-1]))\ndis.sort()\nprint(dis)\n\nprint(sum(dis[:m-1]))\n', 'k,m = map(int,input().split())\na = input().split()\na =[int(s) for s in a]\n\na.insert(0,k)\n\ndis = []\n\nfor i in range(m):\n part = int(a[i]) - int(a[i+1])\n dis.append(part)\n del part\n\ndis.append(int(a[m-1]))\ndistance = dis*2\n\nc =[]\nfor j in range(m):\n c = int(sum(distance[j:j+5]))\n\nprint(min(c))', '#12\nk,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])\n\nb.append(int(k-a[n-1]+a[0]))\n\nc = max(b)\nb.remove(c)\n\nprint(sum(b))\n']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s202067267', 's986881956', 's992980855', 's933083122']
[26444.0, 26444.0, 26444.0, 26436.0]
[296.0, 251.0, 308.0, 122.0]
[291, 272, 296, 193]
p02725
u212328220
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()))\nal = list(map(int(input().split())))\n\ndtlst = [al[0]]\nfor i in range(1,n):\n dtlst.append(al[i]-al[i-1])\ndtlst.append(k - al[-1]+al[0])\n\nprint(k - max(dtlst))', 'k, n = map(int(input().split()))\nal = list(map(int,input().split()))\n\ndtlst = [al[0]]\nfor i in range(1,n):\n dtlst.append(al[i]-al[i-1])\ndtlst.append(k - al[-1]+al[0])\n\nprint(k - max(dtlst))\n', 'k, n = map(int,input().split())\nal = list(map(int,input().split()))\n\ndtlst = [al[0]]\nfor i in range(1,n):\n dtlst.append(al[i]-al[i-1])\ndtlst.append(k - al[-1]+al[0])\n\nprint(k - max(dtlst))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s152321044', 's956941266', 's366265765']
[9016.0, 8984.0, 32300.0]
[25.0, 26.0, 110.0]
[191, 191, 190]
p02725
u216888678
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())\nA=list(map(int,input().split())\nL_max=0\nfor i in range(A):\n if i<len(A)-1:\n l=A[i+1]-A[i]\n else:\n l=K-A[-1]+A[0]\n if L_max<l:\n L_max=l\nans=sum(A)-L_max\nprint(ans)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nmax_ans=0\nfor i in range(N):\n if i==N-1:\n ans=K-A[N-1]+A[0]\n else:\n ans=A[i+1]-A[i]\n if max_ans<ans:\n max_ans=ans\nans=K-max_ans\nprint(ans)']
['Runtime Error', 'Accepted']
['s212542741', 's749289796']
[2940.0, 26436.0]
[18.0, 132.0]
[213, 230]
p02725
u222185706
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['import numpy as np\n\n\n\nfirst_input = list(map(lambda x:int(x), input().split(" ")))\nsecond_input = list(map(lambda x:int(x), input().split(" ")))\n\n\n#first_input = list(map(lambda x:float(x), input().split(" ")))\n#second_input = list(map(lambda x:float(x), input().split(" ")))\n\n##get string\n#first_input = input().split(" ")\n\nK = first_input[0]\nN= first_input[1]\n\nA_list = second_input\n\nA_list.append(K+A_list[0])\n\ndist_list = np.array(A_list)[1:]-np.array(A_list)[:-1]\nprint(A_list)\nprint(dist_list)\n\nprint(sum(dist_list)-max(dist_list))\n', 'import numpy as np\n\n\n\nfirst_input = list(map(lambda x:int(x), input().split(" ")))\nsecond_input = list(map(lambda x:int(x), input().split(" ")))\n\n\n#first_input = list(map(lambda x:float(x), input().split(" ")))\n#second_input = list(map(lambda x:float(x), input().split(" ")))\n\n##get string\n#first_input = input().split(" ")\n\nK = first_input[0]\nN= first_input[1]\n\nA_list = second_input\n\nA_list.append(K+A_list[0])\n\ndist_list = np.array(A_list)[1:]-np.array(A_list)[:-1]\n\nprint(sum(dist_list)-max(dist_list))\n']
['Wrong Answer', 'Accepted']
['s602045427', 's923916187']
[34156.0, 39280.0]
[350.0, 401.0]
[558, 527]
p02725
u223555291
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\na,b=map(int,input().split())\nc=list(map(int,input().split()))\nc.sort()\nd=[0]*1000000\nfor i in range(b-1):\n d[i]+=abs(c[i]-c[i+1])\n\nd.append(a-c[-1])\n\nprint(a-max(d))\n\n\n\n', 'import sys\na,b=map(int,input().split())\nc=list(map(int,input().split()))\nc.sort()\nd=[0]*a\nfor i in range(b-1):\n d[i]+=abs(c[i]-c[i+1])\n\nd.append(a-c[-1])\n\nprint(a-max(d))\n\n\n\n', 'import sys\na,b=map(int,input().split())\nc=list(map(int,input().split()))\nc.sort()\nd=[0]*1000000\nfor i in range(b-1):\n d[i]+=abs(c[i]-c[i+1])\n \n\nd.append(a-(c[-1]-c[0]))\n\nprint(a-max(d))\n\n\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s259981373', 's933775041', 's210814397']
[26436.0, 26444.0, 26444.0]
[158.0, 176.0, 162.0]
[181, 175, 191]
p02725
u223904637
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.append(l[0]+k)\na=10**10\nfor i in range(n):\n a=min(a,l[i+1]-l[i])\nprint(k-a)', 'k,n=map(int,input().split())\nl=list(map(int,input().split()))\nl.append(l[0]+k)\na=0\nfor i in range(n):\n a=max(a,l[i+1]-l[i])\nprint(k-a)\n']
['Wrong Answer', 'Accepted']
['s249838446', 's246579905']
[25836.0, 26444.0]
[145.0, 161.0]
[142, 138]
p02725
u224119985
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(input(),int.split())\na=list(input(),int.split())\n\nm=0\nfor i in range(n-1):\n d=a[i+1]-a[i]\n m=max(d,m)\nd_last=a[0]+k-a[n-1]\nm=max(d_last,m)\n\nans=k-m\nprint(ans)', 'k,n=map(input(),int.split())\na=list(map(input(),int.split()))\n\nm=0\nfor i in range(n-1):\n d=a[i+1]-a[i]\n m=max(d,m)\nd_last=a[0]+k-a[n-1]\nm=max(d_last,m)\n\nans=k-m\nprint(ans)', 'k,n=map(input(),int.split())\na=map(list(input(),int.split()))\n\nm=0\nfor i in range(n-1):\n d=a[i+1]-a[i]\n m=max(d,m)\nd_last=a[0]+k-a[n-1]\nm=max(d_last,m)\n\nans=k-m\nprint(ans)', '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(d,m)\nd_last=a[0]+k-a[n-1]\nm=max(d_last,m)\n\nans=k-m\nprint(ans)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s342459410', 's607523811', 's874087169', 's928539198']
[3064.0, 3064.0, 3064.0, 26444.0]
[17.0, 17.0, 18.0, 166.0]
[172, 177, 177, 178]
p02725
u224522483
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())\narray = list(map(int, input().split())) + [n]\na = [array[i] - array[i-1] for i in range(1, n+1)]\nprint(sum(a) - max(a))', 'n, k = map(int, input().split())\narray = list(map(int, input().split()))\narray = array + [array[0] + n]\na = [array[i] - array[i-1] for i in range(1, k+1)]\nprint(n - max(a))']
['Runtime Error', 'Accepted']
['s585461173', 's195885512']
[26436.0, 25832.0]
[94.0, 99.0]
[152, 172]
p02725
u225020286
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()))\nx=[]\ny=[]\nfor i in A:\n if i>10:\n a=20-i\n y.append(a)\n else:\n x.append(i)\nif len(A)==1:\n if A[0]>=10:\n print(20-A[0])\n else:\n print(A[0])\nelse:\n ans=max(x)+max(y)\n print(ans)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nx=[]\n\nfor i in A:\n if i>10:\n a=i-20\n x.append(a)\n else:\n x.append(i)\nif len(x)==1:\n print(abs(x[0]))\nelse:\n xmax=max(x)\n xmin=min(x)\n ans=xmax-xmin\n print(ans)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nsa=[]\nsa.append(int(K-A[-1]+A[0]))\nfor i in range(1,N):\n tmp=A[i]-A[i-1]\n sa.append(tmp)\nans=K-max(sa)\nprint(ans)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s360964611', 's393539240', 's976335280']
[26436.0, 26420.0, 26436.0]
[111.0, 120.0, 121.0]
[256, 237, 177]
p02725
u228303592
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 = []\n\nfor i in range(1,n+1):\n b.append(a[i] - a[i-1])\nb.append(k - a[n] + a[0])\nb = sorted(b)\n\nprint(sum(b:[:n])', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nb = []\n\nfor i in range(1,n):\n b.append(a[i]-a[i-1])\nb.append(k-a[n-1]+a[0])\n\nb.sorted(b)\n\nprint(sum(b[:-1]))\n', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nb = []\n\nfor i in range(1,n+1):\n b.append(a[i] - a[i-1])\nb.append(k - a[n] + a[0])\nb = sorted(b)\n\nprint(sum(b[:n])', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nb = []\n\nfor i in (1,n):\n b.append(a[i] - a[i-1])\nb.append(k - a[n-1] + a[0])\nb = sorted(b)\n\nprint(sum(b[:-1]))', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nb = []\n\nfor i in range(1,n):\n b.append(a[i]-a[i-1])\nb.append(k-a[n-1]-a[0])\n\nb.sorted(b)\n\nprint(sum(b[:-1]))', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nb = []\n\nfor i in range(1,n+1):\n b.append(a[i] - a[i-1])\nb.append(k - a[n] + a[0])\nb = sorted(b)\n\nprint(sum(b[:n-1])\n', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nb = []\n\nfor i in range(1,n):\n b.append(a[i] - a[i-1])\nb.append(k - a[n-1] + a[0])\nb = sorted(b)\n\nprint(sum(b[:-1]))\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s253068855', 's394154210', 's516882876', 's610523049', 's818666325', 's888776403', 's286290711']
[8952.0, 32312.0, 8996.0, 32364.0, 32252.0, 9040.0, 32172.0]
[24.0, 101.0, 26.0, 70.0, 104.0, 28.0, 120.0]
[181, 176, 180, 177, 175, 183, 183]
p02725
u228976998
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.
['x = input()\nnum = int(x.split()[1])\nperimeter = int(x.split()[0])\nhouses = [int(i) for i in input().split()]\n\nmaxDis = perimeter - houses[-1] + houses[0]\ntotal = maxDis\nfor i in range(1, len(houses)):\n maxDis = max(maxDis, houses[i]-houses[i-1])\n total += houses[i]-houses[i-1]\nprint(total)', 'x = input()\nnum = int(x.split()[1])\nperimeter = int(x.split()[0])\nhouses = [int(i) for i in input().split()]\n\nmaxDis = perimeter - houses[-1] + houses[0]\ntotal = maxDis\nfor i in range(1, len(houses)):\n maxDis = max(maxDis, houses[i]-houses[i-1])\n total += houses[i]-houses[i-1]\nprint(total-maxDis)']
['Wrong Answer', 'Accepted']
['s979313532', 's728142078']
[31752.0, 31604.0]
[166.0, 162.0]
[296, 303]
p02725
u236666830
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 = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.remove(0)\nA.append(A[0])\n\nmax_distance = 0\npre = 0\n\nfor i in A:\n\n if abs(i - pre) > max_distance:\n max_distance = abs(i - pre)\n pre = i\n\n\n\nprint (K - max_distance)', '\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\n\ndiff = K + A[0] - A[-1]\n\nfor i in range(N-1):\n diff = max(diff , A[i+1]-A[i])\n\nprint(K-diff)\n']
['Runtime Error', 'Accepted']
['s894546986', 's601960206']
[26444.0, 26436.0]
[100.0, 161.0]
[249, 167]
p02725
u238956837
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\ndistance = [0]*n\n\nfor i in range(n-1):\n print(a[i+1],a[i])\n distance[i] = a[i+1] - a[i]\ndistance[n-1] = k-a[n-1] + a[0]\n\ndistance.sort(reverse=True)\nprint(distance)\nprint(sum(distance[1:]))', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\ndistance = [0]*n\n\nfor i in range(n-1):\n distance[i] = a[i+1] - a[i]\ndistance[n-1] = k-a[n-1] + a[0]\n\ndistance.sort(reverse=True)\nprint(sum(distance[1:]))']
['Wrong Answer', 'Accepted']
['s592927868', 's207657820']
[26420.0, 26444.0]
[442.0, 141.0]
[261, 224]
p02725
u247211039
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=[0]*N\n\nfor i in range(N-1):\n B[i]=A[i+1]-A[i]\n\nB[-1]=K-A[-1]\n\n\nans = K-max(B)\nprint(ans)', 'K,N=map(int, input().split())\nA=list(map(int, input().split()))\n\nB=[0]*N\n\nfor i in range(N-1):\n B[i]=A[i+1]-A[i]\n\nB[-1]=A[0]+K-A[-1]\n\nB=sorted(B)\n\nans = sum(B[0:-1])\nprint(ans)']
['Wrong Answer', 'Accepted']
['s847913264', 's440400037']
[32292.0, 32204.0]
[106.0, 120.0]
[159, 179]
p02725
u247680229
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['import numpy as np\n\nK,N=list(map(int, input().split()))\n\nA=list(map(int, input().split()))\n\n\nA=np.array(A)\n\nlin=np.array(A[:-1])\nle=np.array(A[1:])\n\nlength=abs(lin-le)\n\nrem=abs(K-A[-1]+A[0])\nprint(length)\nA=np.append(length,rem)\n\nM=np.max(A)\n\nprint(K-M)', 'import numpy as np\n\nK,N=list(map(int, input().split()))\n\nA=list(map(int, input().split()))\n\n\nA=np.array(A)\n\nlin=np.array(A[:-1])\nle=np.array(A[1:])\n\nlength=abs(lin-le)\n\nrem=abs(K-A[-1]+A[0])\n\nA=np.append(length,rem)\n\nM=np.max(A)\n\nprint(K-M)']
['Wrong Answer', 'Accepted']
['s550465386', 's427769024']
[34140.0, 34140.0]
[218.0, 219.0]
[253, 240]
p02725
u250554058
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['def main():\n k, N = (int(x) for x in input().split())\n min_LIST = []\n LIST = []\n LIST = list(map(int,input().split()))\n\n for i in range(len(LIST) - 1):\n min_LIST.append(LIST[i + 1] - LIST[i])\n if(min_LIST[i] <= (LIST[i + 1] - LIST[i])):\n x = (LIST[i + 1] - LIST[i])\n print(x)\n\n print(min_LIST)\n\n min_LIST.append(LIST[0] + (k - LIST[-1]))\n if(x <= (LIST[0] + (k - LIST[-1]))):\n x = (LIST[0] + (k - LIST[-1]))\n\n sum_list = sum(min_LIST) - x\n\n print(sum_list)\nif __name__ == "__main__":\n main()\n\n\n\n\n', 'def main():\n k, N = (int(x) for in input().split())\n LIST = []\n min_LIST = []\n for i in range(N):\n l.append(int(input()))\n\n for i in range(len(LIST) - 1):\n min_LIST.append(LIST[i + 1] - LIST[i])\n if(min_LIST <= (LIST[i + 1] - LIST[i])):\n x = (LIST[i + 1] - LIST[i])\n\n if(min_LIST <= (LIST[0] + (k - LIST[-1])):\n x = (LIST[0] + (k - LIST-1]))\n\n sum_list = sum(min_LIST) - x\n\n print(sum_list)\nif __name__ == "__main__":\n main()\n\n\n\n\n', 'def main():\n k, N = (int(x) for x in input().split())\n min_LIST = []\n LIST = []\n LIST = list(map(int,input().split()))\n\n for i in range(len(LIST) - 1):\n min_LIST.append(LIST[i + 1] - LIST[i])\n if(min_LIST[i] <= (LIST[i + 1] - LIST[i])):\n x = (LIST[i + 1] - LIST[i])\n print(x)\n\n print(min_LIST)\n\n min_LIST.append(LIST[0] + (k - LIST[-1]))\n if(x <= (LIST[0] + (k - LIST[-1]))):\n x = (LIST[0] + (k - LIST[-1]))\n\n sum_list = sum(min_LIST) - x\n\n print(sum_list)\nif __name__ == "__main__":\n main()\n\n\n\n\n', 'def main():\n k, N = (int(x) for x in input().split())\n min_LIST = []\n LIST = []\n LIST = list(map(int,input().split()))\n x = 0\n\n for i in range(len(LIST) - 1):\n min_LIST.append(LIST[i + 1] - LIST[i])\n if(x <= min_LIST[i]):\n x = min_LIST[i]\n\n if(N != 2):\n min_LIST.append(LIST[0] + (k - LIST[-1]))\n if(x <= (LIST[0] + (k - LIST[-1]))):\n x = (LIST[0] + (k - LIST[-1]))\n\n sum_list = sum(min_LIST) - x\n\n print(sum_list)\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s109992997', 's242852748', 's883188781', 's180466561']
[26444.0, 2940.0, 26444.0, 26444.0]
[292.0, 17.0, 278.0, 102.0]
[526, 456, 526, 482]
p02725
u257265865
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()))\nA=[]\nfor i in range(N-1):\n A.append(L[i+1]-L[i])\nL.append(K-L[L-1]+L[0])\nprint(K-max(L))\n\n', 'K,N=map(int,input().split())\nL=list(map(int,input.split()))\nA=[]\nfor i in range(N-1):\n A.append(L[i+1]-L[i])\nL.append(K-L[L-1]+L[0])\nprint(K-max(L))', 'K,N=map(int,input().split())\nL=list(map(int,input().split()))\nA=[]\nfor i in range(N-1):\n A.append(L[i+1]-L[i])\nL.append(K-L[N-1]+L[0])\nprint(K-max(L))', 'K,N=map(int,input().split())\nL=list(map(int,input().split()))\nA=[]\nfor i in range(N-1):\n A.append(L[i+1]-L[i])\nA.append(K-L[N-1]+L[0])\nprint(K-max(A))']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s341252862', 's343581222', 's784064701', 's222186870']
[26444.0, 3060.0, 26444.0, 25840.0]
[115.0, 17.0, 117.0, 116.0]
[153, 149, 151, 151]
p02725
u257332942
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()))\nd = 0\n\nfor i in range(n-1):\n d = (d, a[i+1] - a[i])\nd = (d, k - a[-1] + a[0])\n\nprint(K - d)', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\nd = 0\n\nfor i in range(n-1):\n d = max(d, a[i+1] - a[i])\nd = max(d, k - a[-1] + a[0])\n\nprint(k - d)']
['Runtime Error', 'Accepted']
['s821856777', 's183297168']
[27504.0, 26444.0]
[159.0, 159.0]
[163, 169]
p02725
u257472411
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\nk = kn[0]\nn = kn[1]\n\n\ndis = []\n\nfor i in range(n):\n if i == 0:\n dis.append(min((a[n-1] - a[0]), (k - a[n-1] + a[0])))\n else:\n dis.append(min((a[i] - a[i-1]), (k - a[i] + a[i-1])))\n\nprint(dis)\ndel dis[dis.index(max(dis))]\n\nprint(sum(dis))\n\n'''\ndis = [[0]*n]\n\nfor i in range(n):\n for j in range(n):\n if i+j+1 >= n-1:\n dis[i][j] = k - a[i+j+1-(n-1)] + a[i+j+1-(n-1)-1]\n else:\n dis[i][j] = a[i+j+1] - a[i+j]\n\n dis.append([0]*n)\n print(dis)\n\nprint(dis)\n'''", "kn = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nk = kn[0]\nn = kn[1]\n\n\ndis = []\n\nfor i in range(n):\n if i == 0:\n dis.append(min((a[n-1] - a[0]), (k - a[n-1] + a[0])))\n else:\n dis.append(min((a[i] - a[i-1]), (k - a[i] + a[i-1])))\n\ndel dis[dis.index(max(dis))]\n\nprint(sum(dis))\n\n'''\ndis = [[0]*n]\n\nfor i in range(n):\n for j in range(n):\n if i+j+1 >= n-1:\n dis[i][j] = k - a[i+j+1-(n-1)] + a[i+j+1-(n-1)-1]\n else:\n dis[i][j] = a[i+j+1] - a[i+j]\n\n dis.append([0]*n)\n print(dis)\n\nprint(dis)\n'''"]
['Wrong Answer', 'Accepted']
['s311892254', 's817791334']
[26444.0, 26444.0]
[218.0, 218.0]
[588, 577]
p02725
u261082314
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())\nn_list=[int(input()) for i in range(n)]\nfor i in range(len(n_list)):\n if n_list[i] > k-n_list[i]:\n n_list[i]=-(k-n_list[i])\nn_list.sort()\nprint(n_list[-1]-n_list[0])\n', 'k,n = map(int,input().split())\nn_list = list(map(int,input().split()))\nfor i in range(len(n_list)):\n if n_list[i] > k-n_list[i]:\n n_list[i]=-(k-n_list[i])\nn_list.sort()\nprint(n_list[-1]-n_list[0])', '(n,m)=map(int,input().split())\na=input().split()\na=list(map(int,a))\nl=[]\nk=0\na=sorted(a)\nfor i in range(m-1):\n d=abs(a[i]-a[i+1])\n k=k+d\n l.append(d)\n# k=k-d\nc=n-k\nl.append(c)\nl=sorted(l)\n\nprint(n-l[-1])']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s796666428', 's860769775', 's742405575']
[3060.0, 26420.0, 26420.0]
[18.0, 128.0, 178.0]
[200, 200, 212]
p02725
u262244504
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\nl = [0] * N\nhoge = 0\n\nfor n in range(N):\n l[n] = A[n]-hoge\n hoge = hoge + l[n]\n \nl = l + [K-A[N-1]]\n\nprint(sum(l)-max(l))', 'K, N = map(int,input().split())\nA = list(map(int, input().split()))\n\nl = [0] * N\nhoge = 0\n\nfor n in range(N):\n l[n] = A[n]-hoge\n hoge = hoge + l[n]\n \nl = l + [K-A[N-1]]\n\nif A[0]!=0 :\n l[N] = l[N]+l[0]\n l[0] = 0\n\nprint(sum(l)-max(l))']
['Wrong Answer', 'Accepted']
['s846714044', 's385781432']
[26436.0, 26444.0]
[151.0, 134.0]
[193, 237]
p02725
u264312747
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()))\nd_list = [a_list[0] + k - a_list[n - 1]]\nfor i in range(0, n - 1):\n d_list.append(a_list[i + 1] - a_list[i])\n print(d_list)\nans = sum(d_list) - max(d_list)\nprint(ans)', 'k, n = map(int, input().split())\na_list = list(map(int, input().split()))\nd_list = [a_list[0] + k - a_list[n - 1]]\nfor i in range(0, n - 1):\n d_list.append(a_list[i + 1] - a_list[i])\nans = sum(d_list) - max(d_list)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s454308213', 's218848692']
[107996.0, 26444.0]
[2104.0, 117.0]
[242, 226]
p02725
u265154666
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['import numpy as np\n\nN, K = map(int, input().split())\n\n\nlocations = input().split()\ndists = []\nprev_location = None\n\nfor location in locations:\n if prev_location is None:\n prev_location = int(location)\n else:\n\t dists.append(int(location) - prev_location) \n\t prev_location = int(location)\ndists.append(N - int(locations[-1]))\n\n# print(dists)\nprint(N - np.array(dists).max())', 'import numpy as np\n\nN, K = map(int, input().split())\n\n\nlocations = input().split()\ndists = []\nprev_location = None\n\nfor location in locations:\n if prev_location is None:\n prev_location = int(location)\n else:\n\t dists.append(int(location) - prev_location) \n\t prev_location = int(location)\ndists.append(N - int(locations[-1]) + int(locations[0]))\n\n# print(dists)\nprint(N - np.array(dists).max())']
['Wrong Answer', 'Accepted']
['s154526996', 's263693638']
[35972.0, 30376.0]
[421.0, 294.0]
[393, 413]
p02725
u266964556
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 = input().split()\nfor i in range(N):\n A[i] = int(A[i])\nmax = 0\nfor i in range(N-1):\n diff = abs(A[i] - A[i+1])\n if diff >= max:\n max = diff\n\nif abs(K - A[N-1]) >= max:\n max = abs(K - A[N-1])\n\nprint(K - max)', 'K, N = map(int,input().split())\nA = input().split()\nfor i in range(N):\n A[i] = int(A[i])\nmax = 0\nfor i in range(N-1):\n diff = abs(A[i] - A[i+1])\n if diff >= max:\n max = diff\n\nif abs(K - A[N-1] + A[0]) >= max:\n max = abs(K - A[N-1] + A[0])\n\nprint(K - max)']
['Wrong Answer', 'Accepted']
['s892673677', 's450226862']
[18636.0, 19140.0]
[152.0, 162.0]
[259, 273]
p02725
u267029978
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())\nlistA = list(map(int,input().split()))\nlistB = []\n\nfor i in listA:\n if i > K/2:\n temp = i - K\n listB.append(temp)\n else:\n listB.append(i)\nprint(listB)\nout1 = max(listA) - min(listA)\nout2 = max(listB) - min(listB)\nif out1 >= out2:\n print(out2)\nelse:\n print(out1)', 'K,N = map(int,input().split())\nlistA = list(map(int,input().split()))\n\nlistB = []\n\nsum = max(listA) - min(listA)\nlistB.append(sum)\n\n## n - (n-1) ##\nfor i in range(1,N):\n out = listA[i] - listA[i-1]\n out = K - out\n listB.append(out)\n\n\nprint(min(listB))']
['Wrong Answer', 'Accepted']
['s532252494', 's517978893']
[26420.0, 26420.0]
[174.0, 147.0]
[305, 272]
p02725
u267300160
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()))\nsa = []\nfor i in range(1,N):\n sa.append(abs(A_list[i]-A_list[i-1]))\nsa.append(K-A_list[-1])\nprint(sa)\nprint(sum(sa)-max(sa))\n', 'K,N = map(int,input().split())\nA_list = list(map(int,input().split()))\nsa = []\nfor i in range(1,N):\n sa.append(abs(A_list[i]-A_list[i-1]))\nsa.append(K-A_list[-1] + A_list[0])\nprint(sum(sa)-max(sa))\n']
['Wrong Answer', 'Accepted']
['s625767593', 's501602776']
[26444.0, 26444.0]
[145.0, 130.0]
[199, 201]
p02725
u269749457
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()\ndistance = list(map(int, input().split()))\n\nrelative = []\nrelative[0] = distance[0]\nfor i in range(1, len(distance)):\n relative[i] = distance[i+1] - distance[i]\nrelative.append(K - distance[-1])\nprint(sum(relative) - max(relative))', 'K, N = input().split()\ndistance = list(map(int, input().split()))\n\nrelative = []\nrelative.append(distance[0])\nfor i in range(int(N)-1):\n relative.append(distance[i+1] - distance[i])\nrelative[0] += (int(K) - distance[-1])\nprint(sum(relative) - max(relative))']
['Runtime Error', 'Accepted']
['s049587289', 's402590083']
[26060.0, 26420.0]
[65.0, 117.0]
[258, 261]
p02725
u273787824
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\nimport os\n\ndef remove_empty(target_list: list):\n empty_removed_list = [x for x in target_list if x]\n return empty_removed_list\n\n\ndef get_stdin_str_list(input_str=None):\n if input_str is None:\n input_str = input()\n input_str = input_str.strip()\n input_str_list = input_str.split()\n return input_str_list\n\n\ndef get_stdin_int_list(input_str=None):\n input_str_list = get_stdin_str_list(input_str)\n input_int_list = list(map(int, input_str_list))\n return input_int_list\n\n\ndef get_stdin_str_multi_list(input_str=None):\n if input_str is None:\n input_str = input()\n input_str = input_str.strip()\n input_str_line_list = input_str.split("\\n")\n input_str_multi_list = list()\n for str_line in input_str_line_list:\n input_str_list = get_stdin_str_list(str_line)\n input_str_multi_list.append(input_str_list)\n return input_str_multi_list\n\n\ndef get_stdin_int_multi_list(input_str=None):\n input_str_multi_list = get_stdin_str_multi_list(input_str)\n input_int_multi_list = list()\n for str_list in input_str_multi_list:\n input_int_list = list(map(int, str_list))\n input_int_multi_list.append(input_int_list)\n return input_int_multi_list\n\ndef get_most_far_pos_index_from_both_neighbors(pos_list):\n N = len(pos_list)\n max_distance = 0\n most_far_pos_index = 0\n for i, p in enumerate(pos_list):\n if i == 0:\n distance = pos_list[-1] + pos_list[i+1]\n elif i == N-1:\n distance = pos_list[i-1] + pos_list[0]\n else:\n distance = pos_list[i-1] + pos_list[i+1]\n \n if distance > max_distance:\n max_distance = distance\n most_far_pos_index = i\n \n return most_far_pos_index\n\ninput_list = get_stdin_int_multi_list()\nK, N = input_list[0]\nA = input_list[1]\nstart_i = get_most_far_pos_index_from_both_neighbors(A)\n\nif start_i == 0:\n far_neighbor_pos_distance = abs(A[start_i+1]-A[start_i]) if abs(A[start_i+1]-A[start_i]) > abs(A[start_i]-A[N-1]) else abs(A[start_i]-A[N-1])\nelif start_i == N-1:\n far_neighbor_pos_distance = abs(A[0]-A[start_i]) if abs(A[0]-A[start_i]) > abs(A[start_i]-A[start_i-1]) else abs(A[start_i]-A[start_i-1])\nelse:\n far_neighbor_pos_distance = abs(A[start_i+1]-A[start_i]) if abs(A[start_i+1]-A[start_i]) > abs(A[start_i]-A[start_i-1]) else abs(A[start_i]-A[start_i-1])\n\nshortest_distance = K - far_neighbor_pos_distance\nprint(shortest_distance)', '# coding: UTF-8\nimport os\n\ndef remove_empty(target_list: list):\n empty_removed_list = [x for x in target_list if x]\n return empty_removed_list\n\n\ndef get_stdin_str_list(input_str=None):\n if input_str is None:\n input_str = input()\n input_str = input_str.strip()\n input_str_list = input_str.split()\n return input_str_list\n\n\ndef get_stdin_int_list(input_str=None):\n input_str_list = get_stdin_str_list(input_str)\n input_int_list = list(map(int, input_str_list))\n return input_int_list\n\n\ndef get_stdin_str_multi_list(input_str=None):\n if input_str is None:\n input_str = input()\n input_str = input_str.strip()\n input_str_line_list = input_str.split("\\n")\n input_str_multi_list = list()\n for str_line in input_str_line_list:\n input_str_list = get_stdin_str_list(str_line)\n input_str_multi_list.append(input_str_list)\n return input_str_multi_list\n\n\ndef get_stdin_int_multi_list(input_str=None):\n input_str_multi_list = get_stdin_str_multi_list(input_str)\n input_int_multi_list = list()\n for str_list in input_str_multi_list:\n input_int_list = list(map(int, str_list))\n input_int_multi_list.append(input_int_list)\n return input_int_multi_list\n\ndef get_most_far_pos_index_from_both_neighbors(pos_list, end_pos_distance=None):\n if end_pos_distance is None:\n end_pos_distance = pos_list[-1]\n N = len(pos_list)\n max_distance = 0\n most_far_pos_index = 0\n for i, p in enumerate(pos_list):\n if i == 0:\n distance = end_pos_distance - pos_list[-1] + pos_list[i+1]\n elif i == N-1:\n distance = end_pos_distance - pos_list[i-1] + pos_list[0]\n else:\n distance = pos_list[i+1] - pos_list[i-1]\n \n if distance > max_distance:\n max_distance = distance\n most_far_pos_index = i\n\n return most_far_pos_index\n\ndef get_longest_interval(pos_list, end_pos_distance=None):\n if end_pos_distance is None:\n end_pos_distance = pos_list[-1]\n N = len(pos_list)\n longest_interval = 0\n\n for i, p in enumerate(pos_list):\n if i == N-1:\n pos_n_1 = end_pos_distance + pos_list[0]\n else:\n pos_n_1 = pos_list[i+1]\n\n interval = pos_n_1 - p\n\n if interval > longest_interval:\n longest_interval = interval\n\n return longest_interval\n\nK, N = get_stdin_int_list()\nA = get_stdin_int_list()\nlongest_interval = get_longest_interval(A, K)\nshortest_distance = K - longest_interval\nprint(shortest_distance)']
['Runtime Error', 'Accepted']
['s429126553', 's421091300']
[3192.0, 26444.0]
[18.0, 101.0]
[2472, 2541]
p02725
u274244155
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 C():\n kn=list(map(int,input().split()))\n A=list(map(int,input().split()))\n sum=0\n d=[]\n sum_ans=[]\n \n \n for i in range(kn[1]):\n \n if i==kn[1]-1:\n d.append(kn[0]-A[i])\n else:\n d.append(A[i+1]-A[i])\n \n \n for i in range(1,kn[1]):\n sum_ans.append(min(kn[0]-d[i],kn[0]-d[i-1]))\n \n print(min(sum_ans)) \n \n \nif __name__=='__main__':\n C()", "def C():\n kn=list(map(int,input().split()))\n A=list(map(int,input().split()))\n d=[]\n sum_ans=[]\n \n for i in range(kn[1]):\n \n if i==kn[1]-1:\n d.append(kn[0]-A[i])\n else:\n d.append(A[i+1]-A[i])\n \n \n sum_ans.append(A[kn[1]-1]-A[0])\n for i in range(1,kn[1]):\n sum_ans.append(min(kn[0]-d[i],kn[0]-d[i-1]))\n \n print(min(sum_ans)) \n \n \nif __name__=='__main__':\n C()"]
['Wrong Answer', 'Accepted']
['s248873208', 's763323665']
[26444.0, 26444.0]
[182.0, 185.0]
[441, 467]
p02725
u275577311
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()))\ndis = list(map(int, input().split()))\nlists = []\nfor i in range(KN[1]-1):\n lists.append(dis[i+1]-dis[i])\n\nlists.append(KN[0]+dis[0]-dis[KN[1]-1])\nprint(lists)\nprint(KN[0]-max(lists))', 'KN = list(map(int, input().split()))\ndis = list(map(int, input().split()))\nlists = []\nfor i in range(KN[1]-1):\n lists.append(dis[i+1]-dis[i])\n\nlists.append(KN[0]+dis[0]-dis[KN[1]-1])\nprint(KN[0]-max(lists))']
['Wrong Answer', 'Accepted']
['s542067219', 's236533393']
[26444.0, 26444.0]
[130.0, 116.0]
[222, 209]
p02725
u276894499
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['from collections import deque\nA = deque()\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nmax = 0\nfor i in range(N-1):\n if abs(A[i]-A[i+1]) > max:\n max = abs(A[i]-A[i+1])\nif abs(A[0]-(K-A[N-1])) > max:\n max = abs(A[0]-A[N-1])\nprint(K - max)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nmax = 0\nfor i in range(N-1):\n if abs(A[i]-A[i+1]) > max:\n max = abs(A[i]-A[i+1])\nif abs(A[0]+(K-A[N-1])) > max:\n max = abs(A[0]+(K-A[N-1]))\nprint(K - max)']
['Wrong Answer', 'Accepted']
['s929231667', 's084315640']
[25428.0, 25840.0]
[121.0, 114.0]
[274, 236]
p02725
u277312083
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()))\nd = (abs(a[n - 1] - 20) if a[0 == 0] else abs(a[n - 1] - a[0]))\nfor i in range(1, n):\n d = max(d, abs(a[i - 1] - a[i]))\nprint(k - d)\n', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\nd = k + a[0] - a[n - 1]\nfor i in range(1, n):\n d = max(d, a[i] - a[i - 1])\nprint(k - d)\n']
['Wrong Answer', 'Accepted']
['s429358072', 's307380634']
[25840.0, 25840.0]
[149.0, 138.0]
[205, 160]
p02725
u283683979
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
["a=a.split(' ')\nfor b in range(n):\n a[b]=int(a[b])\n\nm=0\nfor b in range(n-1):\n if m<=a[b+1]-a[b]:\n m=a[b+1]-a[b]\n\nif m<=k-a[n-1]+a[0]:\n m=k-a[n-1]+a[0]\n\nprint(k-m)", "k,n=map(int,input('').split())\na=input('')\na=a.split(' ')\nfor b in range(n):\n a[b]=int(a[b])\na.sort()\n\nm=0\nfor b in range(n-1):\n if m<=a[b+1]-a[b]:\n m=a[b+1]-a[b]\n\nif m<=k-a[n-1]+a[0]:\n m=k-a[n-1]+a[0]\n\nprint(k-m)"]
['Runtime Error', 'Accepted']
['s415153891', 's666010513']
[3060.0, 18636.0]
[18.0, 162.0]
[177, 229]
p02725
u283782321
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()))\nd = []\n\nfor i in range(N-1):\n d.append(A[i+1] - A[i])\nd.append((K - A[N-1]) + A[0])\n\nprint(d)\nd.remove(max(d))\nprint(sum(d))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nd = []\n\nfor i in range(N-1):\n d.append(A[i+1] - A[i])\nd.append((K - A[N-1]) + A[0])\n\nprint(d)\nd.remove(max(d))\nprint(sum(d))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nd = []\n\nfor i in range(N-1):\n d.append(A[i+1] - A[i])\nd.append((K - A[N-1]) + A[0])\n\nd.remove(max(d))\nprint(sum(d))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s366211710', 's439854357', 's389222654']
[26436.0, 26004.0, 26444.0]
[131.0, 135.0, 121.0]
[194, 194, 185]
p02725
u285265363
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):\n if M <= A[i] - A[i-1] :\n M = A[i] - A[i-1]\nans = K - M\nprint(ans)\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nM = 0\nfor i in range(N):\n if M <= A[i] - A[i-1] :\n M = A[i] - A[i-1]\n elif M <= K - A[N-1] + A[0]:\n M = K - A[N-1] + A[0]\nans = K - M\nprint(ans)']
['Wrong Answer', 'Accepted']
['s974126239', 's886187542']
[26444.0, 26444.0]
[132.0, 178.0]
[172, 234]
p02725
u288335507
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()))\ndmin = k - (a[n - 1] - a[0])\nfor i in range(n - 1):\n if (a[i + 1] - a[i]) < dmin:\n dmin = a[i + 1] - a[i]\nprint(k - dmin)', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\ndmax = k - (a[n - 1] - a[0])\nfor i in range(n - 1):\n if (a[i + 1] - a[i]) > dmax:\n dmax = a[i + 1] - a[i]\nprint(k - dmax)']
['Wrong Answer', 'Accepted']
['s143208081', 's962368830']
[26436.0, 26444.0]
[100.0, 105.0]
[200, 200]
p02725
u289053627
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 = [int(x) for x in input().split()]\n\nmax_distance = 0\nmax_distance_idx = 0\nfor i in range(0, N-1):\n dist = A_list[i+1]-A_list[i]\n if max_distance < dist:\n max_distance = dist\n max_distance_idx = i\n\nif max_distance <= (K-A_list[N-1]) + (A_list[0]):\n print(max_distance)\nelse:\n print((A_list[max_distance_idx]) + (K-A_list[max_distance_idx+1]))', 'K, N = [int(x) for x in input().split()]\nA_list = [int(x) for x in input().split()]\n\nif N <= 1:\n print(0)\n \nmax_distance = 0\nmax_distance_idx = 0\nfor i in range(0, N-1):\n dist = A_list[i+1]-A_list[i]\n if max_distance < dist:\n max_distance = dist\n max_distance_idx = i\n \nif max_distance <= (K-A_list[N-1]) + (A_list[0]):\n print(max_distance)\nelse:\n print((A_list[max_distance_idx]) + (K-A_list[max_distance_idx+1]))', 'K, N = [int(x) for x in input().split()]\nA_list = [int(x) for x in input().split()]\n\nmax_distance = 0\nmax_distance_idx = 0\nfor i in range(0, N-1):\n dist = A_list[i+1]-A_list[i]\n if max_distance < dist:\n max_distance = dist\n max_distance_idx = i\n\nif max_distance <= (K-A_list[N-1]) + (A_list[0]):\n print(A_list[N-1] - A_list[0])\nelse:\n print((A_list[max_distance_idx]) + (K-A_list[max_distance_idx+1]))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s028364329', 's387860331', 's093025786']
[26420.0, 26444.0, 26444.0]
[116.0, 116.0, 116.0]
[400, 425, 411]
p02725
u294385082
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()))\ntm = a[0]\na.append(tm)\nm = 11414114514\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()))\ntm = a[0]\na.append(tm)\nm = 11414114514\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()))\na.append(a[0])\nm = -9878789894545656\n \nfor i in range(n):\n m = max(m,a[i+1]-a[i])\n \nprint(k-m)', 'k,n = map(int,input(),split())\na = list(map(int,input().split()))\na += [a[0]]\nm = 11414114514\n\nfor i in range(n):\n m = min(m,a[i]-a[i+1])\n \nprint(k-m)', 'k,n = map(int,input(),split())\na = list(map(int,input().split()))\na.append(a[0])\nm = 11414114514\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()))\ntm = a[0]\na.append(tm)\nm = -9878789894545656\n \nfor i in range(n):\n m = max(m,a[i+1]-a[i])\n \nprint(k-m)', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\ntm = a[0]\na.append(tm)\nm = -9878789894545656\n \nfor i in range(n):\n m = max(m,a[i+1]-a[i])\n \nprint(k-m)', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\ntm = a[0]\na.append(tm)\nm = -9878789894545656\n \nfor i in range(n-1):\n m = max(m,a[i+1]-a[i])\n \nm = max(m,a[0]+k-a[n-1])\n \nprint(k-m)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s004875159', 's134936733', 's188694582', 's333622722', 's592737710', 's880395366', 's896715231', 's691049388']
[3060.0, 26420.0, 26444.0, 3060.0, 3060.0, 3064.0, 26060.0, 26436.0]
[17.0, 145.0, 138.0, 17.0, 17.0, 19.0, 170.0, 139.0]
[164, 164, 162, 152, 156, 170, 170, 200]
p02725
u297089927
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()))\nd=0\nfor i in range(N-1):\n if d == 0 and A[i+1]-A[0] >= K/2:\n d=d+A[i]-A[0]+K-A[i+1]-A[0]\nif d == 0:\n d=d+A[N-1]-A[0]\nprint(d)', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nList=[]\nfor i in range(N-1):\n b=A[i+1]-A[i]\n List.append(b)\nSL=sorted(List)\nprint(K-SL[-1])', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\nList=[]\nfor i in range(N):\n b=A[i]-A[i-1]\n if b < 0:\n b=K+b\n List.append(b)\nSL=sorted(List)\nprint(K-SL[-1])']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s066686860', 's276065296', 's277254460']
[26420.0, 26444.0, 26436.0]
[110.0, 148.0, 158.0]
[192, 155, 175]
p02725
u304593245
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\nK,N = list(map(int,input().split()))\nA = list(map(int,input().split()))\nA.append(K)\nB = []\nans = K\nfor i in range(N):\n B.append(abs(A[i]-A[i+1]))\n\nprint(K-max(B))\n', '\n\nK,N = list(map(int,input().split()))\nA = list(map(int,input().split()))\nA.append(K)\nB = []\nans = K\nfor i in range(N):\n B.append(abs(A[i]-A[i+1]))\nprint(B)\nprint(K-max(B))\n', '\n\nK,N = list(map(int,input().split()))\nA = list(map(int,input().split()))\nB = []\nfor i in range(N-1):\n B.append(abs(A[i+1]-A[i]))\nB.append(K+A[0]-A[-1])\n\nprint(K-max(B))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s025973310', 's734379245', 's742957475']
[32160.0, 32212.0, 32368.0]
[117.0, 130.0, 117.0]
[177, 176, 182]
p02725
u308914480
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['k,n=map(int,input().split())\nA=list(map(int,input().split()))\nA.append(K+A[0])\n\nfor i in range(n):\n l=max(A[i]-A[i-1])\n\nprint(K-l)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\na.append(k+a[0])\n \nfor i in range(1,n):\n l=max(a[i]-a[i-1])\n \nprint(k-l)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\na.append(k+a[0])\n\nfor i in range(1,n):\n l=max(a[i]-a[i-1])\n\nprint(K-l)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\na.append(k+a[0])\n\nl=0\nfor i in range(1,n+1):\n l=max(l,a[i]-a[i-1])\n \nprint(k-l)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s172803545', 's599009222', 's798855012', 's416176366']
[32172.0, 32280.0, 32180.0, 32360.0]
[70.0, 68.0, 71.0, 134.0]
[131, 135, 133, 142]
p02725
u309120194
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\nK.append(A[0]+K)\nl = K+1\nfor i in range(N):\n l = min(l, A[i+1]-A[i])\n\nprint(K-l)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n \nfor i in range(N):\n if A[i] >= K/2: A[i] -= K\n\nprint(max(A) - min(A))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n \nfor i in range(N):\n if A[i] >= K/2: A[i] -= K\n \nprint(max(A) - min(A))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\n\n\n\n\n\nA.append(A[0]+K)\nl = 0\nfor i in range(N):\n l = max(l, A[i+1]-A[i])\n\nans = K -l\nprint(ans)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s395293240', 's705154306', 's964256631', 's383712563']
[24464.0, 32228.0, 32192.0, 32228.0]
[44.0, 109.0, 108.0, 124.0]
[151, 149, 153, 493]
p02725
u311176548
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(' ')))\nk=0\nAnew=[]\nfor i in range(1,N):\n Anew.append(A[i]-A[i-1])\nprint(K-max(Anew))", "K,N=list(map(int,input().split(' ')))\nA=list(map(int,input().split(' ')))\nk=0\nAnew=[]\nfor i in range(1,N):\n Anew.append(abs(A[i]-A[i-1]))\nprint(K-max(Anew))", "K,N=list(map(int,input().split(' ')))\nA=list(map(int,input().split(' ')))\nk=0\nAnew=[]\nfor i in range(1,N):\n Anew.append(abs(A[i]-A[i-1]))\nAnew.append(abs(K-A[-1]+A[0]))\nprint(Anew)\nprint(K-max(Anew))", "K,N=list(map(int,input().split(' ')))\nA=list(map(int,input().split(' ')))\nk=0\nAnew=[]\nfor i in range(1,N):\n Anew.append(abs(A[i]-A[i-1]))\nAnew.append(abs(K-A[-1]+A[0]))\nprint(K-max(Anew))"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s339273391', 's769877670', 's824617004', 's343498101']
[26436.0, 26444.0, 26420.0, 26420.0]
[118.0, 123.0, 136.0, 126.0]
[154, 159, 202, 190]
p02725
u311928787
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.stsin.readlines()\nK, N = map(int, lines[0].srtip().split())\nAs = map(int, lines[1].strip().split())\n\ndiffs =[]\nfor base, switch in zip(arr[:-1], arr[1:]):\n diffs append(switch-base)\n\ndiffs append(arr[0]+K-arr[-1])\n\nprint(K-max(diffs))', 'K, N = list(map(int, input().srtip().split()))\nAs = list(map(int, input().strip().split()))\n \ndiffs =[]\nfor base, switch in zip(arr[:-1], arr[1:]):\n diffs.append(switch-base)\n\ndiffs.append(arr[0]+K-arr[-1])\n \nprint(K-max(diffs))', 'K, N = list(map(int, input().srtip().split()))\nAs = list(map(int, input().strip().split()))\n \ndiffs =[]\nfor base, switch in zip(As[:-1], As[1:]):\n diffs.append(switch-base)\n \ndiffs.append(As[0]+K-As[-1])\n \nprint(K-max(diffs))', 'import sys\nlines = sys.stsin.readlines()\nK, N = list(map(int, lines[0].srtip().split()))\nAs = list(map(int, lines[1].strip().split()))\n \ndiffs =[]\nfor base, switch in zip(arr[:-1], arr[1:]):\n diffs.append(switch-base)\n\ndiffs.append(arr[0]+K-arr[-1])\n \nprint(K-max(diffs))', 'import sys\nlines = sys.stsin.readlines()\nK, N = map(int, lines[0].srtip().split())\nAs = map(int, lines[1].strip().split())\n\ndiffs =[]\nfor base, switch in zip(arr[:-1], arr[1:]+[0]):\n diffs append(switch-base)\n\ndiffs append(arr[0]+K-arr[-1])\n\nprint(K-max(diffs))', 'import sys\nlines = sys.stsin.readlines()\nK, N = map(int, lines[0].srtip().split())\nAs = map(int, lines[1].strip().split())\n\nrange = max(As)-min(As)\n\nif range*2<K:\n print(range)\nelse:\n print(K-range)', 'import sys\nlines = sys.stsin.readlines()\nK, N = list(map(int, lines[0].srtip().split()))\nAs = list(map(int, lines[1].strip().split()))\n\ndiffs =[]\nfor base, switch in zip(arr[:-1], arr[1:]):\n diffs.append(switch-base)\n\ndiffs.append(arr[0]+K-arr[-1])\n\nprint(K-max(diffs))', 'K, N = list(map(int, input().split()))\nAs = list(map(int, input().split()))\ndiffs =[]\nfor base, switch in zip(As[:-1], As[1:]):\n diffs.append(switch-base)\ndiffs.append(As[0]+K-As[-1])\nprint(K-max(diffs))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s042330427', 's424111554', 's465785759', 's471715706', 's545482678', 's598977323', 's660133411', 's224509652']
[2940.0, 3060.0, 3060.0, 3064.0, 2940.0, 3060.0, 3064.0, 26420.0]
[17.0, 18.0, 17.0, 17.0, 19.0, 17.0, 18.0, 104.0]
[258, 229, 226, 272, 262, 200, 270, 204]
p02725
u313317027
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['import numpy as np\n\nk, n = map(int,input().split())\na_list = list(map(int, input().split()))\n\na_list.append(k)\n\nans_list = np.diff(a_list)\n\nif max(ans_list) == ans_list[-1]:\n print(sum(ans_list) - max(ans_list) - a_list[0])\nelif max(ans_list) == ans_list[0]:\n print(sum(ans_list) - max(ans_list) - ans_list[-1])\nelse:\n print(sum(ans_list) - max(ans_list))', 'import numpy as np\n\nk, n = map(int,input().split())\na_list = list(map(int, input().split()))\n\na_list.append(k+a_list[0])\n\nans_list = np.diff(a_list)\n\nprint(sum(ans_list) - max(ans_list))\n']
['Wrong Answer', 'Accepted']
['s360795066', 's948239200']
[34156.0, 41556.0]
[325.0, 1260.0]
[364, 187]
p02725
u314312196
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()))\nan = list(map(int,input().split()))\n\nmin_list = []\nfor i in range(N):\n if i == 0:\n left = an[i] + K - an[-1]\n right = an[i+1] - an[i]\n elif i == N-1:\n left = an[i] - an[i-1]\n right = an[0] + K - an[N-1]\n else:\n left = an[i] - an[i-1]\n right = an[i+1] - an[i]\n min_list.append(min(K-left, K-right))\nprint(min(n_list))', 'K, N = list(map(int, input().split()))\nan = list(map(int,input().split()))\n\nmin_list = []\nfor i in range(N):\n if i == 0:\n left = an[i] + K - an[-1]\n right = an[i+1] - an[i]\n elif i == N-1:\n left = an[i] - an[i-1]\n right = an[0] + K - an[N-1]\n else:\n left = an[i] - an[i-1]\n right = an[i+1] - an[i]\n min_list.append(min(K-left, K-right))\nprint(min(min_list))\n']
['Runtime Error', 'Accepted']
['s689076929', 's654651666']
[26444.0, 26444.0]
[261.0, 260.0]
[409, 412]
p02725
u314837274
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['k,n=map(int,input().split())\na=list(map(int,input().split()))\n\nans=0\nif max(a)<=k/2.0 or min(a)>=k/2.0:\n for i in range(n):\n ans+=abs(a[i+1]-a[i])\nelse:\n for i in range(n):\n if a[i]>k/2.0:\n a[i]-=k\n else:\n j=i\n for i in range(j):\n ans+=abs(a[i+1]-a[i])\n ans+=abs(a[n]-a[0])\n for i in range(j+1,n):\n ans+=abs(a[i+1]-a[i])\nprint(ans)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\n\nans=0\nif max(a)<=(k/2.0) or min(a)>=(k/2.0):\n for i in range(n-1):\n ans+=abs(a[i+1]-a[i])\nelse:\n for i in range(n):\n if a[i]>k/2.0:\n a[i]-=k\n else:\n j=i\n for i in range(j):\n ans+=abs(a[i+1]-a[i])\n ans+=abs(a[n]-a[0])\n for i in range(j+1,n-1):\n ans+=abs(a[i+1]-a[i])\nprint(ans)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\n\nans=0\nif max(a)<=(k/2.0) or min(a)>=(k/2.0):\n for i in range(n-1):\n ans+=abs(a[i+1]-a[i])\nelse:\n for i in range(n):\n if a[i]>k/2.0:\n a[i]-=k\n else:\n j=i\n for i in range(j):\n ans+=abs(a[i+1]-a[i])\n ans+=abs(a[n-1]-a[0])\n for i in range(j+1,n-1):\n ans+=abs(a[i+1]-a[i])\nprint(ans)', 'k,n=map(int,input().split())\na=list(map(int,input().split()))\n\nans=0\nif max(a)<=(k/2.0) or min(a)>=(k/2.0):\n for i in range(n-1):\n ans+=abs(a[i+1]-a[i])\nelse:\n max_=0\n for i in range(n-1):\n max_=max(max_,abs(a[i+1]-a[i]))\n max_=max(max_,abs(a[0]-(a[n-1]-k)))\n ans=k-max_\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s036316605', 's197595416', 's773687481', 's249779701']
[26444.0, 26444.0, 26444.0, 26444.0]
[180.0, 173.0, 198.0, 164.0]
[362, 370, 372, 292]
p02725
u316233444
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(int(i) for i in input().split())\nA.append(A[0])\n#print(A)\n\na=[]\nfor i in range(N-1):\n a.append(abs(A[i]-A[i+1]))\n #print(a)\na.append(abs(K-A[N-1]))\nprint(a)\n\na.remove(max(a)) \nans=sum(a)\nprint(ans)\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\nA.append(A[0]+K)\ndif = 0\nfor i in range(1, N+1):\n dif = max(dif, A[i] - A[i-1])\n print(dif)\nprint(K-dif)\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\nA.append(A[0]+K)\ndif = 0\nfor i in range(1, N+1):\n dif = max(dif, A[i] - A[i-1])\n #print(dif)\nprint(K-dif)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s306239890', 's864173925', 's204204973']
[26444.0, 26188.0, 26100.0]
[151.0, 288.0, 143.0]
[276, 186, 187]
p02725
u319311571
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(' ')))\nt = 0\nid = 0\nl = 0\nfor i in range(n):\n if i < n - 1:\n d = abs(a[i] - a[i + 1])\n else:\n d = k - a[n - 1] + a[0]\n if t < d:\n t = d\n id = i + 1 if i < n - 1 else 0\nfor i in range(n - 1):\n l += abs(a[(i + id) % n] - a [(i + id + 1) % n]) if i + id + 1 < n - 1 else k - a[n - 1] + a[0]\nprint(l)", "k, n = map(int, input().split(' '))\na = list(map(int, input().split(' ')))\nt = 0\nid = 0\nl = 0\nfor i in range(n):\n if i < n - 1:\n d = abs(a[i] - a[i + 1])\n else:\n d = k - a[n - 1] + a[0]\n if t < d:\n t = d\n id = i + 1 if i < n - 1 else 0\nfor i in range(n - 1):\n l += abs(a[(i + id) % n] - a [(i + id + 1) % n]) if i + id != n - 1 else k - a[n - 1] + a[0]\nprint(l)"]
['Wrong Answer', 'Accepted']
['s139602177', 's562901729']
[26444.0, 26444.0]
[267.0, 257.0]
[404, 401]
p02725
u320511454
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()))\nsales=list(map(int,input().split()))\nsales.append(sales[0]+k)\nmax_dis=0\nfor i in range(n):\n max_dis=max(max_dis,sales[i+1]-sales[i])\n print(max_dis)\n\nprint(k-max_dis)', 'k,n=list(map(int,input().split()))\nsales=list(map(int,input().split()))\nsales.append(sales[0])\nmax_dis=0\nfor i in range(n):\n max_dis=max(max_dis,sales[i+1]-sales[i])\n\nprint(k-max_dis)', 'k,n=list(map(int,input().split()))\nsales=list(map(int,input().split()))\nsales.append(sales[0]+k)\nmax_dis=0\nfor i in range(n):\n max_dis=max(max_dis,sales[i+1]-sales[i])\n\nprint(k-max_dis)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s476622618', 's540848132', 's811057261']
[25840.0, 26444.0, 26444.0]
[301.0, 148.0, 161.0]
[203, 184, 186]
p02725
u328755070
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()\nB = []\n\n\nfor i in range(N-1):\n B.append(K - A[i+1] + A[i])\nB.append(A[N-1] + A[0])\n\nprint(min(B))\n\n\n\n\n\n\n', 'K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = []\n\n\nfor i in range(N-1):\n B.append(K - A[i+1] + A[i])\nB.append(A[N-1] - A[0])\n\nprint(min(B))\n\n\n\n\n\n\n']
['Wrong Answer', 'Accepted']
['s414004458', 's473853002']
[26436.0, 26444.0]
[135.0, 131.0]
[191, 182]
p02725
u332386346
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 -*-\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nA.append(A[0])\n\ndistance_max = 0\nfor i in range(N):\n if distance_max < A[i+1] - A[i]:\n distance_max = A[i+1] - A[i]\n\nprint(K-distance_max)\n \n', '# -*- coding: utf-8 -*-\nK, N = map(int, input().split())\nA = list(map(int, input().split()))\nA.append(A[0]+K)\n\ndistance_max = 0\nfor i in range(N):\n if distance_max < A[i+1] - A[i]:\n distance_max = A[i+1] - A[i]\n\nprint(K-distance_max)\n \n']
['Wrong Answer', 'Accepted']
['s945503834', 's212242119']
[26444.0, 26444.0]
[103.0, 105.0]
[251, 253]
p02725
u335012204
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()]\n\nA.append(K + A[0])\nprint(A)\nA_sub = []\n\nfor i in range(len(A)-1):\n A_sub.append(abs(A[i] - A[i + 1]))\n# print(A_sub)\nprint(sum(A_sub) - max(A_sub))', 'K,N=(int(x) for x in input().split())\nA =[int(x) for x in input().split()]\n\nA.append(K + A[0])\n# print(A)\nA_sub = []\n\nfor i in range(len(A)-1):\n A_sub.append(abs(A[i] - A[i + 1]))\n# print(A_sub)\nprint(sum(A_sub) - max(A_sub))']
['Wrong Answer', 'Accepted']
['s188038551', 's573298573']
[26444.0, 26436.0]
[150.0, 138.0]
[226, 228]
p02725
u335950809
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()))\n\nll = l[:]\n\nll.append(k)\nll.pop(0)\ns = []\n\nfor i,j in zip(l,ll):\n s.append(j - i)\n\nprint(k - max(s))', 'k,n = map(int,input().split())\nl = list(map(int,input().split()))\n\ns = []\n\nfor i,j in zip(l[1:],l):\n s.append(i-j)\n\ns.append(k + l[0] - l[-1])\n\nprint(k - max(s))\n']
['Wrong Answer', 'Accepted']
['s228191961', 's019983700']
[26444.0, 26420.0]
[112.0, 111.0]
[169, 165]
p02725
u336564899
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\nindex = 0\n\nfor i in range(n-1):\n if x < a[i+1] - a[i]:\n x = a[i+1] - a[i]\n index = i\n\nif x < k-a[-1]+a[0]:\n x = k-a[-1]+a[0]\n\nprint(k - x,k, x,k-a[-1]+a[0])\n', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\n\nx = 0\nindex = 0\n\nfor i in range(n-1):\n if x < a[i+1] - a[i]:\n x = a[i+1] - a[i]\n index = i\n\nif x < k-a[-1]+a[0]:\n x = k-a[-1]+a[0]\n\nprint(k - x)\n']
['Wrong Answer', 'Accepted']
['s450556412', 's044565844']
[26444.0, 26444.0]
[103.0, 104.0]
[254, 235]
p02725
u337573893
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\nc = abs(A[1] - A[N-1])\n\nfor i in range(N-1):\n d = abs(A[i] - A[i+1])\n if c < d:\n c = d\n else:\n c = c\n \nprint(K-c)', 'K, N = map(int, input().split())\n\nA = list(map(int, input().split()))\n\nc = abs(K - A[N-1] + A[0])\n\nfor i in range(N-1):\n d = abs(A[i] - A[i+1])\n if c < d:\n c = d\n else:\n c = c\n \nprint(K-c)']
['Wrong Answer', 'Accepted']
['s756651904', 's279350992']
[32136.0, 32264.0]
[125.0, 124.0]
[196, 200]
p02725
u345132740
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()\nn=0\nm=1\nS=list()\nfor i in range(int(N)-1):\n S.append(int(A[n+1])-int(A[n]))\n n=n+1\nS.append(int(A[0])+(int(K)-int(A[-1])))\n\nans=int(K)-int(max(S))\nprint(ans)\nprint(S)\n', 'K,N=input().split()\nA=input().split()\nn=0\nm=1\nS=list()\nfor i in range(int(N)-1):\n S.append(int(A[n+1])-int(A[n]))\n n=n+1\nS.append(int(A[0])+(int(K)-int(A[-1])))\n\nans=int(K)-int(max(S))\nprint(ans)']
['Wrong Answer', 'Accepted']
['s827074104', 's455138523']
[20660.0, 20148.0]
[199.0, 205.0]
[207, 197]
p02725
u346207191
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,M=(int(x) for x in input().split())\nA=list(map(int, input().split()))\nA=np.array(A)\nB=A[1:]-A[:-1]\nb=max(B)\nc=A[-1]-A[0]\nif c > N/2:\n c=int(c-N/2)\nelse:\n c=c\nd=max(b,c)\nprint(N-d)', 'import numpy as np\n\nN,M=(int(x) for x in input().split())\nA=list(map(int, input().split()))\nA=np.array(A)\nB=A[1:]-A[:-1]\nb=max(B)\nc=A[-1]-A[0]\nif c > N/2:\n d=int(N-c)\nelse:\n d=c\ne=max(b,d)\nf=N-e\n\nprint(f)\n']
['Runtime Error', 'Accepted']
['s853909557', 's253226473']
[26444.0, 34160.0]
[65.0, 230.0]
[187, 211]
p02725
u346308892
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.
['\nimport numpy as np\nfrom functools import *\nimport sys\nsys.setrecursionlimit(100000)\n\n\n\ndef acinput():\n return list(map(int, input().split(" ")))\n\n\ndef II():\n return int(input())\n\nK,N=acinput()\n\nA=acinput()\nA.append(A[0]+K)\nB=np.array(A)+K\n\na=np.array(A)\n\nprint(K-np.max(a[1:]-a[:-1]))\n\n\n\nprint(2*np.pi*K-np.max(a[1:]-a[:-1]))\n\nprint(a)\nprint(a[1:]-a[:-1])\n\n', '\nimport numpy as np\nfrom functools import *\nimport sys\nsys.setrecursionlimit(100000)\n\n\n\ndef acinput():\n return list(map(int, input().split(" ")))\n\n\ndef II():\n return int(input())\n\nK,N=acinput()\n\nA=acinput()\nA.append(A[0]+K)\nB=np.array(A)+K\n\na=np.array(A)\n\nprint(K-np.max(a[1:]-a[:-1]))\n']
['Wrong Answer', 'Accepted']
['s222640221', 's425760955']
[43176.0, 42848.0]
[1672.0, 1560.0]
[376, 304]
p02725
u346812984
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\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n K, N = map(int, input().split())\n A = list(map(int, input().split()))\n\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n print(min(ans), A[-1] - A[0])\n', 'import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n K, N = map(int, input().split())\n A = list(map(int, input().split()))\n\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n print(min(ans), A[-1] - A[0])\n\n\nmain()\n', 'import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n K, N = map(int, input().split())\n A = list(map(int, input().split()))\n\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n print(min(min(ans), A[-1] - A[0]))\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s043048515', 's761098038', 's573233048']
[2940.0, 25840.0, 25840.0]
[18.0, 102.0, 97.0]
[245, 254, 290]
p02725
u347600233
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 + a[0]]\nprint(k - max([a[i + 1] - a[i] for i in range(n)]))', 'k, n = map(int, input().split())\na = list(map(int, input().split())) + [k + a[0]]\nprint(k - max([a[i + 1] - a[i] for i in range(n)]))', 'k, n = map(int, input().split())\na = list(map(int, input().split())) + [n]\nprint(n - sum([a[i + 1] - a[i] for i in range(n)]))', 'k, n = map(int, input().split())\na = list(map(int, input().split())) + [k + a[0]]\nprint(k - max([a[i + 1] - a[i] for i in range(n)]))', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\na += [k + a[0]]\nprint(k - max([a[i + 1] - a[i] for i in range(n)]))']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s169821692', 's286460757', 's629361380', 's633339203', 's002827840']
[32372.0, 32356.0, 32240.0, 32324.0, 32388.0]
[67.0, 70.0, 98.0, 67.0, 95.0]
[133, 133, 126, 133, 136]
p02725
u347640436
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)\nmaxD = 0\nfor n in range(N):\n maxD = min(maxD, A[n+1] - A[n])\nprint(K-maxD)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nA.append(A[0]+K)\nmaxD = 0\nfor n in range(N):\n maxD = max(maxD, A[n+1] - A[n])\nprint(K-maxD)']
['Wrong Answer', 'Accepted']
['s962989022', 's483403062']
[26420.0, 26420.0]
[154.0, 133.0]
[161, 161]
p02725
u349296334
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()\nmax = 0\nfor i in range(len(a)):\n d = a[i]-a[i-1]\n if d>max:\n max=d\nprint(k-max)', 'k, n = input().split()\na = input().split()\nmax = 0\nfor i in range(len(a)):\n if i==0:\n continue\n d = a[i]-a[i-1]\n if d>max:\n max=d\nprint(k-max)', 'k, n = input().split()\na = input().split()\nmax = 0\nfor i in range(len(a)):\n if i==0:\n continue\n d = int(a[i])-int(a[i-1])\n if d>max:\n max=d\nprint(k-max)', 'k, n = input().split()\na = input().split()\nmax = 0\nfor i in range(0,len(a)):\n if i==0:\n max = int(k)-int(a[len(a)-1])+int(a[0])\n d = int(a[i])-int(a[i-1])\n if d>max:\n max=d\nprint(int(k)-max)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s033124810', 's485334468', 's893482774', 's451076108']
[18356.0, 18508.0, 18036.0, 18356.0]
[37.0, 37.0, 167.0, 164.0]
[135, 165, 175, 213]
p02725
u350093546
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()))\nfor i in a:\n i+=k\nprint(k-max(a)+min(a))', '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]+a[0])\nprint(k-ans)']
['Wrong Answer', 'Accepted']
['s200524504', 's506459628']
[26444.0, 32232.0]
[92.0, 124.0]
[103, 154]
p02725
u350412774
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.
['kp = list(map(int, input().rsplit()))\nA = list(map(int, input().rsplit()))\nmax_range = kp[0]-A[-1]+A[0]\nfor idx in range(len(A)):\n dif = A[idx+1]-A[idx] \n if dif >max_range:\n max_range = dif\n\nprint(kp[0] - max_range)\n ', 'kp = list(map(int, input().rsplit()))\nA = list(map(int, input().rsplit()))\nmax_range = kp[0]-A[-1]+A[0]\nfor idx in range(len(A)-1):\n dif = A[idx+1]-A[idx] \n if dif >max_range:\n max_range = dif\n \nprint(kp[0] - max_range)']
['Runtime Error', 'Accepted']
['s973339143', 's037703675']
[26444.0, 25840.0]
[113.0, 108.0]
[224, 224]
p02725
u362563655
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 A:\n B[i]=A[i+1]-A[i]\n \nB[N-1]=A[0]+K-A[N-1]\n\nprint(K-max(B))\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = [0] * N\nfor i in range(0, N-1):\n if i < N-1:\n B[i]=A[i+1]-A[i]\n else:\n B[N-1] = A[0] + K - A[N-1]\n\nprint(K-max(B))\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = [A[i+1]-A[i] for i in A if i < N]\nB[N-1]=A[0]+K-A[N-1]\n\nprint(K-max(B))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = [0] * N\nfor i in range[0, N-1]:\n if i < N-1:\n B[i]=A[i+1]-A[i]\n else:\n B[N-1] = A[0] + K - A[N-1]\n\nprint(K-max(B))\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = [0] * N\ncount = 0\nfor i in A:\n count += 1\n if count < N:\n B[i]=A[i+1]-A[i]\n else:\n B[N-1] = A[0] + K - A[N-1]\n\nprint(K-max(B))\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = [0] * N\nfor i in A if i < N-1:\n B[i]=A[i+1]-A[i]\n\nB[N-1] = A[0] + K - A[N-1]\n\nprint(K-max(B))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = [0] * N\ncount = 0\nfor i in A:\n count += 1\n if count != N:\n B[i]=A[i+1]-A[i]\n else:\n B[N-1] = A[0] + K - A[N-1]\n\nprint(K-max(B))\n', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = []\nwhile all(a< N-1 for a in A):\n B.append(A[a+1]-A[a])\n\nB.append(A[1]+K-A[a])\n\nprint(K-max(B))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = []\nfor a in A:\n if a < N:\n B.append(A[a+1]-A[a])\n else:\n B.append(A[1]+K-A[a])\n\nprint(K-max(B))', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = [0] * N\nk = 0\nfor i in A:\n k += 1\n if k != N:\n B[k-1]=A[k]-A[k-1]\n else:\n B[N-1] = A[0] + K - A[N-1]\n\nprint(K-max(B))\n']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s006318179', 's064180915', 's258360079', 's360537367', 's454382219', 's530595674', 's564361158', 's819765064', 's966332423', 's658661356']
[25452.0, 26548.0, 25840.0, 26060.0, 26444.0, 2940.0, 26444.0, 26444.0, 26436.0, 26060.0]
[84.0, 128.0, 86.0, 68.0, 94.0, 18.0, 91.0, 72.0, 89.0, 148.0]
[153, 196, 144, 196, 209, 167, 210, 169, 176, 200]
p02725
u366795445
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['k, n = map(int, input().split())\na = list(map(int, input().split()))\na.append(k)\n\ns = 0\nfor i in range(n):\n s += a[i + 1] - a[i]\nans = s\nfor i in range(n):\n ans = min(ans, s - a[i + 1] - a[i])\n\nprint(ans)', 'k, n = map(int, input().split())\na = list(map(int, input().split()))\na.append(a[0] + k)\n\nans = k\nfor i in range(n):\n ans = min(ans, k - a[i + 1] + a[i])\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s640052096', 's856079358']
[26420.0, 26436.0]
[211.0, 159.0]
[210, 167]
p02725
u366836739
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\nimport itertools\n\nk, n = map(int, input().split())\na = list(map(int, input().split()))\nmax = 0\n\nfor i in range(1,n):\n l = a[i] - a[i-1]\n if l < 0:\n l += 20\n if l > max:\n max = l\nprint(k - max)', '# coding: utf-8\nk, n = map(int, input().split())\na = list(map(int, input().split()))\nmax = 0\n\nfor i in range(n-1):\n l = a[i+1] - a[i]\n if l > max:\n max = l\nl = a[0] - a[n-1] + k\nif l > max:\n max = l\nprint(k - max)']
['Wrong Answer', 'Accepted']
['s452953869', 's355711646']
[26444.0, 26436.0]
[123.0, 111.0]
[231, 229]
p02725
u369502636
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()))\naa = a + a\n\nfor j in range(n,2*n):\n aa[j] = aa[j] + k\n\ndis = k\n\nfor i in range((2*n)-1):\n tonari = aa[i+1]-aa[i]\n dis = min(dis,k-tonari)\n\nprint(dis)\nprint(aa)', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\naa = a\n\nfor j in range(n):\n aa[j] = aa[j] + k\n\naaa = a + aa\ndis = k\n\nfor i in range((2*n)-1):\n short = aaa[i+1]-aaa[i]\n dis = min(dis,k-short)\n\nprint(dis)', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\naa = a + a\n\nfor j in range(n,2*n):\n aa[j] = aa[j] + k\n\ndis = k\n\nfor i in range((2*n)-1):\n tonari = aa[i+1]-aa[i]\n dis = min(dis,k-tonari)\n\nprint(dis)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s077292305', 's308716175', 's582412145']
[34648.0, 32220.0, 32064.0]
[285.0, 239.0, 250.0]
[234, 229, 224]
p02725
u370331385
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
["K,N = map(int,input().split())\nA = list(map(int,input().split()))\nB = [] \nfor i in range(N-1):\n tmp = A[i+1]-K\n B.append(tmp)\nB.extend(A)\n\n\ntmp_sum = 0\nj = 0\n\ndist = []\nfor i in range(1,len(B)):\n d = abs(B[i]-B[i-1])\n tmp_sum += d\n dist.append(d)\n if(i == N-1):\n ans = tmp_sum \n print('ans :',ans)\n elif(i >= N):\n tmp_sum -= dist[j]\n j += 1\n ans = min(ans,tmp_sum)\n print('ans :',ans)\nprint(ans) \n ", 'K,N = map(int,input().split())\nA = list(map(int,input().split()))\nB = [] \nfor i in range(N-1):\n tmp = A[i+1]-K\n B.append(tmp)\nB.extend(A)\n\n\ntmp_sum = 0\nj = 0\n\ndist = []\nfor i in range(1,len(B)):\n d = abs(B[i]-B[i-1])\n tmp_sum += d\n dist.append(d)\n if(i == N-1):\n ans = tmp_sum \n \n elif(i >= N):\n tmp_sum -= dist[j]\n j += 1\n ans = min(ans,tmp_sum)\n \nprint(ans) \n ']
['Wrong Answer', 'Accepted']
['s239523013', 's372549122']
[30400.0, 27920.0]
[675.0, 447.0]
[449, 451]
p02725
u374082254
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 samax_index(A):\n samax = 0\n max_i = 0\n prev_v = 0\n for i, v in enumerate(A):\n if samax <= (v - prev_v):\n max_i = i\n samax = v - prev_v\n prev_v = v\n return max_i\n\n\ndef distance(A, start_i, N):\n print(start_i)\n if (start_i == 0) or ((start_i + 1) == N):\n total = A[start_i] - A[1]\n else:\n total = A[start_i]\n total += A[-1] - A[start_i + 1]\n\n print(total)\n\n\nK, N = map(int, input().split())\n\nA = list(map(int, input().split()))\nA.append(K)\nA.insert(0, 0)\nstart_i = samax_index(A) - 1\n\n\ndistance(A, start_i, N)\n', 'K, N = map(int, input().split())\n\nA = list(map(int, input().split()))\n\nS = []\nfor i in range(1, N):\n S.append(A[i] - A[i-1])\nS.append(A[0]-A[-1] + K)\n\nprint(K - max(S))\n']
['Wrong Answer', 'Accepted']
['s527577252', 's047644771']
[26444.0, 26060.0]
[91.0, 116.0]
[596, 172]
p02725
u376754170
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())\nhome_positions = list(map(int, input().split()))\n\n\ndef max_distance_homes(homes):\n max_distance = 0\n for i in range(len(homes) - 1):\n distance = homes[i + 1] - homes[i]\n if max_distance < distance:\n max_distance = distance\n distance = max(homes[-1] - homes[0], k + homes[0] - homes[-1])\n if max_distance < distance:\n max_distance = distance\n return max_distance', 'k, n = map(int, input().split())\nhome_positions = list(map(int, input().split()))\n\n\ndef max_distance_homes(homes):\n max_distance = 0\n for i in range(len(homes) - 1):\n distance = homes[i + 1] - homes[i]\n if max_distance < distance:\n max_distance = distance\n distance = k + homes[0] - homes[-1]\n if max_distance < distance:\n max_distance = distance\n return max_distance\n\n\nprint(k - max_distance_homes(home_positions))']
['Wrong Answer', 'Accepted']
['s900266449', 's288650877']
[26444.0, 26444.0]
[70.0, 88.0]
[441, 462]
p02725
u379142263
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 collections\nimport sys\nimport numpy as np\nsys.setrecursionlimit(1000000000)\n\n\nk,n = map(int,input().split())\na = list(map(int,input().split()))\nd = k//2\naright = []\naleft = []\nfor i in range(len(a)):\n if a[i]>d:\n a[i] -= d\ndiff = []\nfor i in range(len(a)-1):\n d2 = a[i+1]-a[i]\n diff.append(abs(d2))\nprint(sum(a))\n\n\n', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\n\ndistance = []\nfor i in range(len(a)-1):\n d = abs(a[i+1]-a[i])\n distance.append(d)\na = sum(distance)\ndistance.append(k-a)\nprint(sum(distance)-max(distance))']
['Wrong Answer', 'Accepted']
['s408263583', 's762825395']
[34128.0, 26100.0]
[295.0, 131.0]
[359, 256]
p02725
u381585104
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['k,n=map(int,input().split())\na = list(map(int,input().split()))\na.append(k-a[-1]+a[0])\nprint(sum(a)-max(a))', 'k,n=map(int,input().split())\na = list(map(int,input().split()))\ns = []\nfor i in range(n-1):\n s.append(abs(a[i+1] - a[i]))\ns.append(k-a[-1]+a[0])\nprint(k-max(s))']
['Wrong Answer', 'Accepted']
['s149024927', 's280710087']
[32380.0, 32216.0]
[75.0, 115.0]
[107, 161]
p02725
u382639013
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_d = 0\nfor i in range(0, N-1):\n if A[i] == 0:\n pass\n else:\n d = abs(A[i] - A[len(A)-1])\n max_d = max(d, max_d)\n\nprint(k - max_d)', 'K, N = map(int, input().split())\nA = list(map(int, input().split())) \n\nA.append(K)\nd = list()\nfor i in range(0, N):\n d.append(abs(A[i] - A[i+1]))\n\nprint(d)\nprint(sum(d) - max(d))', 'K, N = map(int, input().split())\nA = list(map(int, input().split())) \n\nA.append(K+A[0])\nd = list()\nfor i in range(0, N):\n d.append(abs(A[i] - A[i+1]))\n\n#print(A)\n#print(d)\nprint(sum(d) - max(d))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s057475945', 's606761668', 's678391233']
[26444.0, 25580.0, 26420.0]
[187.0, 142.0, 129.0]
[229, 181, 197]
p02725
u384379887
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 = input().split()\nfor i in range(0, len(A)):\n A[i] = int(A[i])\n\ndist = []\nfor i in range(0, len(A)-1):\n dist.append(A[i+1]-A[i])\ndist.append(A[len(A)-1]-A[0])\nprint(dist)\n\nprint(K-max(dist))\n', 'K, N = map(int, input().split())\nA = input().split()\nfor i in range(0, len(A)):\n A[i] = int(A[i])\n\ndist = []\nfor i in range(0, len(A)-1):\n dist.append(A[i+1]-A[i])\ndist.append((K - A[len(A)-1]) + A[0])\n\nprint(K - max(dist))\n']
['Wrong Answer', 'Accepted']
['s350536441', 's369033082']
[20812.0, 21400.0]
[161.0, 148.0]
[232, 230]
p02725
u385873134
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\nsub = A[1] - A[0]\nmax = N * sub\nsub_2 = K - max\n\nprint('sub : ' + str(sub))\nprint('sub2 : ' + str(sub_2))\n\nif sub_2 >= sub:\n print(sub * (N - 1))\nelse:\n print(sub * (N - 2) + sub_2)", 'K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nsub_a = []\n\nfor i in range(len(A)):\n if i + 1 == len(A):\n sub_a.append(A[0] + K - A[i])\n else:\n sub_a.append(A[i + 1] - A[i])\n\nmax_sub = max(sub_a)\n\nprint(K - max_sub)']
['Wrong Answer', 'Accepted']
['s584154461', 's166401155']
[26436.0, 25840.0]
[69.0, 146.0]
[264, 263]
p02725
u387080888
2,000
1,048,576
There is a circular pond with a perimeter of K meters, and N houses around them. The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond. When traveling between these houses, you can only go around the pond. Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.
['a=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=[]\nfor i in range(a[1]):\n if i==a[1]-1:\n if b[0]==0:\n b[0]=a[0]\n c.append(abs(b[i]-b[0]))\n else:\n c.append(abs(b[i]-a[0]))\n elif i!=a[1]-1:\n c.append(abs(b[i]-b[i+1]))\nprint(a[0]-max(c))', 'a=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=[]\nfor i in range(a[1]):\n if i==a[1]-1:\n if b[0]==0:\n b[0]=a[0]\n c.append(abs(b[i]-b[0]))\n else:\n c.append(abs(b[i]-(b[0]+a[0])))\n elif i!=a[1]-1:\n c.append(abs(b[i]-b[i+1]))\nprint(a[0]-max(c))']
['Wrong Answer', 'Accepted']
['s300573813', 's531413125']
[26444.0, 26444.0]
[169.0, 167.0]
[314, 321]
p02725
u391285522
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())\naa = map(int, input().split())\n\nB = []\nfor i in range(1, n):\n B.append(a[i]-a[i-1])\n \nB.append(k-sum(B))\nprint(k-max(B))', 'k, n = map(int, input().split())\naa = map(int, input().split())\n\nB = []\n\nfor i in range(1, n):\n B.append(aa[i]-aa[i-1])\n \nB.append(k-sum(B))\nprint(k-max(B))', 'k, n = map(int, input().split())\naa = list(map(int, input().split()))\n\nB = []\n\nfor i in range(1, n):\n B.append(aa[i] - aa[i - 1])\n\nB.append(k - sum(B))\nprint(k - max(B))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s119036484', 's413003541', 's926318651']
[18484.0, 18508.0, 26444.0]
[38.0, 36.0, 120.0]
[159, 162, 172]
p02725
u391540332
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# coding: utf-8\n# import sys\n# import pprint\n# import numpy as np\n# import code\nimport functools\n\nif __debug__:\n debug = lambda *x: None\nelse:\n import logging\n logger = logging.getLogger()\n logger.setLevel(logging.DEBUG)\n ch = logging.StreamHandler()\n ch.setLevel(logging.DEBUG)\n formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n ch.setFormatter(formatter)\n logger.addHandler(ch)\n debug = logger.debug\n\nk, n, *a = (int(x) for x in input().split())\na = [int(x) for x in input().split()]\n\ndebug(k)\ndebug(n)\ndebug(a)\n\naa = a.copy()\naa.pop(0)\naa.append(k + a[0])\ndebug(aa)\n# r = functools.reduce(lambda )\n\nd = [y - x for x, y in zip(a,aa)]\ndebug(d)\nd.sort()\ndebug(d)\nd.pop()\ndebug(d)\ndebug(sum(d))\n", "#!/usr/bin/env python3\n# coding: utf-8\n# import sys\n# import pprint\n# import numpy as np\n# import code\nimport functools\n\nif __debug__:\n debug = lambda *x: None\nelse:\n import logging\n logger = logging.getLogger()\n logger.setLevel(logging.DEBUG)\n ch = logging.StreamHandler()\n ch.setLevel(logging.DEBUG)\n formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n ch.setFormatter(formatter)\n logger.addHandler(ch)\n debug = logger.debug\n\nk, n, *a = (int(x) for x in input().split())\na = [int(x) for x in input().split()]\n\ndebug(k)\ndebug(n)\ndebug(a)\n\naa = a.copy()\naa.pop(0)\naa.append(k + a[0])\ndebug(aa)\n# r = functools.reduce(lambda )\n\nd = [y - x for x, y in zip(a,aa)]\ndebug(d)\nd.sort()\ndebug(d)\nd.pop()\ndebug(d)\nprint(sum(d))\n"]
['Wrong Answer', 'Accepted']
['s734038324', 's941543163']
[26940.0, 26940.0]
[123.0, 124.0]
[784, 784]
p02725
u391675400
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\nhanbun = k /2\na.sort\nprint(a)\ni = 0\nwhile True:\n if a[i] != 0:\n end = a[i]\n break\n else:\n i += 1\nstart = a[n-1]\n\n\nresult = start - end\nif result < 0:\n result = result * -1\nprint(result)', 'k,n = map(int,input().split())\na = list(map(int,input().split()))\nd = []\nfor i in range(n-1):\n d.append(a[i+1]-a[i])\nd.append(k+ a[0]-a[n-1])\nprint(k - max(d))']
['Wrong Answer', 'Accepted']
['s768594576', 's185942053']
[26444.0, 25836.0]
[82.0, 115.0]
[282, 162]
p02725
u391819434
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.
['B1=K-A[N-1]+A[0]\n\nB=[]\ni=0\nwhile i<=N-2:\n B.append(A[i+1]-A[i])\n i=i+1\nB=sorted(B)\nprint(K-max(B1,B[-1]))', 'K,N=map(int,input().split())\nA=list(map(int,input().split()))\n\nB1=K-A[N-1]+A[0]\n\nB=[]\ni=0\nwhile i<=N-2:\n B.append(A[i+1]-A[i])\n i=i+1\nB=sorted(B)\nprint(K-max(B1,B[-1]))']
['Runtime Error', 'Accepted']
['s831723262', 's750637663']
[3064.0, 26444.0]
[17.0, 175.0]
[111, 174]
p02725
u392319141
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.
['while True:\n a = 1\n', 'print(0)', 'K, N = map(int, input().split())\nA = list(map(int, input().split()))\nB = [abs(x - y) for x, y in zip(A[1:], A)]\nB += [K - A[-1] + A[0]]\n\nprint(sum(B) - max(B))\n']
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s042489972', 's576350886', 's618182797']
[2940.0, 2940.0, 26616.0]
[2104.0, 17.0, 90.0]
[20, 8, 160]
p02725
u394244719
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 = 0\n\nfor _ in range(len(a)-1):\n if diff < abs(a[_]-a[_+1]):\n diff = abs(a[_]-(a[_+1]))\n\nprint(k-diff)', 'k, n = map(int, input().split())\na = list(map(int,input().split()))[::-1]\ndiff = 0\n\nfor i in range(len(a)-1):\n if diff < a[i] - a[i+1]:\n diff = a[i] - a[i+1]\n\nif diff < k-a[0] + a[-1]:\n diff = k-a[0] + a[-1]\n\nans = k-diff\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s386715430', 's208808045']
[26060.0, 26444.0]
[114.0, 106.0]
[184, 247]
p02725
u394520553
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()]\nmaxi=0\nfor i in range(n-1):\n cal=abs(a[i]-a[(i+1)])\n if(cal>maxi):\n maxi=cal\nif(k-a[n-1]>maxi):\n maxi=k-a[n-1]\nprint(maxi)', 'k,n=[int(x) for x in input().split()]\na=[int(x) for x in input().split()]\nmaxi=0\nfor i in range(n-1):\n cal=abs(a[i]-a[(i+1)])\n if(cal>maxi):\n maxi=cal\nif(abs(k-a[n-1])+a[0]>maxi):\n maxi=abs(k-a[n-1])+a[0]\nprint(k-maxi)']
['Wrong Answer', 'Accepted']
['s077674761', 's369828700']
[26444.0, 26444.0]
[131.0, 129.0]
[212, 234]
p02725
u394731058
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()))\nd = []\nfor i in range(n):\n if i+1<n:\n d.append(abs(l[i+1]-l[i]))\n else:\n if 0 in l:\n d.append(abs(k - l[i]))\n else:\n d.append(abs(k - l[i] + l[0])\nprint(sum(d)-max(d))', 'k, n = map(int, input().split())\nl = list(map(int, input().split()))\nd = []\nfor i in range(n):\n if i+1<n:\n d.append(abs(l[i+1]-l[i]))\n else:\n if 0 in l:\n d.append(abs(k - l[i]))\n else:\n d.append(abs(k - l[i] + l[0]))\nprint(sum(d)-max(d))']
['Runtime Error', 'Accepted']
['s526280273', 's070850126']
[2940.0, 26600.0]
[17.0, 146.0]
[257, 258]