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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03274 | u576432509 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nx=list(map(int,input().split()))\n\nif x[n-1]<=0 :\n t=x[-k+1]\n print(t)\n\nelif x[0]>=0:\n t=x[k-1]\n print(t)\n\nelse:\n for i in range(n):\n if x[i]<0 and x[i+1]>=0 :\n i0=i+1\n break\n print(i0)\n tmin=10**9\n for i in range(i0,k)... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s286908716', 's328061484', 's425722793', 's451175631', 's690026296'] | [14480.0, 2940.0, 14100.0, 14252.0, 14568.0] | [365.0, 18.0, 74.0, 79.0, 96.0] | [608, 480, 1244, 1272, 222] |
p03274 | u584083761 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['a,b = list(map(int, input().split()))\nn = list(map(int, input().split()))\n\nc = 0\nris = 0\nlenn = len(n)\nfor i, name in enumerate(n[::-1]):\n if name < 0:\n c += 1\n if c == b-1:\n ri = i\n rs = name\n ris = lenn - ri - 1\n break\n\nans = []\nans_sum = []\nfor i in range(b... | ['Runtime Error', 'Accepted'] | ['s406817448', 's847330021'] | [1435696.0, 14252.0] | [2201.0, 105.0] | [689, 258] |
p03274 | u591503175 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['#\nfrom resolve import resolve\n####################################\n####################################\n\n# \nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, s... | ['Runtime Error', 'Accepted'] | ['s374725846', 's278771560'] | [9228.0, 20516.0] | [28.0, 93.0] | [1149, 600] |
p03274 | u593590006 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nl=[int(i) for i in input().split()]\nl=[abs(i) for i in l]\nsm=sum(l[:k])\nmini=min(mini,sm)\nfor i in range(k,n):\n sm=sm-l[i-k]\n sm+=l[i]\n mini=min(mini,sm)\nprint(mini)', 'n,k=map(int,input().split())\nl=[int(i) for i in input().split()]\nright=[i for i in l if i>0]\nleft=[... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s338669665', 's928509836', 's405935930'] | [14224.0, 14364.0, 14360.0] | [54.0, 129.0, 134.0] | [203, 936, 941] |
p03274 | u597374218 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nx=sorted(list(map(int,input().split())))\na=[]\nfor i in range(n-k+1):\n l=x[i]\n r=x[i+k-1]\n a.append(min(abs(l)+abs(r-l),abs(r)+abs(l-r)))\nprint(a)', 'N,K=map(int,input().split())\nx=list(map(int,input().split()))\nn=N-K+1\nleft=[0]*n\nfor i in range(n):left[i]=abs(x[i])+abs... | ['Wrong Answer', 'Accepted'] | ['s545288477', 's964761234'] | [14252.0, 14384.0] | [100.0, 92.0] | [183, 246] |
p03274 | u599170882 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\nX = list(map(int, input().split()))\n\ndistance = max([X[-1] - X[0], -X[i], X[-1]])\nfor i in range(N-K+1):\n if X[i+K-1] < 0:\n distance = min(distance, -X[i])\n elif X[i] > 0:\n distance = min(distance, X[i+K-1])\n else:\n tmp_distance = X[i+K-1]-X[i]\... | ['Runtime Error', 'Accepted'] | ['s417629968', 's698406158'] | [14224.0, 14224.0] | [42.0, 117.0] | [416, 323] |
p03274 | u606090886 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k = map(int,input().split())\nx = list(map(int,input().split()))\nflag = True\nfor i in range(n+1):\n if i == n or x[i] > 0:\n x.insert(i,0)\n zahyou = i\n break\nans = 10**18\nfor i in range(k+1):\n flag = True\n if zahyou + i < n+1 and zahyou -k+i >= 0:\n mainasu = x[zahyou]-x... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s224985302', 's249791922', 's429590068'] | [14780.0, 29412.0, 14252.0] | [175.0, 2104.0, 126.0] | [523, 681, 490] |
p03274 | u608569568 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K = map(int,input().split(" "))\narray = list(map(int,input().split(" ")))\n\nminus = 0\nwhile array[minus] < 0 and minus < N:\n minus += 1\n\nfirst,last = max(minus-K,0),min(minus,N-K)\n\nans = 2(array[N-1]- array[0])\n\nfor i in range(first,last+1):\n m_dist, p_dist = array[i], array[K-1+i]\n if m_dist*p... | ['Runtime Error', 'Accepted'] | ['s482969931', 's191357114'] | [14484.0, 14128.0] | [60.0, 111.0] | [481, 480] |
p03274 | u609061751 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import sys\nimport numpy as np\nN, K = [int(x) for x in input().split()]\nx = np.array([int(x) for x in input().split()])\nif 0 in x:\n K -= 1\nif K == 0:\n print(0)\n sys.exit()\nxn = x[(x<0)]\nxn = xn[::-1]\nxp = x[(x>0)]\nans = []\nif len(xn) >= K:\n ans.append(abs(xn[K-1]))\nif len(xp) >= K:\n ans.... | ['Wrong Answer', 'Accepted'] | ['s286875637', 's170890121'] | [23076.0, 23072.0] | [212.0, 557.0] | [534, 422] |
p03274 | u612975321 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import numpy as np\n\nINF = 10**9\n\nn, k = map(int,input().split())\nx = list(map(int, input().split()))\n\nxp = [0] + [INF]*(k)\nxm = [0] + [INF]*(k)\ncp, cm = 1, 1\nfor i in range(n):\n if x[i] >= 0 and cp < k+1:\n xp[cp] = x[i]\n cp += 1\n elif x[i] < 0 and cm < k+1:\n xm[cm] = -x[i]\n ... | ['Wrong Answer', 'Accepted'] | ['s011412656', 's307534232'] | [39060.0, 39772.0] | [252.0, 144.0] | [494, 566] |
p03274 | u613920660 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['from collections import deque\n\nN,K=map(int,input().strip().split())\nx=list(map(int,input().strip().split()))\ninf=10*8\n\nl=inf\ndp=x[N-K:N-1]\ni=0\nwhile N-K-i>=0:\n if dp[0]>=0:\n tmp=dp[K-1]\n elif dp[K-1]<=0:\n tmp=-dp[0]\n else:\n if dp[K-1]>=dp[0]:\n tmp=dp[0]*2+dp[K-... | ['Runtime Error', 'Accepted'] | ['s190418233', 's992868227'] | [20480.0, 20536.0] | [51.0, 108.0] | [474, 514] |
p03274 | u619144316 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import bisect\n\nN, K = map(int,input().split())\nX = list(map(int,input().split()))\n\ns = bisect.bisect_left(X,0)\nif 0 in X:\n K -= 1\nelse:\n bisect.insort_left(X,0)\n N += 1\n\nMIN = 2 * 10**8\nfor i in range(K+1):\n if s - K + i >= 0 and s + i <N:\n f = X[s -K+i]\n l = X[s+i]\n ... | ['Wrong Answer', 'Accepted'] | ['s119794702', 's556253364'] | [14660.0, 20108.0] | [197.0, 87.0] | [486, 301] |
p03274 | u619379081 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n, k = list(map(int, input().split()))\nx = [int(inout()) for i in range(n)]\nans = [min(abs(x[i]), abs(x[i+k-1]))+x[i+k-1]-x[i] for i in range(n-k+1)]\nprint(min(ans))', 'n, k = list(map(int, input().split()))\nx = [int(input()) for i in range(n)]\nans = [min(abs(x[i]), abs(x[i+k-1]))+x[i+k-1]-x[i] for i in range(n-... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s080872533', 's598939712', 's545868096'] | [3060.0, 5624.0, 14252.0] | [18.0, 23.0, 74.0] | [165, 165, 164] |
p03274 | u620846115 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k = map(int,input().split())\nl = list(map(int,input().split()))\nfor i in range(n-k+1):\n if l[i] <0 and l[i+k]<0:\n print(abs(l[i]))\n elif l[i] >0 and l[i+k]>0:\n print(abs(l[i+k]))\n elif l[i] <0 and l[i+k]>0:\n print(min(abs(l[i]),l[i+k])*2 + max(abs(l[i]),l[i+k]))', 'n,k = map(int,input().split())... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s070697758', 's218064844', 's417239355', 's669829906', 's887221093', 's952048536', 's096560438'] | [20292.0, 20184.0, 8916.0, 20316.0, 9048.0, 17004.0, 20132.0] | [113.0, 95.0, 26.0, 104.0, 27.0, 35.0, 91.0] | [276, 309, 325, 309, 190, 305, 188] |
p03274 | u623349537 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\na = list(map(int, input().split()))\n\nmin_time = 2 * 10 ** 8\nfor i in range(N):\n print(i)\n if i + K > N:\n break\n if a[i] > 0:\n min_time = min(min_time, abs(a[i + K - 1]))\n break\n \n if a[i + K - 1] < 0:\n if i + K <= N and a[i + K] ... | ['Runtime Error', 'Accepted'] | ['s364632327', 's686573456'] | [14480.0, 14844.0] | [143.0, 103.0] | [499, 498] |
p03274 | u623687794 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nc=list(map(int,input().split()))\nans=10**100\nfor i in range(n-k+1):\n lit=c[i:i+k]\n if lit[0]*lit[-1]>0:\n d=abs(lit[0])+abs(lit[-1])+min(abs(lit[0]),abs(lit[-1]))\n else:\n d=max(abs(lit[0],abs(lit[-1])))\n if d<ans:\n ans=d\nprint(ans)\n', 'n,k=map(int,input().split())\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s289625322', 's373442616', 's588796100'] | [14252.0, 14568.0, 14224.0] | [2104.0, 2104.0, 87.0] | [273, 272, 187] |
p03274 | u624475441 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K,*x=map(int,open(0).read().split());print(min(min(abs(x[i]),abs(x[i+k-1]))+x[i+k-1]-x[i]for i in range(n-k+1)))', 'n,k,*x=map(int,open(0).read().split());print(min(min(abs(x[i]),abs(x[i+k-1]))+x[i+k-1]-x[i]for i in range(n-k+1)))'] | ['Runtime Error', 'Accepted'] | ['s531841562', 's741921209'] | [14052.0, 14052.0] | [41.0, 71.0] | [114, 114] |
p03274 | u626881915 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\na = list(map(int,input().split()))\nminus = [a[i] for i in range(n) if a[i] < 0][::-1]\n\nplus = [a[i] for i in range(n) if a[i] > 0]\n\nmin_ = 10**18\n\nif len(plus) == 0:\n print(minus[k-1])\nelif len(minus) == 0:\n print(plus[k-1])\nelif len(plus) < len(minus):\n for i in range(min... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s519935028', 's552189160', 's683204193', 's692278979'] | [14660.0, 14252.0, 14252.0, 14480.0] | [95.0, 99.0, 81.0, 105.0] | [525, 622, 286, 420] |
p03274 | u629350026 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nx=list(map(int,input().split()))\nx.sort()\nans=[]\nfor i in range(0,n-k+1):\n l=x[i]\n r=x[i+k-1]\n ans.append(min(abs(l)+abs(l-r),abs(r)+abs(l-r)))\nprint(ans)\nprint(min(ans))\n', 'n,k=map(int,input().split())\nx=list(map(int,input().split()))\nx.sort()\nans=[]\nfor i in range(0,n-... | ['Wrong Answer', 'Accepted'] | ['s333516632', 's059039085'] | [14252.0, 14252.0] | [93.0, 90.0] | [203, 192] |
p03274 | u631914718 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import sys\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef I(): return int(sys.stdin.readline())\ndef F(): retur... | ['Wrong Answer', 'Accepted'] | ['s175925371', 's740274845'] | [14168.0, 14052.0] | [109.0, 73.0] | [952, 130] |
p03274 | u636137609 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ["N,K = map(int, input().split())\na = list(map(int, input().split()))\n\nif 0 in a:\n N = N - 1\n if N == 0:\n print('0')\n exit()\n\naLow = list(filter(lambda x: x < 0, a))\naLow = list(map(lambda x: abs(x), aLow))\naLow = aLow.sort()\n\naHigh = list(filter(lambda x: x > 0, a))\n\nleast = 99999999999999999\n\... | ['Runtime Error', 'Accepted'] | ['s117386330', 's570676255'] | [14480.0, 14480.0] | [76.0, 119.0] | [536, 603] |
p03274 | u652081898 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n, k = map(int, input().split())\nlist_original = list(map(int, input().split()))\n\nlist_original.append(0)\nlist = sorted(list_original)\npoint = list.index(0)\n\nif k <= point and point <= n-k+1:\n if abs(list[point-k]) <= list[point+k]:\n print(abs(list[point-k]))\n else:\n print(list[point])\... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s131634231', 's403120660', 's757081688'] | [14384.0, 14392.0, 14224.0] | [45.0, 47.0, 97.0] | [383, 186, 310] |
p03274 | u667469290 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ["# -*- coding: utf-8 -*-\nimport numpy as np\n\ndef solve():\n N, K = map(int, input().split())\n C = np.array(list(map(int,input().split())))\n D = list()\n for i in range(N-K+1):\n c = C[i:i+K]\n l, r = max(c), min(c)\n d = -2*r + l if l > r else -r + 2*l\n D.append(d)\n return st... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s090485247', 's992458401', 's492713051'] | [23056.0, 2940.0, 23092.0] | [2108.0, 17.0, 414.0] | [362, 361, 384] |
p03274 | u672494157 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import sys\nfrom collections import deque\n\nsys.setrecursionlimit(4100000)\n\n\ndef inputs(num_of_input):\n ins = [input() for i in range(num_of_input)]\n return ins\n\n\ndef solve(N, K, inputs):\n candles = string_to_int(inputs[0])\n min_distance = -1\n for i in range(0, N-K+1):\n left = candl... | ['Wrong Answer', 'Accepted'] | ['s448781640', 's170291313'] | [15396.0, 15396.0] | [129.0, 70.0] | [1055, 1028] |
p03274 | u677312543 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n, k = map(int, input().split())\nx = list(map(int, input().split()))\n\nm = min(b - a + min(abs(a), bas(b)) for a, b in zip(x, x[k-1]))\nprint(m)', 'n, k = map(int, input().split())\nx = list(map(lambda x: int(x), input().split()))\n\nans = 0\nfor i in range(n-k+1):\n r = x[i+k-1]\n l = x[i]\n length = abs(... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s077136212', 's189451759', 's833839745', 's447918740'] | [14224.0, 14228.0, 14224.0, 14252.0] | [44.0, 92.0, 55.0, 96.0] | [142, 243, 235, 219] |
p03274 | u677705680 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\nX = list(map(int, input().split()))\n\nminus = [0]\nplus = [0]\nfor x in X:\n if x < 0:\n minus.append(abs(x))\n elif x == 0:\n K -= 1\n else:\n plus.append(x)\n\n\nminus.sort()\n\nans = []\nfor i in range(max(0, K - (len(plus) - 1)), min(len(minus) + 1,... | ['Runtime Error', 'Accepted'] | ['s904307783', 's037965172'] | [14564.0, 14480.0] | [160.0, 97.0] | [510, 507] |
p03274 | u687044304 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['# -*- coding:utf-8 -*-\n\n\ndef solve():\n N, K = list(map(int, input().split()))\n X = list(map(int, input().split()))\n if 0 in X:\n \n K -= 1\n else:\n X.append(0)\n X.sort()\n\n origin_i = X.index(0)\n left_i = max(origin_i-K, 0)\n\n INF = 10**12\n ans = INF\n wh... | ['Wrong Answer', 'Accepted'] | ['s830585603', 's366244298'] | [14252.0, 14252.0] | [63.0, 87.0] | [1122, 1205] |
p03274 | u698501671 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K = map(int,input().split())\nx = list(map(int,input().split()))\n\nans = sum([abs(i) for i in x])\nfor i in range(N - K + 1):\n t = min(abs(x[i])+abs(x[i+K-1] - x[i]),abs(x[i+K-1]+abs(x[i+K-1]-x[i]))\n if t < ans:\n ans = t:\n\nprint(ans)', 'N, K = map(int, input().split())\nx = list(map(int, input().... | ['Runtime Error', 'Accepted'] | ['s623896327', 's838172314'] | [2940.0, 14224.0] | [17.0, 115.0] | [245, 247] |
p03274 | u699765883 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['from collections import deque\n\nN, K = map(int, input().split())\nx = list(map(int, input().split()))\n\nx_upper = []\n\nfor i in reversed(x):\n if i<0:\n break\n if i>=0:\n x_upper.append(i)\n x.pop()\n \n\nx.reverse()\nx_upper.reverse()\n\nlenXu = len(x_upper)\nlenX = len(x)\n\nif... | ['Runtime Error', 'Accepted'] | ['s899585157', 's619717842'] | [14628.0, 14628.0] | [95.0, 98.0] | [697, 705] |
p03274 | u701426727 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import copy\nnum = input().split(" ")\nzahyou = input().split(" ")\n\nnum[1] = int(num[1])\nplus = []\nminus = []\nrousoku = []\nfor i in range(int(num[0])):\n if(int(zahyou[i]) < 0):\n minus.append(int(zahyou[i]))\n else:\n plus.append(int(zahyou[i]))\n\n\n\nif(num[1] > len(plus)):\n plus_tmp ... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s080071163', 's654878021', 's945066685', 's641766190'] | [17680.0, 17176.0, 14920.0, 14844.0] | [2105.0, 2104.0, 151.0, 114.0] | [1356, 1391, 551, 547] |
p03274 | u707124227 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nx=list(map(int,input().split()))\nx=list(range(1,n+1))\nxp=[xi for xi in x if xi>=0]\nxm=[xi for xi in x if xi<0]\nxm.sort(reverse=True)\nans=2*10**8\nfor i in range(k+1):\n if i>len(xp) or k-i>len(xm):\n continue\n a=xp[i-1] if len(xp)>0 else 0\n b=xm[k-i-1] if len(xm)>0... | ['Wrong Answer', 'Accepted'] | ['s376625293', 's151106128'] | [14564.0, 14380.0] | [76.0, 94.0] | [397, 538] |
p03274 | u707498674 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['from collections import Counter\nimport numpy as np\nH, W = map(int, input().split())\na = []\nr_idx = []\nc_idx = []\n#a.shape = (H, W)\nfor i in range(H):\n line = list(input())\n if Counter(line).most_common()[0][1] != W:\n r_idx.append(i)\n a.append(line)\na = np.array(a).T\n#a.shape = (W, H)\nb =... | ['Runtime Error', 'Accepted'] | ['s755638265', 's940598975'] | [21656.0, 14224.0] | [216.0, 103.0] | [525, 264] |
p03274 | u709304134 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['#coding:utf-8\n\n\n# ls = [-30,-10,10,20,50]\n\n# n,k = 3,2\n# ls=[10,20,30]\n\n# n,k = 1,1\n# ls = [0]\n\n#n,k=8,5\n#ls=[-9,-7,-4,-3,1,2,3,4]\n\nfirst = -1\nfor i,point in enumerate(ls):\n if point >= 0:\n first = i\n break\nsize=k+1\nans = []\nfor i in range(size):\n if first-size+i+1>=0 and fir... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s011718684', 's044896338', 's112566404', 's212461889', 's579614204', 's753119549', 's451387469'] | [3060.0, 16160.0, 12432.0, 3064.0, 142788.0, 2940.0, 23048.0] | [17.0, 2104.0, 148.0, 17.0, 2104.0, 16.0, 540.0] | [486, 1208, 1354, 340, 1152, 1282, 1850] |
p03274 | u716043626 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n, k = map(int,input().split())\nx = list(map(int,input().split()))\nx.append(0)\nx.sort()\nans = 10 ** 18\nfor i in range(n-k+1):\n cnt = 0\n cnt += abs(x[i])\n for j in range(i,k+i):\n cnt += abs(x[j+1] - x[j]) \n if cnt < ans:\n ans = cnt\n\nprint(min(ans))', 'n, k = map(int,input().sp... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s529871862', 's654769669', 's797273029', 's901587432'] | [14252.0, 14380.0, 14252.0, 14392.0] | [2104.0, 2104.0, 2104.0, 83.0] | [276, 277, 271, 286] |
p03274 | u733608212 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['\nn, k = map(int, input().split())\nli = list(map(int, input().split()))\nli.append(0)\nli.sort()\nzero_index = li.index(0)\nif zero_index == 0:\n print(li[k])\nelif zero_index == len(li) -1:\n print(abs(li[-k-1]))\nelse:\n near_zero_small = li[zero_index-1]\n near_zero_big = li[zero_index+1]\n li.pop(... | ['Runtime Error', 'Accepted'] | ['s783182625', 's590998728'] | [14480.0, 14480.0] | [97.0, 94.0] | [817, 821] |
p03274 | u745561510 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\nx = list(map(int,input().split()))\n\ncandidate = []\nfor i in range(N - K + 1):\n tmp = []\n for j in range(i, i + K):\n tmp.append(x[j])\n candidate.append(tmp)\n\n\n\n\ncheck = 0\nans = 10000000\nfor i in candidate:\n tmp = 0\n \n if i[0] < 0:\n \n ... | ['Wrong Answer', 'Accepted'] | ['s197284909', 's866351109'] | [141616.0, 14384.0] | [2113.0, 85.0] | [914, 289] |
p03274 | u754651673 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['#my answer\nn, k = map(int,input().split())\nx = list(map(int,input().split()))\n\nns = 999999999\n\nfor i in range(n - k + 1):\n a = abs(x[i]) + (x[i + k - 1] - x[i])\n b = abs(x[i + k - 1]) + (x[i + k - 1] - x[i])\n ans = min(ans, a, b)\n \nprint(ans)', '\nn, k = map(int,input().split())\nx = list(map(i... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s388025960', 's575755887', 's653520607', 's721775496', 's674929367'] | [14224.0, 14252.0, 3064.0, 2940.0, 14224.0] | [42.0, 42.0, 17.0, 17.0, 99.0] | [254, 245, 436, 283, 245] |
p03274 | u757030836 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K = map(int,input().split())\nx = [int(i) for i in input().split()]\nans = 10**5\nfor i in range(N-K+1):\n left =x[i]\n right =x[i+3]\n p1 = abs(left) + abs(right-left)\n p2 = abs(right) + abs(right-left)\n p = min(p1,p2)\n ans = min(ans,p)\n \n \nprint(ans)\n ', 'N,K = map(int,input().split())\nx = [int(i... | ['Runtime Error', 'Accepted'] | ['s011697955', 's730134688'] | [14224.0, 14384.0] | [96.0, 99.0] | [259, 252] |
p03274 | u759726213 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\nX = list(map(int, input().split()))\n\nmax = 10000000000000000000000000\nfor i in range(N - K + 1):\n \n t_1 = abs(X[i])\n t_1 += X[i + K - 1] - X[i]\n\n t_2 = abs(X[i + K - 1])\n t_2 = X[i] - X[i + K - 1]\n\n if t_1 < max:\n max = t_1\n if t_2 < max:\n ... | ['Wrong Answer', 'Accepted'] | ['s081224599', 's061080579'] | [14252.0, 14252.0] | [86.0, 84.0] | [337, 339] |
p03274 | u784022244 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K=map(int, input().split())\n\nA=list(map(int, input().split()))\n\nans=10**8\nfor i in range(N-K+1):\n L=A[i]\n R=A[i+K-1]\n ans=min(ans, R-L+min(R, L))\n \nprint(ans)', 'import numpy as np\nN,K=map(int, input().split())\nX=list(map(int, input().split()))\nans=np.inf\nfor i in range(N-K+1):\n l=X[i]\n r=X[i+... | ['Wrong Answer', 'Accepted'] | ['s207613548', 's823592424'] | [15020.0, 23096.0] | [79.0, 315.0] | [164, 189] |
p03274 | u785578220 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['def a():return input()#s\ndef ai():return int(input())#a,n or k\ndef ma():return map(int, input().split())#a,b,c,d or n,k\ndef ms():return map(str, input().split())#,a,b,c,d\ndef lma():return list(map(int, input().split()))#x or y\ndef lms():return list(map(str, input().split()))#x or y\na,b = ma()\nx = lma()\nans =... | ['Wrong Answer', 'Accepted'] | ['s430560324', 's134982210'] | [14484.0, 14660.0] | [80.0, 80.0] | [531, 537] |
p03274 | u787562674 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\nx = [int(i) for i in input().split()]\n\ntime = 10 ** 20\n\nbase = 0\n\nfor i in range(N):\n if x[i] >= 0:\n base = x[i]\n break\n\nfor i in range(N - K + 1):\n if x[i+K-1] < 0:\n time = min(abs(x[i]) * 2, time)\n elif x[i] < 0 and x[i+K-1] >= 0:\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s060945542', 's365683194', 's743997374', 's828264466', 's923529341', 's075225768'] | [14480.0, 14844.0, 3064.0, 14228.0, 14664.0, 14252.0] | [164.0, 120.0, 17.0, 81.0, 104.0, 85.0] | [487, 468, 642, 409, 504, 520] |
p03274 | u788137651 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['\n\nN, K = map(int, input().split())\nINF = 10**9\nx_first = [-INF for i in range(K)]\nx_ap = [int(i) for i in input().split()]\nif min(x_ap) < 0:\n print("S")\nx_last = [INF for i in range(K)]\nx = x_first + x_ap + x_last + [0]\nx.sort()\nzero_index = x.index(0)\n\nkey = []\nfor i in range(K):\n left = abs(x[z... | ['Wrong Answer', 'Accepted'] | ['s868357458', 's668954386'] | [18280.0, 14252.0] | [143.0, 70.0] | [615, 188] |
p03274 | u793460864 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\nx = list(map(int, input().split()))\nL = [0]*(N-K+1) \n\nfor i in range(N-K+1):\n L[i] = min((abs(x[i])+abs(x[i+K-1]-x[i])),(abs(x[i+K-1])+abs(x[i+K-1]-x[i]))\n \nprint(min(L))', 'N, K = map(int, input().split())\nx = list(map(int, input().split()))\nL = [0]*(N-K+1) \n \nfo... | ['Runtime Error', 'Accepted'] | ['s571324055', 's865737470'] | [2940.0, 14564.0] | [17.0, 100.0] | [213, 341] |
p03274 | u795630164 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ["N, K = map(int, input().split())\nx = []\ny = []\nfor i in input().split():\n n = int(i)\n if n < 0:\n x.append(-n)\n elif n == 0:\n K -= 1\n else:\n y.append(n)\n\nx = x[::-1]\n\nlen_x = len(x)\nlen_y = len(y)\nnow = 10 ** 18\n\nif len_x == 0:\n if len_y == 0:\n print(0)\n ... | ['Runtime Error', 'Accepted'] | ['s232242808', 's088428882'] | [14252.0, 14480.0] | [184.0, 119.0] | [688, 690] |
p03274 | u798316285 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nX=list(map(int,input().split()))\nans=[]\nfor i in range(n-k+1):\n ans.append(X[i+k-1]-X[i]+min(abs(X[i+k+1]),abs(X[i])))\nprint(min(ans))', 'n,k=map(int,input().split())\nX=list(map(int,input().split()))\nans=[]\nfor i in range(n-k+1):\n ans.append(X[i+k-1]-X[i]+min(abs(X[i+k-1]),abs(... | ['Runtime Error', 'Accepted'] | ['s322732152', 's055108915'] | [14224.0, 14224.0] | [82.0, 84.0] | [164, 164] |
p03274 | u798818115 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['# coding: utf-8\n# Your code here!\nN,K=map(int,input().split())\nX=list(map(int,input().split()))\n\ndef journey(main,sub):\n if len(main)==1:\n main.append(10**18)\n elif len(sub)==1:\n sub.append(10**18)\n dp=0\n nm=1\n ns=1\n ans=0\n for _ in range(K):\n dism=(main[nm]-ma... | ['Runtime Error', 'Accepted'] | ['s359483249', 's269164562'] | [14692.0, 14480.0] | [362.0, 121.0] | [820, 361] |
p03274 | u799065076 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K=list(map(int,input().split()))\nx=list(map(int,input().split()))\nt_min=10**9+7\nfor i in range(N-K+1):\n t=x[i+K-1]-x[i]+min(np.abs(x[i]),np.abs(x[i+K-1]))\n if t<t_min:\n t_min=t\nprint(t_min)', 'import numpy as np\n\nN,K=list(map(int,input().split()))\nx=list(map(int,input().split()))\nt_min=10**9... | ['Runtime Error', 'Accepted'] | ['s269344526', 's201058647'] | [14384.0, 23096.0] | [42.0, 478.0] | [204, 224] |
p03274 | u806976856 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nx=list(map(int,input().split()))\na=[x[i] for i in range(n) if x[i]<0]\nb=[x[i] for i in range(n) if x[i]>=0]\nna=len(a)\nnb=len(b)\nif b[0]==0:\n k-=1\n b=[x[i] for i in range(n) if x[i]>0]\n nb=nb-1\nif k==0:\n print(0)\n exit()\nans=10**10\nif na>=k:\n ans=-a[-k]\nif... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s192369688', 's346362321', 's424257269', 's493842510', 's328463619'] | [20120.0, 20020.0, 20160.0, 20288.0, 20032.0] | [69.0, 64.0, 64.0, 64.0, 107.0] | [341, 633, 634, 238, 630] |
p03274 | u812576525 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = list(map(int,input().split()))\nA = list(map(int,input().split()))\nP = [0] + [abs(i) for i in A if i> 0 ]\nM = [abs(i) for i in A if i< 0 ] +[0]\nM = sorted(M,reverse =False)\n\nprint(P,M)\ncnt = 10000000\n\nif len(P) == len(M) == 1:\n cnt = 0\nelif len(P) == 1:\n cnt = M[K]\nelif len(M) == 1:\n cnt ... | ['Wrong Answer', 'Accepted'] | ['s180765520', 's396621211'] | [16400.0, 20192.0] | [106.0, 77.0] | [963, 452] |
p03274 | u812867074 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nli=list(map(int,input().split()))\nq=[]\nfor i in range(k,n):\n if i<0 or i-k+1>0:\n q.append(li[i-1]-li[i-k])\n else:\n q.append(li[i-1]-li[i-k]+min(li[i-1],abs(li[i-k])))\nprint(min(q))\n\n ', 'n,k=map(int,input().split())\nli=list(map(int,input().split()))\nq=[]\nif k==n:\n... | ['Runtime Error', 'Accepted'] | ['s864197966', 's482582048'] | [14384.0, 14252.0] | [67.0, 94.0] | [223, 332] |
p03274 | u814781830 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input())\nx = list(map(int, input()))\nret = 10 ** 9\nfor i in range(N-k+1):\n init = abs(x[i])\n dist = abs(x[i]-x[i+k-1])\n l = init + dist\n init = abs(x[i+k-1])\n r = init + dist\n ret = min(l, r)\nprint(ret)', 'N, K = map(int, input().split())\nx = list(map(int, input().split())... | ['Runtime Error', 'Accepted'] | ['s006767103', 's144733492'] | [3064.0, 14384.0] | [17.0, 96.0] | [236, 257] |
p03274 | u814986259 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\nx = list(map(int, input().split()))\n\nplus = [i for i in x if i >= 0]\nminus = [i for i in x if i <= 0]\nid = 0\nfor i in range(N):\n if x[i] >= 0:\n id = i\n break\nans = float("Inf")\nif N - id >= K:\n ans = x[id+K-1]\nif id >= K:\n ans = min(ans, -x[id - K]... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s440871984', 's558170588', 's925182971', 's390501009'] | [14780.0, 14480.0, 14536.0, 14568.0] | [108.0, 142.0, 150.0, 105.0] | [454, 465, 467, 226] |
p03274 | u824237520 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n, k = map(int, input().split())\nx = list(map(int, input().split()))\n\nfor center in range(n):\n if x[center] >= 0:\n break\n\nif center == n or (center == n - 1 and x[n - 1] == 0):\n print(-1 * x[n - k])\n exit()\nelif center == 0:\n print(x[k - 1])\n exit()\n\nplus = [0] + x[center:]\nminus ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s309884013', 's534069310', 's635975121'] | [14660.0, 14564.0, 14568.0] | [78.0, 151.0, 88.0] | [533, 553, 498] |
p03274 | u834415466 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K=map(int,input().split())\nx=list(map(int,input().split()))\nmin=1000000000\nfor i in range(N-K+1):\n if x[i+K+1]<0:\n if min>-x[i]:\n min=-x[i]\n elif x[i]>=0:\n if min>x[i+K-1]:\n min=x[i+K-1]\n elif x[i]+x[i+K-1]>=0:\n if min>x[i+K-1]-x[i]*2:\n min=... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s326222715', 's649135246', 's693828218', 's789624215', 's932479900', 's506023409'] | [14480.0, 14384.0, 14660.0, 14696.0, 14384.0, 14252.0] | [79.0, 82.0, 75.0, 71.0, 92.0, 84.0] | [406, 201, 393, 387, 552, 205] |
p03274 | u838644735 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ["def main():\n N, K = map(int, input().split())\n X = list(map(int, input().split()))\n D = [0]*(N - 1)\n for i in range(1, N):\n D[i-1] = X[i] - X[i - 1]\n ans = 0\n t = 0\n T = [0]*(N - K + 1)\n for i in range(1, N):\n t += D[i-1]\n if i < K:\n if i == K - 1:\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s271811020', 's476763609', 's667873802'] | [3064.0, 3064.0, 14480.0] | [17.0, 17.0, 121.0] | [600, 600, 600] |
p03274 | u842964692 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K=[int(i) for i in input().split()]\nX=[int(i) for i in input().split()]\nm=10**5\nfor i in range(N-K+1):\n m=min(m,x[K-1+i]-x[i]+min(abs(x[K-1+i]),abs(x[i])))\n\nprint(m)', 'N,K=map(int,input().split())\n\nx=list(map(int,input().split()))\n\nxm=[]\nxp=[]\nx0=[]\nans=10**5+1\n\nfor i in range(N):\n xi=x[i]\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s050550488', 's175105124', 's268403992', 's270211248', 's348476496'] | [14252.0, 3064.0, 3064.0, 14384.0, 14384.0] | [47.0, 17.0, 17.0, 46.0, 92.0] | [170, 706, 705, 170, 170] |
p03274 | u843774833 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['# coding: utf-8\nimport sys\n\ndef getMin(X, K):\n minVal = sys.maxsize\n if K == 1:\n return X[0]\n \n for l in range(0, len(X)-K):\n minVal = min(minVal, abs(X[l]) + abs(X[K + l - 1] - X[l]))\n \n return minVal\n\ndef solve(X, K):\n ans = min(getMin(X, K), getMin(X[::-1], ... | ['Runtime Error', 'Accepted'] | ['s374198507', 's782948414'] | [11480.0, 14380.0] | [29.0, 93.0] | [446, 391] |
p03274 | u845620905 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n, k = map(int, input().split())\nx = list(map(int, input().split()))\nans = 1e13\nfor i in range(n-k+1):\n l = x[i]\n r = x[i+k]\n ans = min(ans, abs(l)+abs(r-l))\nprint(ans)\n', 'n, k = map(int, input().split())\nx = list(map(int, input().split()))\nans = 1e13\nfor i in range(n-k):\n l = x[i]\n r = x... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s898775735', 's909042304', 's514336073'] | [14224.0, 14252.0, 14384.0] | [76.0, 80.0, 93.0] | [178, 252, 216] |
p03274 | u853900545 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import bisect\nn,k = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nzero = bisect.bisect_left(a,0)\ncnt = min(-sum(a[zero-k-1:zero]),sum(a[zero:zero+k+1]))\nfor i in range(1,k):\n if cnt > -2*a[zero-i]+a[zero+k]:\n cnt = -2*a[zero-i]+a[zero+k]\n else:\n break\nfor i in ran... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s026045126', 's026658898', 's110263318', 's207046151', 's217727138', 's250230630', 's334618717', 's420305801', 's564385029', 's566255543', 's641639835', 's876962609', 's920675713', 's952153655', 's828362401'] | [14480.0, 14548.0, 14224.0, 14480.0, 14660.0, 14252.0, 14548.0, 14544.0, 14384.0, 14224.0, 14252.0, 15020.0, 14568.0, 15020.0, 14224.0] | [45.0, 47.0, 88.0, 47.0, 46.0, 85.0, 45.0, 46.0, 98.0, 91.0, 84.0, 91.0, 47.0, 64.0, 88.0] | [428, 436, 171, 428, 430, 151, 438, 425, 176, 176, 166, 176, 445, 125, 172] |
p03274 | u853952087 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n=list(map(int,input().split()))\nY=list(map(int,input().split()))\nP=[i for i in Y if i>=0]\nM=[i*-1 for i in Y if i<0]\nif P==[]:\n P.append(max(M)*1000)\nif M==[]:\n M.append(max(P)*1000)\np=sorted(P)\nm=sorted(M)\nprint(p,m)\nL1=[]\nL2=[]\nfor i in range(n[1]):\n if n[1]-i-2<len(m) and i<len(p):\n ... | ['Wrong Answer', 'Accepted'] | ['s353355389', 's297778085'] | [16016.0, 14480.0] | [118.0, 118.0] | [481, 616] |
p03274 | u856232850 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k = map(int,input().split())\n\nx = list(map(int,input().split()))\nans = 100000000000000\n\n\nfor i in range(n-k+1):\n\tif x[i+k-1] <= 0:\n\t\tans = min(ans,-x[i])\n\telif x[i] >= 0:\n\t\tans = min(x[i+k-1],ans)\n\telse:\n\t\tans = min(x[i+k-1]-x[i]+min(abs(x[i]),x[i+k-1]))\nprint(ans)', 'n,k = map(int,input().spl... | ['Runtime Error', 'Accepted'] | ['s135754767', 's334960659'] | [14224.0, 14224.0] | [67.0, 102.0] | [267, 328] |
p03274 | u858136677 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k = map(int,input().split())\nx = list(map(int,input().split()))\n\nl = 0\nr = k-1\nmnm = 1000100010\nwhile r<n:\n print(r)\n a = abs(x[l])+abs(x[l]-x[r])\n b = abs(x[r])+abs(x[r]-x[l])\n if a<=b:\n if a < mnm:\n mnm = a\n else:\n if b < mnm:\n mnm = b\n l += 1\... | ['Wrong Answer', 'Accepted'] | ['s954325756', 's423821781'] | [14532.0, 15020.0] | [128.0, 88.0] | [323, 310] |
p03274 | u860002137 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n, k = map(int, input().split())\nx = list(map(int, input().split()))\n\nans = []\nfor i in range(n - k + 1):\n left = x[i]\n right = x[i + k - 1]\n elif abs(left) > abs(right):\n ans.append(abs(right) + abs(left - right))\n else:\n ans.append(abs(left) + abs(right - left))\n\nprint(min(ans)... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s383203112', 's444854622', 's492934019'] | [2940.0, 23088.0, 14252.0] | [17.0, 2109.0, 77.0] | [307, 352, 305] |
p03274 | u860657719 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['H, W = map(int, input().split())\na = []\nfor i in range(H):\n a.append(input())\nrow = [False]*H\ncol = [False]*W\nfor i in range(H):\n for j in range(W):\n if a[i][j] == "#":\n row[i] = True\n col[j] = True\nfor i in range(H):\n if row[i]:\n for j in range(W):\n ... | ['Runtime Error', 'Accepted'] | ['s423299665', 's480407334'] | [5452.0, 14224.0] | [19.0, 106.0] | [389, 275] |
p03274 | u865413330 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import sys\n\nN, K = map(int, input().split())\ncandles = list(map(int, input().split()))\n\ntmp = sys.maxsize\n\nfor i in range(K):\n minNum = candles[i]\n maxNum = candles[i+K]\n if minNum >= 0 and maxNum >= 0:\n ans = maxNum\n elif maxNum >= 0 and minNum < 0:\n a = 2 * abs(minNum) + maxNu... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s091722915', 's613400745', 's613705954', 's781340823', 's790095037', 's919878024', 's786501350'] | [14224.0, 14252.0, 14224.0, 14252.0, 14224.0, 14224.0, 14252.0] | [96.0, 50.0, 54.0, 54.0, 85.0, 53.0, 95.0] | [464, 118, 150, 189, 469, 146, 309] |
p03274 | u875361824 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['def main():\n \n N, K = map(int, input().split())\n * x, = map(int, input().split())\n ans = f(N, K, x)\n print(ans)\n\n\ndef f1(N, K, x):\n \n\n\ndef f(N, K, x):\n l, r = 0, 0\n for i in range(N-1):\n if x[i] == 0:\n l, r = i, i\n break\n elif [i+1] == 0:\n... | ['Wrong Answer', 'Accepted'] | ['s930354611', 's531840928'] | [14128.0, 14660.0] | [128.0, 80.0] | [2011, 1046] |
p03274 | u875769753 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import sys\nN,K = map(int,input().split())\nlsx = list(map(int,input().split()))\nif 0 in lsx:\n K = K-1\n lsx.remove(0)\nif bool(lsx) == False or K == 0:\n print(0)\n sys.exit()\nlshu = []\nfor i in range(len(lsx)):\n if lsx[i] < 0:\n lshu.append(lsx[i])\n else:\n sei = i\n bre... | ['Runtime Error', 'Accepted'] | ['s330046694', 's749307946'] | [20024.0, 20096.0] | [101.0, 94.0] | [626, 623] |
p03274 | u887207211 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int,input().split())\nX = list(map(int,input().split()))\n\nans = 1e9\nfor l, r in zip(X, X[K:]):\n ans = min(ans, r-l+min(abs(l),abs(r)))\nprint(ans)', 'N, K = map(int,input().split())\nX = list(map(int,input().split()))\n\nans = 1e9\nfor l, r in zip(X, X[K-1:]):\n ans = min(ans, r-l+min(abs(l),abs(r)))... | ['Wrong Answer', 'Accepted'] | ['s424546345', 's261854182'] | [14388.0, 14224.0] | [75.0, 78.0] | [156, 158] |
p03274 | u888092736 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\nX = list(map(int, input().split()))\nans = float("inf")\nfor i in range(N - K + 1):\n left, right = X[i], X[i + K - 1]\n dist = right - left\n ans = min(abs(left) + dist, abs(right) + dist)\nprint(ans)\n', 'N, K = map(int, input().split())\nX = list(map(int, input().split())... | ['Wrong Answer', 'Accepted'] | ['s856927560', 's965536178'] | [14252.0, 14392.0] | [85.0, 84.0] | [238, 243] |
p03274 | u903005414 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = ((N - 1) + (K - 1 - 1)) // (K - 1)\nprint(ans)\n', "N, K = map(int, input().split())\nX = list(map(int, input().split()))\n\nans = 10**18\nfor i in range(N - K + 1):\n d1 = X[i + K - 1] - X[i] + abs(X[i])\n d2 = X[i + K - 1] - X[i] + a... | ['Runtime Error', 'Accepted'] | ['s983691852', 's165074331'] | [14252.0, 14384.0] | [42.0, 90.0] | [121, 258] |
p03274 | u905582793 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ["N, K = map(int, input().split(' '))\na= list(map(int, input().split(' ')))\n\nINF = float('inf')\nans = INF\n\nif N == K:\n ans = abs(a[N-1]-a[0])+min(abs(a[0]), abs(a[N-1]))\nelse:\n for i in range(N-K+1):\n ans = min(ans, abs(a[i+K-1]-a[i])+min(abs(a[i+K-1]), abs(a[i])))\n print(a[i+K-1], a[i], ... | ['Wrong Answer', 'Accepted'] | ['s769135554', 's610646059'] | [14252.0, 14224.0] | [182.0, 89.0] | [323, 288] |
p03274 | u918601425 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K=[int(s) for s in input().split()]\nls_p=[int(s) for s in input().split()]\nls_n=[]\nX=0\nfor i in range(N):\n if ls_p[0]>=0 : break \n else:\n X+=1\n ls_n.append(ls_p[0])\n ls_p.pop(0)\nprint(ls_n)\nprint(ls_p)\n\ncand=[]\nfor i in range(min([X-1,K-2])):\n cand.append(-ls_n[-i-1]*2+ls_p[K-i-2])\n can... | ['Runtime Error', 'Accepted'] | ['s312133562', 's482655303'] | [14480.0, 14224.0] | [1569.0, 94.0] | [458, 313] |
p03274 | u922487073 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['\nnear = abs(xlist[lpos]) if (abs(xlist[lpos]) < abs(xlist[rpos])) else abs(xlist[rpos])\nbet = abs(xlist[lpos] - xlist[rpos])\n\nans = bet + near\n\nfor i in range(N-K):\n lpos += 1\n rpos += 1\n\n near = abs(xlist[lpos]) if (abs(xlist[lpos]) < abs(xlist[rpos])) else abs(xlist[rpos])\n bet = abs(xlist[lp... | ['Runtime Error', 'Accepted'] | ['s090192130', 's868359556'] | [3064.0, 14844.0] | [17.0, 87.0] | [396, 490] |
p03274 | u923279197 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nx=list(map(int,input().split()))\nfor i in range(n-k+1):\n if i==0:\n a=min(abs(x[i])+abs(x[i]-x[i+k-1]),abs(x[i+k-1])+abs(x[i]-x[i+k-1]))\n else:\n a=min(abs(x[i])+abs(x[i]-x[i+k-1]),abs(x[i+k-1])+abs(x[i]-x[i+k-1]))\nprint(a)', 'n,k=map(int,input().split())\nx=list(... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s288478010', 's959027752', 's667106147'] | [14224.0, 14252.0, 14252.0] | [94.0, 42.0, 102.0] | [270, 279, 277] |
p03274 | u926024306 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['a,b=input().split("\\n")\nn,k=a.split(" ")\nx=b.split(" ")\nt=0\ntmin=2*(x[n-1]-x[0])\nfor i in range (0,n-k+1):\n if x[i]>=0:\n t=x[i+k-1]\n else:\n if x[i+k-1]<=0:\n t=abs(x[i])\n else:\n if -1*x[i]<x[i+k-1]:\n t=-2*x[i]+x[i+k-1]\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s406072348', 's053637479'] | [3064.0, 14660.0] | [18.0, 80.0] | [378, 392] |
p03274 | u927534107 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nl=list(map(int,input().split()))\nINF=10**9+7\nif 0 in l:k=k-1\nlm=[0]+[i for i in l if i<0][::-1]\nif len(lm)<k+1:\n lm=lm+[-INF]*(k+1-len(lm))\nlp=[0]+[i for i in l if i>0]\nif len(lp)<k+1:\n lp=lp+[INF]*(k+1-len(lp))\nans=INF*10\nfor i in range(k+1):\n tmp=min(2*lp[i]-lm[k-i]... | ['Wrong Answer', 'Accepted'] | ['s944677841', 's625853963'] | [14480.0, 14532.0] | [204.0, 124.0] | [372, 357] |
p03274 | u932868243 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nl=list(map(int,input().split()))\nans=[]\nfor i in range(n-k+1):\n ans.append(min(abs(l[i])+abs([l[i]-l[i+k-1]),abs(l[i+k-1])+abs(l[i+k-1]-l[i])))\nprint(min(ans))', 'n,k=map(int,input().split())\nl=list(map(int,input().split()))\nif l[0]<=0 and l[k-1]<=0:\n print(abs(l[0]))\nelif l[0]... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s401738856', 's428215763', 's807019470'] | [2940.0, 14252.0, 14224.0] | [17.0, 42.0, 97.0] | [189, 234, 188] |
p03274 | u934868410 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k = map(int, input().split())\nx = list(map(int, input().split()))\n\nans = 1000000000\nfor i in range(n-k+1):\n if x[i] * x[i+k-1] < 0:\n ans = min(ans, min(abs(x[i]), abs(x[i+k-1]))*2 + max(abs(x[i]), abs(x[i+k-1])))\n else:\n ans = max(abs(x[i]), abs(x[i+k-1]))\n \nprint(ans)', 'n, k = map(int, input(... | ['Wrong Answer', 'Accepted'] | ['s591898874', 's723793861'] | [14224.0, 14384.0] | [109.0, 108.0] | [282, 323] |
p03274 | u941753895 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\n\ndef LI(): return list(map(int,input().split()))\ndef II(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\ndef main():\n n,k=LI()\n l... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s359204815', 's729261715', 's692792721'] | [17192.0, 17636.0, 17136.0] | [104.0, 2104.0, 93.0] | [1103, 787, 515] |
p03274 | u952491523 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import sys\n\ndef ans(index, array, k):\n r = right(index, array, k)\n l = left(index, array, k)\n return min(r, l)\n\n\ndef right(index, array, k):\n start = min(index, k)\n count = sys.maxsize\n for i in range(start, min(len(array), k+index)):\n tmp = array[i]\n j = index - (k - (i ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s221357209', 's665857566', 's941025542', 's872693491'] | [14564.0, 14788.0, 14480.0, 14788.0] | [85.0, 76.0, 80.0, 81.0] | [1117, 1094, 1133, 1115] |
p03274 | u977193988 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\nX=[int(i) for i in input().split()]+[0]\nX.sort()\nsn=X.index(0)\nprint(X)\nroad=[]\nfor j in range(sn):\n if X[j+k]>0:\n road.append(abs(X[j]-0)+abs(X[j+k]-X[j]))\n else:\n road.append(abs(X[j]-0)+abs(X[j+k-1]-X[j]))\n\nfor j in range(sn+1,n-k+1):\n road.append(ab... | ['Runtime Error', 'Accepted'] | ['s450068269', 's664959889'] | [14568.0, 14252.0] | [90.0, 96.0] | [391, 296] |
p03274 | u987170100 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map(int, input().split())\nlst = [int(x) for x in input().split()]\nlst1 = [x for x in lst if x > 0]\nlst2 = list(reversed([x for x in lst if x < 0]))\n\nlen1 = len(lst1)\nlen2 = len(lst2)\nret = 100 ** 100\nfor x in range(K + 1):\n print(x)\n lst_a = lst1[:x]\n lst_b = lst2[: K - x]\n if len(lst_a... | ['Wrong Answer', 'Accepted'] | ['s870203790', 's319512927'] | [14480.0, 14224.0] | [2104.0, 102.0] | [673, 375] |
p03274 | u993622994 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n, k = map(int, input().split())\nx = list(map(int, input().split()))\nans = 10**9 + 10\n\nfor i in range(n-k+1):\n left = i\n right = i+k\n to_right = abs(x[left]) + abs(x[right]-x[left])\n to_left = abs(x[right]) + abs(x[right]-x[left])\n if min(to_right, to_left) < ans:\n ans = min(to_right, ... | ['Runtime Error', 'Accepted'] | ['s105160136', 's901960455'] | [14224.0, 14224.0] | [103.0, 102.0] | [328, 330] |
p03275 | u454481887 | 2,000 | 1,048,576 | We will define the **median** of a sequence b of length M, as follows: * Let b' be the sequence obtained by sorting b in non-decreasing order. Then, the value of the (M / 2 + 1)-th element of b' is the median of b. Here, / is integer division, rounding down. For example, the median of (10, 30, 20) is 20; the median... | ['print(20)', 'print(10)', 'N = int(input())\na_list = list(map(int, input().split()))\ndef search(c):\n bar = N\n r = 0\n res_nega = 0\n dp_arr = [0]*(2*N+1)\n for i in range(N):\n dp_arr[bar] += 1\n if a_list[i] < c:\n r += dp_arr[bar]\n bar += 1\n else:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s620465791', 's669607033', 's834976657'] | [2940.0, 2940.0, 14468.0] | [17.0, 22.0, 939.0] | [9, 9, 781] |
p03276 | u047668580 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | [' N,K = list(map(int,input().split()))\nxs = list(map(int,input().split()))\n\nans = 10 ** 10\nfor i,x in enumerate(xs):\n if N == 1:\n ans = abs(x)\n if i + K > N and i > 0:\n break\n num = abs(xs[ i + K - 1 ] - xs[i]) + abs(xs[i])\n num1 = abs(xs[ i + K - 1 ] - xs[i]) + abs(xs[i + K -1]... | ['Runtime Error', 'Accepted'] | ['s925673458', 's545862478'] | [2940.0, 14224.0] | [17.0, 112.0] | [350, 349] |
p03276 | u064408584 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int, input().split())\na=list(map(int, input().split()))\nb=sorted([-1*i for i in a])\nans=10**9\nfor i in range(n-k+1):\n if a[i]>=0:ans=min(ans,a[k-1])\n else:\n ans=min(ans,a[k+i-1]-a[i]*2)\nfor i in range(n-k+1):\n if b[i]>=0:ans=min(ans,a[k-1])\n else:\n ans=min(ans,b[k+i-1]-b[i... | ['Wrong Answer', 'Accepted'] | ['s446087609', 's300100997'] | [14252.0, 14844.0] | [100.0, 110.0] | [323, 377] |
p03276 | u201234972 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['from bisect import bisect\nN, K = map( int, input().split())\nX = list( map( int, input().split()))\nI = bisect(X, -1)\nXmin = X[:I]\nXmin = [ -x for x in Xmin[::-1]]\nXplu = X[I:]\nprint(Xmin)\nH = [10**9]*(10**5)\nXmin += H\nXplu += H\nans = 10**9\nfor i in range( min(I, K)):\n if i == K-1:\n ans = min(an... | ['Wrong Answer', 'Accepted'] | ['s857685872', 's389559591'] | [15504.0, 14480.0] | [122.0, 105.0] | [521, 509] |
p03276 | u218843509 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['from bisect import bisect_left\n\nn, k = map(int, input().split())\nx = list(map(int, input().split()))\npos = bisect_left(x, 0)\n\n\nif x[0] >= 0:\n\tprint(x[k - 1])\nelif x[-1] <= 0:\n\tprint(-x[-k])\nelse:\n\tans = float("inf")\n\tif pos + k <= n:\n\t\tans = x[pos + k - 1]\n\tif x[pos] == 0:\n\t\tif pos - k - 1 >=... | ['Wrong Answer', 'Accepted'] | ['s289544228', 's513694038'] | [14548.0, 14388.0] | [92.0, 77.0] | [625, 657] |
p03276 | u237362582 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ["N, K = map(int, input().split(' '))\nx = list(map(int, input().split(' ')))\n\nx_min = []\nfor i in range(N):\n if x[i] == 0:\n K -= 1\n if x[i] > 0:\n break\n\nx_min = [0] + x[0:i][::-1]\nx_plus = [0] + x[i:]\nlength_m = len(x_min)\nlength_p = len(x_plus)\n\nans = 2*(x[0]) + x[-1]\n\nfor i in ran... | ['Runtime Error', 'Accepted'] | ['s711733840', 's933307940'] | [14480.0, 14252.0] | [111.0, 97.0] | [716, 271] |
p03276 | u343454379 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K=map(int,input().split())\nx=list(map(int,input().split()))\n\na=[]\nfor i in range(N-K+1):\n a.append(x[K-1+i]-x[i]+abs(x[i]))\nprint(min(a))\nprint(a)', 'N,K=map(int,input().split())\nx=list(map(int,input().split()))\n\na=[]\nfor i in range(N-K+1):\n a.append(x[K-1+i]-x[i]+min(abs(x[i]),abs(x[K-1+i])))\nprint(... | ['Wrong Answer', 'Accepted'] | ['s563161365', 's855587657'] | [14388.0, 14392.0] | [69.0, 81.0] | [149, 159] |
p03276 | u397531548 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K=map(int,input().split())\nX=list(map(int,input().split()))\nif X[0]>=0:\n b=X[K]\nelif X[-1]<=0:\n b=X[-K]\nelif 0 in X:\n a=0\n b=10**9\n for i in range(N):\n if X[i]==0:\n a=i\n break\n for j in range(max(0,K-1-a),min(K,N-a)):\n if b>X[a+j]-X[a+j-K+1]+min(ab... | ['Runtime Error', 'Accepted'] | ['s101954133', 's363590378'] | [14308.0, 14252.0] | [291.0, 91.0] | [789, 690] |
p03276 | u405483159 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N, K = map( int, input().split() )\nx = list( map( int, input().split() ))\n \nret = 10 ** 18\nfor i in range( N - K + 1 ):\n s = x[ i: K + i ]\n l, r = s[ 0 ], x[ - 1 ]\n ret = min( ret, abs( l - r ) + min( abs( r ), abs( l ) ) )\nprint( ret )', 'N, K = map( int, input().split() )\nx = list( map( int, input().spl... | ['Wrong Answer', 'Accepted'] | ['s010880999', 's666871778'] | [14384.0, 14384.0] | [2104.0, 89.0] | [239, 223] |
p03276 | u452786862 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import statistics\n\ndef Medi(Arra, Haba):\n re = []\n for i_M in range(len(Arra) - Haba + 1):\n re.append(statistics.median_high(Arra[i_M: i_M+Haba]))\n return re\n\nN = int(input())\nA = list(map(int, input().split()))\nprint(A)\nans = []\n\nif N == 1:\n ans.append(A[0])\nelse:\n kuri = max(N/... | ['Runtime Error', 'Accepted'] | ['s245600604', 's712303046'] | [5724.0, 14352.0] | [147.0, 81.0] | [453, 571] |
p03276 | u496009935 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['from scipy.special import comb\nimport itertools\n\nn, k = map(int, input().split())\nx = list(map(int, input().split()))\nX = []\nm = 3*10**8\n\nfor v in itertools.combinations(x, k):\n X.append(list(v))\n\nfor i in range(comb(n, k, exact=True)):\n m0 = min(X[i])\n m1 = max(X[i])\n a = min(abs(abs(m0)+ab... | ['Runtime Error', 'Accepted'] | ['s247738404', 's538330464'] | [1281996.0, 20064.0] | [2236.0, 85.0] | [371, 216] |
p03276 | u619819312 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k=map(int,input().split())\na=list(map(int,input().split()))\ns=[]\nif n==1:\n print(a[0])\nelse:\n for i in range(n-k+1):\n if a[i]<=0 and 0<=a[i+k-1]:\n s.append(min(2*a[i+k-1]-a[i],a[i+k-1]-2*a[i]))\n elif a[i+k]<=2:\n s.append(-a[i])\n else:\n s.append... | ['Runtime Error', 'Accepted'] | ['s647761781', 's266002936'] | [14252.0, 14844.0] | [91.0, 90.0] | [334, 336] |
p03276 | u637175065 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**10\nmod = 10**9+7\ndd = [(-1,0),(0,1),(1,0),(0,-1)]\nddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\ndef LI(): return [int(x) for x in... | ['Wrong Answer', 'Accepted'] | ['s131057077', 's032689496'] | [16656.0, 16776.0] | [113.0, 112.0] | [1086, 1112] |
p03276 | u669696235 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['N,K=map(int,input().split())\nx=list(map(int,input().split()))\nans=10000000000000000000\nfor i in range(0,N-K+1):\n ls=(x[i])\n rs=(x[i+K-1])\n print(x[i],x[i+K-1])\n if(ls>0 and rs>0):\n ans=min(ans,rs)\n elif(ls<0 and rs<0):\n ans=min(ans,abs(ls))\n else:\n ans=min(abs(ls)+rs... | ['Wrong Answer', 'Accepted'] | ['s882392452', 's772349186'] | [14568.0, 14224.0] | [160.0, 97.0] | [339, 314] |
p03276 | u691896522 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n, k = list(map(int, input().split()))\nx = list(map(int, input().split()))\ni = 0\nmi = x[-1] - x[0] + min(abs(x[-1]),abs(x[0]))\nif n == 1:\n print("a")\n print(abs(x[0]))\n exit()\nwhile i <= n - k:\n print("{} {}".format(x[i + k - 1], x[i]))\n if mi >= ( x[i + k - 1] - x[i]) + min(abs(x[i + k - 1]... | ['Wrong Answer', 'Accepted'] | ['s509616733', 's841761642'] | [14480.0, 14844.0] | [192.0, 122.0] | [412, 350] |
p03276 | u813102292 | 2,000 | 1,048,576 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | ['n,k = (int(i) for i in input().split())\nx = list(int(i) for i in input().split())\nres = 0.0\nfor i in range(n-k):\n xl = x[i]\n xr = x[i+k]\n tmp = min(abs(xl)+abs(xr-xl), abs(xr)+abs(xr-xl))\n if type(res)==type(0.0):\n res = tmp\n else:\n res = min(res,tmp)\nprint(res)', 'n,k = (int(i... | ['Wrong Answer', 'Accepted'] | ['s023704820', 's552516873'] | [14252.0, 14224.0] | [116.0, 103.0] | [291, 241] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.