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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03273 | u934788990 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ["h, w = map(int, input().split())\na = [''] * h\nfor i in range(h):\n\ta[i] = input()\nprint(a)\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n\tfor j in range(w):\n\t\tif a[i][j] == '#':\n\t\t\trow[i] = True\n\t\t\tcol[j] = True\nprint(row)\nprint(col)\nfor i in range(h):\n\tif row[i]:\n\t\tfor j in range... | ['Wrong Answer', 'Accepted'] | ['s551101918', 's934610343'] | [4212.0, 4468.0] | [30.0, 30.0] | [347, 316] |
p03273 | u934868410 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ["h,w = map(int,input().split())\na = list()\n\nfor i in range(h):\n a.append(list(map(int, input().split())))\n\nh_blank = [False]*h\nw_blank = [False]*w\nfor i in range(h):\n blank = True\n for j in range(w):\n if a[i][j] == '#':\n blank = False\n break\n if blank:\n h_blank[i] = True\n\nfor i in ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s639228058', 's778071149', 's888220439', 's866332814'] | [3064.0, 3700.0, 3064.0, 4468.0] | [18.0, 26.0, 17.0, 29.0] | [543, 519, 543, 555] |
p03273 | u937529125 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['a = list(map(int,input().split()))\nh = a[0]\nw = a[1]\nli=[input() for i in range(h)]\n\nans = 0\nminans = 0\nflag = 0\nrow = [False] * h\ncol = [False] * w\nfor i in range(h):\n for j in range(w):\n if li[i][j] == "#":\n row[i]=True\n col[j]= True\nfor i in range(h):\n if row[i]:\... | ['Wrong Answer', 'Accepted'] | ['s921306826', 's631170522'] | [3700.0, 4468.0] | [30.0, 30.0] | [426, 424] |
p03273 | u940568210 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['import numpy as np\n\nh, w = tuple(map(int, input().split()))\nmatrix = np.zeros((h, w), dtype=bool)\nfor i in range(h):\n row = np.array(input().split())\n matrix[i, :] = row == "."\n\nfor i in range(h)[::-1]:\n if np.all(matrix[i, :]):\n matrix = np.delete(matrix, i, 0)\n\nfor i in range(w)[::-1]:\n... | ['Wrong Answer', 'Accepted'] | ['s174191731', 's252609642'] | [22672.0, 3060.0] | [350.0, 19.0] | [494, 407] |
p03273 | u953379577 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['h,w = map(int,input().split())\n\nf = []\n\nfor i in range(h):\n f.append(list(input()))\n \nfor i in f:\n if i == ["."]*len(i):\n f.remove(i)\n \nf2 = []\n\nfor i in range(w):\n s = []\n \n for k in f:\n s.append(k[i])\n \n f2.append(s)\n \nfor i in f2:\n if i =... | ['Wrong Answer', 'Accepted'] | ['s041410212', 's629109307'] | [4596.0, 4724.0] | [29.0, 31.0] | [435, 785] |
p03273 | u955251526 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['h, w = map(int, input().split())\nhlist = []\nwlist = []\na = [list(input()) for i in range(h)]\nfor i in range(h):\n for j in range(w):\n if a[i][j] == "#":\n hlist.append(i)\n wlist.append(j)\nprint(hlist,wlist)\nfor i in set(hlist):\n for j in set(wlist):\n print(a[i][j], ... | ['Wrong Answer', 'Accepted'] | ['s464660925', 's311705292'] | [4980.0, 4724.0] | [49.0, 46.0] | [326, 307] |
p03273 | u957872856 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['h,w = map(int,input().split())\na = [[j for j in input()] for i in range(h)]\nb = [x for x in a if "#" in x]\nprint(*b)\nc = zip(*[y for y in zip(*b) if "#" in y])\n#print(list(c))\nfor d in c:\n print("".join(d))', 'h,w = map(int,input().split())\na = [[j for j in input()] for i in range(h)]\nb = [x for x in a if "... | ['Wrong Answer', 'Accepted'] | ['s263839198', 's348916020'] | [3188.0, 3188.0] | [20.0, 18.0] | [207, 208] |
p03273 | u961595602 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ["# -*- coding: utf-8 -*-\nfrom sys import stdin\n\nns = lambda: stdin.readline()[:-1] \nni = lambda: int(stdin.readline()) # N = ni()\nna = lambda: list(map(int, stdin.readline().split())) # Arr = na()\n\nH, W = na()\nGrid = []\nfor _ in range(H):\n s = ns()\n if '#' in s:\n Grid.append(list(s))\n\nh = le... | ['Wrong Answer', 'Accepted'] | ['s467307690', 's232054647'] | [3188.0, 3188.0] | [22.0, 22.0] | [557, 555] |
p03273 | u971237642 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['# -*- coding: utf-8 -*-\n\nh,w = map(int, input().split())\n\na = [list(input()) for _ in range(h)]\n\na_new = []\nfor row in a:\n cache = set(row)\n if (len(cache) == 1) and (row[0] == "."):\n pass\n else:\n a_new.append(row)\n\nn_h = len(a_new)\nn_w = len(a_new[0])\n\nb_new = [["" for _ in ra... | ['Runtime Error', 'Accepted'] | ['s805162765', 's612997385'] | [3316.0, 4468.0] | [24.0, 30.0] | [851, 411] |
p03273 | u975481854 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['h, w = map(int, input().split())\na = [input() for w in range(h)]\n\nfor i in range(h)[::-1]:\n if "#" not in a[i]:\n del a[i]\n h -= 1\nprint(a)\n\nn = []\nfor j in range(w):\n print("j=" + str(j))\n m = ["".join(t[j] for t in a)]\n if "#" in m[0]:\n n += m\nprint(n)\n\nfor k in rang... | ['Runtime Error', 'Accepted'] | ['s210563612', 's275532335'] | [3064.0, 3060.0] | [19.0, 19.0] | [332, 300] |
p03273 | u982198202 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ["N, M = map(int, input().split())\na = [input() for i in range(N)]\ncounter = 0\nnumlist = []\ndelMlist = []\n\nfor i in range(N):\n #print(a[i])\n if a[i].count('#') == 0:\n delMlist.append(i)\n#print(delMlist)\n\nfor i in delMlist:\n a.pop(i-counter)\n #print(a)\n counter += 1\nprint('---------... | ['Wrong Answer', 'Accepted'] | ['s611179705', 's963217674'] | [4084.0, 4084.0] | [25.0, 25.0] | [1080, 1090] |
p03273 | u987164499 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['from sys import stdin\nimport numpy as np\n\nh,w= [int(x) for x in stdin.readline().rstrip().split()]\n\nli = [["" for i in range(w)]for j in range(h)]\n\nfor i in range(h):\n s = stdin.readline().rstrip()\n for j in range(w):\n li[i][j] = s[j]\n\nli = np.asarray([s for s in li if s != [\'.\']*w]).T.toli... | ['Wrong Answer', 'Accepted'] | ['s620446919', 's878437113'] | [13136.0, 3188.0] | [161.0, 23.0] | [421, 680] |
p03273 | u991567869 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['h, w = map(int, input().split())\na = []\ndelrow = []\ndelcol = []\n\n\nfor i in range(h):\n a.append(list(input()))\n\nfor i in range(h):\n print(set(a[i]))\n if set(a[i]) == {"."}:\n delrow.append(i)\n\nfor i in range(w):\n print(set(a[0:w][i]))\n if set(a[0:w][i]) == {"."}:\n delcol.ap... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s208853904', 's273971622', 's311525808'] | [4340.0, 4596.0, 4596.0] | [22.0, 21.0, 22.0] | [504, 457, 326] |
p03273 | u992910889 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['H,W=map(int,input().split())\nA=[list(input()) for i in range(H)]\nprint(A)\n\n', "\n# import copy\n# import fractions\n# import math\n# import numpy as np\n# from collections import Counter, deque\n# from itertools import accumulate, permutations, combinations, combinations_with_replacement, product\n\n\ndef resolve... | ['Wrong Answer', 'Accepted'] | ['s524878459', 's402230790'] | [3188.0, 4596.0] | [18.0, 21.0] | [551, 494] |
p03273 | u993435350 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['H,W = map(int,input().split())\n\nA = ""\n\nfor _ in range(H):\n s = input()\n if len(set(s)) == 1 and s == "." * W:\n H -= 1\n else:\n for i in s:\n A.append(i)\n\nif len(A) == 0:\n print(A)\n\nelse:\n M = []\n\n for i in range(W):\n if A[i] == ".":\n for j in range(i + W,H * W,W):\n ... | ['Runtime Error', 'Accepted'] | ['s487765922', 's842131549'] | [3064.0, 3188.0] | [17.0, 24.0] | [540, 535] |
p03273 | u998771223 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ["import numpy as np\nWH='.'\nBK='#'\nx=input()\nx=x.split()\nH=int(x[0])\nW=int(x[1])\na=[[] for i in range(H)]\nnum=[]\nnumnum=0\nfor i in range(H):\n x=input()\n for j in range(W):\n a[i].append(x[j])\nfor i in range(H):\n flag=0\n for j in range(W):\n if a[i][j]==WH:\n flag=flag... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s163449458', 's387923536', 's860013125', 's651189674'] | [12516.0, 12516.0, 12508.0, 12512.0] | [160.0, 159.0, 166.0, 167.0] | [766, 807, 867, 934] |
p03273 | u999503965 | 2,000 | 1,048,576 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | ['h,w=map(int,input().split())\nlis=[list(input()) for i in range(h)]\n\nfin=[]\n\nfor l in lis:\n if l.count(".") != w:\n fin.append(l)\n else: \n h=h-1\n\nnum=[]\nfor i in range(w):\n cnt=0\n for f in fin:\n if f[i] == ".":\n cnt+=1\n if cnt == h:\n num.append(i)\n \nfor i in num:\n for f... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s212378711', 's606743446', 's350717961'] | [9212.0, 9236.0, 9180.0] | [26.0, 31.0, 36.0] | [349, 476, 315] |
p03274 | u020604402 | 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()))\nLplus = list(filter(lambda x: x>=0, L))\nLminus = list(filter(lambda x: x<0 ,L))[::-1]\nans_table = []\n#print(L)\n#right_only\nif len(Lplus) >= K:\n ans_table.append(Lplus[K-1])\n#left_only\nif len(Lminus) >= K:\n ans_table.append(Lminus[K-1])... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s331100691', 's639556979', 's726044043', 's347245213'] | [14252.0, 14884.0, 141304.0, 14252.0] | [152.0, 86.0, 2104.0, 165.0] | [874, 877, 322, 993] |
p03274 | u033606236 | 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())\nary = [0] + list(map(int, input().split()))\nary = sorted(ary)\na = ary.index(0)\nans = float("Inf")\nfor i in range(N + 1):\n if i == a: continue\n\n k = abs(i - a)\n d = abs(ary[i])\n if k >= K and ans > d:\n ans = d\n if i < a:\n k = K - abs(i - a)\n ... | ['Wrong Answer', 'Accepted'] | ['s607874280', 's875965129'] | [14480.0, 14568.0] | [2104.0, 122.0] | [516, 557] |
p03274 | u036340997 | 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 = 0\nfor i in range(n):\n d = x[i+k-1] - x[i] + min(abs(x[i]), abs(x[i+k-1]))\n ans = min(ans, d)\n \nprint(ans)', 'n,k=map(int,input().split())\nx=list(map(int,input().split()))\na=10**9\nfor i in range(n-k+1):\n d=x[i+k-1]-x[i]+min(abs... | ['Runtime Error', 'Accepted'] | ['s185311025', 's275421115'] | [14252.0, 14384.0] | [94.0, 89.0] | [184, 162] |
p03274 | u052499405 | 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 = [int(item) for item in input().split()]\nx = [int(item) for item in input().split()]\n\nlft_num = bisect.bisect(x, 0)\nrgt_num = n - lft_num\n\nprint(rgt_num, lft_num)\nans = 10**10\nfor i in range(min(rgt_num, k)):\n r = x[lft_num + i]\n distance = abs(r)\n if i+1 == k: \n ans =... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s073831632', 's293056494', 's929175526'] | [14384.0, 14480.0, 14096.0] | [148.0, 145.0, 148.0] | [771, 734, 738] |
p03274 | u059210959 | 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... | ['# encoding utf-8\n\nN, K = map(int, input().split())\n\nx = list(int(i) for i in input().split())\n\n\nfor i in range(N):\n if 0 <= x[i]:\n border = i\n break\n\nlen_run = 100000\n\nif border == 0:\n len_run = min(abs(x[K-1]), len_run)\n\nif border == N-1:\n len_run = min(abs(x[N-K]), len_run)\... | ['Runtime Error', 'Accepted'] | ['s578767327', 's384674975'] | [14564.0, 14568.0] | [126.0, 98.0] | [1683, 300] |
p03274 | u059262067 | 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\nb = list(map(int, input().split()))\na = list(map(int, input().split()))\nx = b[0]-b[1]+1\nres = 10**10\n \nfor i in range(x):\n tmp = i + b[1] - 1\n res = min( a[tmp]-a[i] + min(-a[i],a[tmp]),res)\n \nprint(res)', 'import numpy as np\nb = list(map(int, input().split()))\na = list(map... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s122931656', 's175159276', 's253599882', 's282245627'] | [23080.0, 23084.0, 23052.0, 14224.0] | [211.0, 335.0, 380.0, 103.0] | [235, 235, 235, 273] |
p03274 | u070561949 | 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 = int(input())\nb = list(map(int,input().split()))\n\n#b = list(set(a))\nb.sort()\nprint(b)\n \nif len(b) > 1:\n l = len(b)//2\n print(b[l])\nelse:\n print(b[0])\n ', 'n,k = map(int,input().split())\n\nx = list(map(int,input().split()))\n\nx.append(0)\nx.sort()\n\nmin = 10**8\n\nzeroIdx = x.index(0)... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s127208683', 's168203220', 's369971917', 's499927238', 's749940779', 's837572078', 's813888742'] | [2940.0, 14252.0, 14252.0, 14224.0, 14484.0, 3060.0, 14844.0] | [17.0, 96.0, 104.0, 94.0, 96.0, 17.0, 84.0] | [170, 914, 909, 909, 909, 161, 533] |
p03274 | u076917070 | 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\ninput=sys.stdin.readline\n\ninput = open(sys.argv[1],"r").readline\n\ndef main():\n N,K = map(int, input().split())\n X = list(map(int, input().split()))\n ans = 3*10**8\n for i in range(0,N-K+1):\n l = X[i]\n r = X[i+K-1]\n if l*r < 0:\n ans = min(ans, 2*min(ab... | ['Runtime Error', 'Accepted'] | ['s955387390', 's823259858'] | [3064.0, 14596.0] | [17.0, 83.0] | [456, 416] |
p03274 | u077291787 | 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... | ['\ndef main():\n N, K, *X = map(int, open(0).read().split())\n ans = float("inf")\n for l, r in zip(X, X[k - 1 :]):\n ans = min(ans, r - l + min(abs(l), abs(r)))\n print(ans)\n\n\nif __name__ == "__main__":\n main()', '\ndef main():\n N, K, *X = map(int, open(0).read().split())\n cand = [r ... | ['Runtime Error', 'Accepted'] | ['s799329647', 's353011745'] | [14052.0, 14052.0] | [42.0, 59.0] | [255, 237] |
p03274 | u083960235 | 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... | ["\nimport sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, a... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s085451043', 's108839562', 's891181527', 's951993120', 's907374021'] | [16312.0, 16316.0, 16324.0, 16320.0, 15012.0] | [130.0, 150.0, 142.0, 137.0, 97.0] | [1623, 1623, 1323, 1307, 1024] |
p03274 | u085717502 | 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... | ['#!/usr/bin/env python\n# coding: utf-8\n\n# In[26]:\n\n\nN,K = map(int, input().split())\nx = list(map(int, input().split()))\n\n\n# In[33]:\n\n\nans = max([abs(y) for y in x])\nfor i in range(N-K+1):\n tmp = x[i:i+K]\n ans = min(abs(tmp[0])+(tmp[K-1]-tmp[0]),abs(tmp[K-1])+(tmp[K-1]-tmp[0]))\nprint(ans)\n\n\n# ... | ['Wrong Answer', 'Accepted'] | ['s684485538', 's828427949'] | [20004.0, 20072.0] | [2206.0, 86.0] | [309, 271] |
p03274 | u102126195 | 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()))\ndis = []\nfor i in range(N - K + 1):\n dis.append(abs(x[i] - x[i + K - 1]) + abs(x[i]))\n dis.append(abs(x[i] - x[i + K - 1]) + abs(x[i + k - 1]))\nprint(min(dis))\n', 'N, K = map(int, input().split())\nx = list(map(int, input().split()))\nd... | ['Runtime Error', 'Accepted'] | ['s007432395', 's710835082'] | [14252.0, 14392.0] | [42.0, 94.0] | [235, 235] |
p03274 | u102902647 | 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 = 9, 5\n\nN, K = map(int, input().split())\nX = [int(i) for i in input().split()]\nX_plus = []\nX_minus = []\nfor i in range(N):\n if X[i] < 0:\n X_minus.append(X[i])\n else:\n X_plus.append(X[i])\n\n# print(X_minus)\nres = []\nlen_plus = len(X_plus)\nlen_minus = len(X_minus)\nif len_minus ... | ['Runtime Error', 'Accepted'] | ['s242360674', 's078265320'] | [3064.0, 14228.0] | [17.0, 118.0] | [886, 904] |
p03274 | u103730790 | 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()))\ntime = 10**9\n\nfor i in range(n - k + 1):\n x_k = [ x[i], x_k[i+k-1] ]\n #print(x_k)\n \n if x_k[0] >= 0:\n t = x_k[1]\n \n elif x_k[1] <= 0:\n t = -x_k[0]\n \n else:\n t = min(-x_k[0] + x_k[1] *... | ['Runtime Error', 'Accepted'] | ['s538970166', 's064533962'] | [14224.0, 14224.0] | [42.0, 97.0] | [369, 394] |
p03274 | u111365362 | 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... | ["X,Y = map(int,input().split())\nwhole = []\nfor i in range(X):\n now = input()\n if now == '.' * Y:\n pass\n else:\n add = []\n for i in range(Y):\n if now[i] == '.':\n add.append(0)\n else:\n add.append(1)\n whole.append(add)\nj = 0\nwhile j < len(whole[0]):\n for i in range(l... | ['Runtime Error', 'Accepted'] | ['s867714979', 's325607393'] | [5452.0, 14224.0] | [35.0, 93.0] | [586, 288] |
p03274 | u117348081 | 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... | ['INF = 1e9\nn,k = map(int, input().split())\nx = list(map(int, input().split()))\nans = INF\nfor i in range(n-k):\n if x[i]*x[i+k-1]<0:\n a = abs(x[i])+x[i+k-1] + min(abs(x[i], x[i+k-1]))\n else:\n a = abs(x[i+k-1])\n \n ans = min(ans, a)\n\nif k==1:\n ans = abs(x[0])\nprint(ans)', 'INF = ... | ['Runtime Error', 'Accepted'] | ['s169338671', 's207751632'] | [14568.0, 14532.0] | [76.0, 114.0] | [294, 324] |
p03274 | u123756661 | 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... | ['#!/usr/bin/env python3\n# -*- coding: UTF-8 -*-\n\n#WAA TLEEEEEEEEEE\nn,k=map(int,input().split())\nx=[int(i) for i in input().split()]\nl,r=[],[]\nfor i in range(n):\n if x[i]<0 and i+1<n: l.append(abs(x[i]-min(x[i+1],0)))\n elif x[i]<0: l.append(-x[i])\n if x[i]>=0 and i>0: r.append(x[i]-max(0,x[i-1]))\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s162847655', 's516950567', 's678684664', 's858884471', 's756566667'] | [14252.0, 14104.0, 14252.0, 145300.0, 14148.0] | [184.0, 391.0, 2104.0, 2104.0, 406.0] | [732, 879, 582, 708, 804] |
p03274 | u131638468 | 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\nn,k,*x=map(int,open(0).read().split())\ninf=float('inf')\nk-=x.count(0)\nx=np.array(x)\npos=list(x[x>0])\nneg=list((x[x<0]*-1)[::-1])\nx=[]\nans=inf\nsum_p=pos[:min(len(pos),k)]\nsum_n=neg[:min(len(neg),k)]\npos.clear()\nneg.clear()\np_inf,n_inf=k-len(sum_p),k-len(sum_n)\nsum_p=sum_p+[inf for i in... | ['Wrong Answer', 'Accepted'] | ['s988149491', 's810728129'] | [37640.0, 20020.0] | [376.0, 98.0] | [598, 284] |
p03274 | u160244242 | 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\nn, k = map(int, input().split())\nlst = list(map(int, input().split()))\n\narray = np.array(lst)\npo_array = array[array>=0]\nne_array = abs(array[array<0])\nne_array.sort()\n\nif len(po_array) >= len(ne_array):\n long_array = po_array\n short_array = ne_array\nelse:\n long_array = ne_a... | ['Runtime Error', 'Accepted'] | ['s815151000', 's695173812'] | [3064.0, 23124.0] | [17.0, 393.0] | [842, 923] |
p03274 | u163320134 | 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())\narr=list(map(int,input().split()))\narr=sorted(arr)\nans=10**10\nfor i in range(n-k):\n if k==1:\n ans=min(ans,abs(arr[i]))\n else:\n if arr[i]*arr[i+k]>=0:\n ans=min(ans,min(abs(arr[i]),abs(arr[i+k])))\n else:\n ans=min(ans,min(2*abs(arr[i])+arr[i+k],abs(arr[i])+2*a... | ['Wrong Answer', 'Accepted'] | ['s610529192', 's307902689'] | [14568.0, 14252.0] | [105.0, 103.0] | [327, 337] |
p03274 | u167681750 | 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())))\nf = sorted([i if i >= 0 else -(i * 2) for i in x])\nb = sorted([-i if i < 0 else i * 2 for i in x ])\n\nmove = min(f[k - 1], b[k - 1])\n\na = [i for i in x if move >= abs(i)]\nprint(move + min(-a[0], a[-1]) if a[0] < 0 and 0 < a[-1] else mo... | ['Wrong Answer', 'Accepted'] | ['s150220025', 's444859946'] | [15760.0, 14392.0] | [73.0, 90.0] | [312, 204] |
p03274 | u169138653 | 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()))\nlis=[]\nfor i in range(n-k+1):\n if x[i]<=0 and x[i+k-1]>=0:\n lis.append(min(x[i+k-1]-2*x[i],abs(x[i])-2*x[i+k-1]))\n elif x[i]>0 and x[i+k-1]<0:\n lis.append(min(x[i]-2*x[i+k-1],abs(x[i+k-1])-2*x[i]))\n else:\n lis.append(max(abs(x[i]),abs(... | ['Wrong Answer', 'Accepted'] | ['s225584983', 's626419964'] | [14240.0, 14564.0] | [93.0, 96.0] | [337, 337] |
p03274 | u170183831 | 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, r = -1, n\nwhile r - l > 1:\n p = (l + r) // 2\n if X[p] < 0:\n l = p\n else:\n r = p\n\nif l == -1:\n print(X[k - 1])\nelif r == n:\n print(abs(X[n - k + 1]))\nelse:\n best_score = 10 ** 9\n for i in range(ma... | ['Wrong Answer', 'Accepted'] | ['s543586372', 's371249215'] | [14228.0, 14696.0] | [202.0, 88.0] | [780, 802] |
p03274 | u175034939 | 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 = []\np = []\nfor i in range(n):\n if x[i] < 0:\n m.append(x[i])\n elif x[i] > 0:\n p.append(x[i])\n\nif m and p:\n if k-len(m) >= 0:\n s = 0\n else:\n s = abs(k-len(m))+1\n \n i = 0\n ans = float(... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s106386451', 's139254460', 's459200837'] | [14240.0, 14252.0, 14252.0] | [71.0, 168.0, 122.0] | [694, 719, 510] |
p03274 | u175426149 | 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\n# X = list(map(int, input().split()))\n\nwith open("test.txt", \'r\') as f:\n N, K = map(int, f.readline().split())\n X = list(map(int, f.readline().split()))\n\ndef calc_time(x_max, x_min):\n if x_max * x_min >= 0:\n if abs(x_max) > abs(x_min):\n retur... | ['Runtime Error', 'Accepted'] | ['s437293982', 's893054892'] | [3064.0, 14480.0] | [17.0, 83.0] | [1127, 1002] |
p03274 | u177040005 | 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 i in range(N - K + 1):\n l = i\n r = i + K - 1\n\n Xl, Xr = X[l], X[r]\n if i == 0:\n ans = abs(Xl) + abs(Xr - Xl), abs(Xr) + abs(Xl - Xr)\n else:\n ans = min(abs(Xl) + abs(Xr - Xl), abs(Xr) + abs(Xl - Xr) , ans)\n\... | ['Runtime Error', 'Accepted'] | ['s504750564', 's947437335'] | [14384.0, 14252.0] | [42.0, 95.0] | [318, 323] |
p03274 | u189023301 | 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, m = map(int, input().split())\nlis = list(map(int, input().split()))\nsu = []\n\nfor i in range(n):\n su.append(lis[i] - lis[0])\n\nprint(su)\nres = 10**9\nfor i in range(n - m + 1):\n res = min(res, su[i + m - 1] - su[i] + min(abs(lis[i]), abs(lis[i + m - 1])))\nprint(res)\n', 'n, m = map(int, input().split... | ['Wrong Answer', 'Accepted'] | ['s946197330', 's886473389'] | [14636.0, 14252.0] | [114.0, 87.0] | [273, 206] |
p03274 | u192541825 | 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())\nlst1=input()\nlst2=lst1.split(" ")\nlst=[]\nfor i in lst2:\n lst.append(int(i))\n\nminr=[]\nminl=[]\n\nfor i in range(n-k+1):\n l=i\n r=i+k-1\n minr.sppend(abs(lst[r])+abs(lst[r]-lst[l]))\n minl.append(abs(lst[l])+abs(lst[r]-lst[l]))\n\nminr.sort()\nminl.sort()\n\nm=min(mi... | ['Runtime Error', 'Accepted'] | ['s990945592', 's465796389'] | [15192.0, 19544.0] | [60.0, 114.0] | [322, 324] |
p03274 | u210827208 | 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()))\nV=[0]\nfor i in range(n-k):\n Y=X[i+k-1]-X[i] \n if X[i+k-1]<0:\n V.append(Y-X[i+k-1])\n elif X[i+k-1]>=0 and X[i]<0:\n V.append(Y+min(abs(X[i]),abs(X[i+k-1])))\n else:\n V.append(Y+X[i])\nprint(min(V))', 'n,k=map(int... | ['Wrong Answer', 'Accepted'] | ['s711397627', 's203798566'] | [14532.0, 14384.0] | [100.0, 86.0] | [291, 173] |
p03274 | u219607170 | 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()))\nminval = 10000000000\nfor i in range(N-K+1):\n tmpval = abs(X[i]) + X[i+K-1] - X[i]\n if minval > tmpval:\n minval = tmpval\nX = reversed(X)\nfor i in range(N-K+1):\n tmpval = abs(X[i]) + X[i+K-1] - X[i]\n if minval > tmpval:\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s284303255', 's484434778', 's994894954'] | [14224.0, 14568.0, 14224.0] | [66.0, 67.0, 94.0] | [344, 340, 353] |
p03274 | u221345507 | 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())\na=list(map(int,input().split()))\n\nminus=[]\nfor i in range (N):\n if a[i]<0:\n minus.append(a[i])\nplus=a[len(minus):]\n\nif len(minus)==0:\n print(plus[K-1])\n sys.exit()\nif len(plus)==0:\n minus=minus[::-1]\n print(minus[K-1])\n sys.exit()\n\nif ... | ['Runtime Error', 'Accepted'] | ['s946794644', 's053185502'] | [3064.0, 23088.0] | [18.0, 749.0] | [907, 409] |
p03274 | u223133214 | 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 N == 1:\n print(abs(X[0]))\n exit()\n\n\nflg = False\n\nfor x in X:\n if x < 0:\n flg = True\n\nif flg is False:\n print(X[K - 1])\n exit()\n\n\ndef sol(lft, rgt):\n print(X[lft], X[rgt])\n if X[lft] < 0 and X[rgt]... | ['Wrong Answer', 'Accepted'] | ['s783020119', 's160923144'] | [14480.0, 14224.0] | [207.0, 100.0] | [696, 309] |
p03274 | u225642513 | 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... | ['INF = 10**9\n\nN, K = map(int, input().split())\nx_list = [int(i) for i in input().split()]\nfor i in range(N):\n if x_list[i] >= 0:\n T = i\n break\nelse:\n print(abs(x_list[-K])\n exit()\nmin_take_time = INF\nfor i in range(K+1):\n if T-K+i < 0 or T+i>N:\n continue\n if x_list[T-... | ['Runtime Error', 'Accepted'] | ['s492651828', 's845350736'] | [2940.0, 14664.0] | [17.0, 143.0] | [591, 592] |
p03274 | u226108478 | 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 main():\n n, k = list(map(int, input().split()))\n x = list(map(int, input().split()))\n\n if x[0] < 0:\n diff = abs(x[0])\n\n for i in range(n):\n x[i] += diff\n\n print(min(x[k - 1]), x[-k])\n\n\nif __name__ == '__main__':\n main()\n", "# -*- ... | ['Runtime Error', 'Accepted'] | ['s969038520', 's807998297'] | [14224.0, 14252.0] | [51.0, 73.0] | [290, 518] |
p03274 | u227020436 | 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()))\nassert len(x) == N\n\nm = min(x[i] - x[i-K+1] + min(abs(x[i], abs(x[i-K+1])) for i in range(K-1, N))\nprint(m)', 'N, K = map(int, input().split())\nx = list(map(int, input().split()))\nassert len(x) == N\n\nm = min(b - a + min(abs(a), abs(b)) ... | ['Runtime Error', 'Accepted'] | ['s754833938', 's576345182'] | [2940.0, 15020.0] | [17.0, 60.0] | [178, 164] |
p03274 | u227082700 | 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())\nk-=1\nx=list(map(int,input().split()))\nprint(min(min(abs(x[i],x[i+k]))+abs(x[i]-x[i+k])for i in range(n-k)))', 'n,k=map(int,input().split())\nx=list(map(int,input().split()))\nprint(min(x[i]-x[i-k+1]+min(abs(x[i]),abs(x[i-k+1])) for i in range(k-1,n)))'] | ['Runtime Error', 'Accepted'] | ['s946248258', 's282487594'] | [14380.0, 14252.0] | [43.0, 75.0] | [136, 138] |
p03274 | u228223940 | 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 = [int(i) for i in input().split()]\n\nidx = bisect.bisect_left(x,0)\n"""\nif x[idx] == 0:\n x.insert(idx,0)\n"""\n\nans = 10**100\n\nprint(x[idx])\n\nprint(ans)\nexit()\n\nfor i in range(k+1):\n #print(idx-i,idx+k-1-i)\n if i == 0 and idx+k-1 < n:\n a... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s111704207', 's218647099', 's532468726', 's722839661', 's756330534', 's759999186', 's420872575'] | [14564.0, 14660.0, 14548.0, 14660.0, 14548.0, 14564.0, 14548.0] | [47.0, 49.0, 47.0, 47.0, 48.0, 49.0, 124.0] | [505, 551, 553, 522, 543, 559, 502] |
p03274 | u231095456 | 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()))\nleft = []\nright = []\nfor a in x:\n if a < 0:\n left = [-a]+left\n elif a == 0:\n K -= 1\n else:\n right.append(a)\nans = float("inf") if K > 0 else 0\nif K == 0:\n print(0)\n exit(0)\nif right == []:\n ans = ... | ['Wrong Answer', 'Accepted'] | ['s545698015', 's552086300'] | [20076.0, 20072.0] | [2206.0, 103.0] | [760, 221] |
p03274 | u250583425 | 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\ndef input(): return sys.stdin.readline().rstrip()\n\ndef solve(l, m):\n print(l, m)\n if l < m:\n return l * 2 + m\n else:\n return l + m * 2\n\ndef main():\n N, K = map(int, input().split())\n x = tuple(map(int, input().split()))\n right_x = [i for i in x if i >= 0][:K]\n ... | ['Wrong Answer', 'Accepted'] | ['s939728094', 's220425643'] | [15024.0, 15028.0] | [188.0, 69.0] | [800, 503] |
p03274 | u255280439 | 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 math\nimport collections\nimport itertools\nimport array\nimport inspect\n\n\nsys.setrecursionlimit(1000000)\n\n\n# Debug output\ndef chkprint(*args):\n names = {\n id(v): k\n for k, v in inspect.currentframe().f_back.f_locals.items()\n }\n print(', '.join(\n names.get... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s528062341', 's982774909', 's755481738'] | [16612.0, 16532.0, 15844.0] | [104.0, 94.0, 97.0] | [3194, 3194, 3195] |
p03274 | u259861571 | 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\ncost = float("inf")\n\nfor l in range(N-K+1):\n r = l+K-1\n from_left = abs(x[l]+abs(x[r]-x[l]))\n from_right = abs(x[r]+abs(x[l]-x[r]))\n cost = min(cost, from_left, from_right)\nprint(cost)\n\n', 'N, K = map(int, input().split())\n... | ['Wrong Answer', 'Accepted'] | ['s192378423', 's938711551'] | [14384.0, 15020.0] | [91.0, 86.0] | [268, 223] |
p03274 | u263654061 | 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... | ['for i in range(n-k+1):\n xtmp = x[i:i+k]\n# print(i, xtmp)\n\n if i==0:\n MIN = abs(xtmp[0])+2*abs(xtmp[-1])\n\n MIN = min(MIN, abs(xtmp[0]-xtmp[-1]) + abs(xtmp[0]))\n MIN = min(MIN, abs(xtmp[0]-xtmp[-1]) + abs(xtmp[-1]))\n\nprint(MIN)', 'n, k = map(int, input().split())\nx = list(map(int, inpu... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s413096513', 's470412287', 's755368614'] | [3060.0, 141212.0, 14224.0] | [17.0, 1355.0, 98.0] | [248, 326, 267] |
p03274 | u282228874 | 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()))\nres = 10**10\nfor i in range(N-K+1):\n if X[i]*X[i+K-1] >= 0:\n res = min(res,max(abs(X[i+K-1],X[i])))\n else:\n res = min(res,abs(X[i])*2+X[i+K-1],X[i+K-1]*2+abs(X[i]))\nprint(res)', 'N,K = map(int,input().split())\nX = list(map(... | ['Runtime Error', 'Accepted'] | ['s757382337', 's977421647'] | [14252.0, 14568.0] | [92.0, 91.0] | [261, 266] |
p03274 | u288087195 | 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\nN, K = list(map(int, input().split()))\n\nx = list(map(int, input().split()))\n\n\ndef my_index(l, i, default=False):\n if i in l:\n return True\n else:\n return default\n\n\ndef main():\n global x, K\n if 0 in x:\n K -= 1\n if K == 0:\n return ... | ['Wrong Answer', 'Accepted'] | ['s211677721', 's118262619'] | [23088.0, 23140.0] | [290.0, 287.0] | [2269, 1955] |
p03274 | u300968187 | 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()))\nfirst = True\nfor l, r in zip(range(0, n - k + 1), range(k - 1, n)):\n if 0 >= x[r]:\n if first:\n min_time = -x[l]\n else:\n time =-x[l]\n if time < min_time:\n min_time = time\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s130982299', 's535854981', 's451734543'] | [14568.0, 14564.0, 14380.0] | [79.0, 79.0, 78.0] | [734, 646, 300] |
p03274 | u309141201 | 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()))\nanswer = float('inf')\nfor l, r in zip(x, x[K - 1:]):\n print(l, r)\n cost = r - l + min(abs(l), abs(r))\n answer = cost if cost < answer else answer\n\nprint(answer)", "N, K = map(int, input().split())\nx = list(map(int, input().split())... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s265376017', 's318405043', 's990738063'] | [14228.0, 15020.0, 14224.0] | [129.0, 132.0, 71.0] | [238, 239, 240] |
p03274 | u314050667 | 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 0 not in x:\n k += 1\n x.append(0)\n x = sorted(x)\nx = [abs(i) for i in x]\n\norig = x.index(0)\n\nans = float("inf")\nfor i in range(k):\n f = orig + i\n s = orig + i - k\n if (s >= 0) and (f <= n-1):\n temp1 = x[s]\n ... | ['Wrong Answer', 'Accepted'] | ['s052297749', 's546831571'] | [14224.0, 14384.0] | [97.0, 102.0] | [387, 396] |
p03274 | u325704929 | 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\npoint= len(x) - 1\nfor i, v in enumerate(x):\n if v >= 0:\n point = i\n break\n\nstart = max(0, point - K + 1)\nend = start + K - 1\n\nif x[point] != 0:\n start -= 1\n end -= 1\n \nans = float('inf')\n\nwhile True:\n ... | ['Wrong Answer', 'Accepted'] | ['s290442806', 's359718820'] | [14480.0, 14480.0] | [101.0, 105.0] | [648, 687] |
p03274 | u332657092 | 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 i in range(n):\n if X[i] > 0:\n over_zero = i\n break\nelse:\n over_zero = n\n\nmin_cost = 10**8\n\nif over_zero + k - 1 < n:\n min_cost = X[over_zero + k - 1]\n\nif over_zero - k >= 0:\n min_cost = min(X[over_zero - k], min_cost)\... | ['Runtime Error', 'Accepted'] | ['s367227003', 's163984779'] | [14480.0, 14388.0] | [98.0, 90.0] | [716, 173] |
p03274 | u335038698 | 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 = map(int, input().split())\n\nk = []\n# print(X)\n\nk0 = abs(X[0])\nfor n in range(0+1, K):\n k0 += X[n] - X[n-1]\n# print(k0)\nk.append(k0)\nfor i in range(1, len(X)-K+1):\n # print(i, i-1, i+K, i+K-1)\n ki = k[i-1] - (X[i] - X[i-1]) + (X[i+K-1] - X[i+K-2]) - abs(X[i-1])... | ['Runtime Error', 'Accepted'] | ['s706809565', 's993263355'] | [11460.0, 14480.0] | [26.0, 190.0] | [349, 634] |
p03274 | u347640436 | 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()))\np = n\nfor i in range(n):\n if x[i] > 0:\n p = i\n break\nresult = float('inf')\nfor i in range(max(p - k, 0), min(k - p, k + 1)):\n if i == 0:\n result = min(result, x[p + k - 1])\n elif i == k:\n result = min(result, -x[p - k])\n ... | ['Runtime Error', 'Accepted'] | ['s950540348', 's458867878'] | [14480.0, 14564.0] | [119.0, 95.0] | [417, 436] |
p03274 | u349091349 | 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\nimport bisect\nN,K=map(int,input().split())\nX=[int(i) for i in input().split()]\nmin_=10**10\nfor i in range(N-K+1):\n if X[i] == 0 or X[i+K-1] == 0:\n print(max(abs(X[i]),abs(X[i+K-1])))\n min_=min(min_,max(abs(X[i]),abs(X[i+K-1])))\n elif np.sign(X[i]) == np.sign(X[i+K-1]):\... | ['Wrong Answer', 'Accepted'] | ['s834515153', 's074075113'] | [23092.0, 23084.0] | [547.0, 234.0] | [564, 264] |
p03274 | u350049649 | 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\nif 0 in X:\n K=K-1\n\nRight=[]\nLeft=[]\n \nfor x in X:\n if x>0:\n Right.append(x):\n else:\n Left=[abs(x)]+Left\n\nprint(Right)\nprint(Left)\n \n ', 'import bisect\n\nN,K=map(int,input().split())\nX=list(map(int,inp... | ['Runtime Error', 'Accepted'] | ['s118458244', 's245189786'] | [2940.0, 14660.0] | [18.0, 127.0] | [229, 420] |
p03274 | u369752439 | 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 update():\n cost = list(map(abs, candles))\n min_cost_index = cost.index(min(cost))\n print(min_cost_index)\n start_index = max(0, min_cost_index - K)\n end_index = min(N, min_cost_index + K)\n new_candles = candles[start_index: end_index]\n return new_candles\n\ndef compute_cost(point_candle... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s560894493', 's749633715', 's751214185', 's978889930'] | [14480.0, 15492.0, 14224.0, 15616.0] | [2104.0, 43.0, 2104.0, 72.0] | [911, 903, 564, 853] |
p03274 | u370721525 | 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\nN, K = map(int, input().split())\nx = list(map(int, input().split()))\nfor i in range(N):\n if x[i] == 0:\n p, m = i, i+1\n break\n elif x[i] > 0:\n p, m = i, i\n break\n \nif (x[0]<0) and (x[-1]>0):\n pls = x[p:]\n mns = x[:m]\n ans = math.inf\n\n for i in range(len(pls)):\n if i... | ['Wrong Answer', 'Accepted'] | ['s157177432', 's677222363'] | [19868.0, 20196.0] | [154.0, 126.0] | [908, 886] |
p03274 | u380524497 | 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\ncount_0 = X.count(0)\n\nif k <= count_0:\n print(0)\n exit()\n\nk -= count_0\n\nneg = [x for x in X if x < 0]\npos = [x for x in X if x > 0]\n\nneg_count = len(neg)\npos_count = len(pos)\n\nif not neg:\n print(pos[k-1])\n exit()\nif ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s507625162', 's796914978', 's907491887'] | [3064.0, 14480.0, 14568.0] | [17.0, 113.0, 100.0] | [871, 813, 334] |
p03274 | u383450070 | 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())\ncandle=list(map(int,input().split()))\ncom=list(itertools.product(["1","0"], repeat=n))\nans=2000000000\nfor i in range(n-k):\n if candle[i]<0 and candle[i+k-1]>0:\n temp=min(abs(candle[i]), candle[i+k-1])*2+max(abs(candle[i]), candle[i+k-1])\n else:\n temp=abs(candle[i+k-1]-cand... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s077514805', 's634571288', 's427730717'] | [14384.0, 2940.0, 14844.0] | [42.0, 17.0, 108.0] | [348, 717, 348] |
p03274 | u384679440 | 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 = pow(10, 10)\nfor i in range(N-K+1):\n temp1 = abs(x[i]) + abs(x[i]-x[i+K-1])\n #temp2 = abs(x[i+K-1]) + abs(x[i]-x[i+K-1])\n ans = min(ans, temp1, temp2)\nprint(ans)\n', 'N, K = map(int, input().split())\nx = list(map(int, input().spl... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s783696233', 's960393682', 's342762693'] | [14252.0, 14252.0, 14252.0] | [43.0, 74.0, 85.0] | [243, 177, 214] |
p03274 | u386819480 | 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(_) for _ in input().split())\nx = [int(_) for _ in input().split()]\n', '#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int, K: int, x: "List[int]"):\n\n ans = 10000000000000000000\n\n\n al = []\n\n for i in range(N-K+1):\n if(x[i] <= 0 <= x[i+K-1]):\n w = abs(x[i+K-1]) + a... | ['Wrong Answer', 'Accepted'] | ['s416174286', 's999617806'] | [14252.0, 15148.0] | [46.0, 117.0] | [78, 1006] |
p03274 | u388323466 | 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\narr = list(map(int, input().split()))\n\nans = float('inf')\n\nfor i in range(n - k + 1):\n\tif arr[i] * arr[k + i -1] >= 0:\n\t\ttmp = max(abs(arr[i]), abs(arr[k + i -1]))\n\t\tprint(tmp)\n\telse:\n\t\ttmp = abs(arr[i]) + abs(arr[k + i -1]) + min(abs(arr[i]), abs(arr[k + i -1]))\n\... | ['Wrong Answer', 'Accepted'] | ['s784347813', 's940201530'] | [14384.0, 14568.0] | [135.0, 104.0] | [332, 319] |
p03274 | u408620326 | 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 bisect\ninput = sys.stdin.readline\nN, K = [int(x) for x in input().strip().split()]\nX = [int(x) for x in input().strip().split()]\nb = 1\nif X.count(0) == 0:\n X.insert(bisect.bisect(X, 0), 0)\n b = 0\n\ns = X.index(0)\nans = float('INF')\nprint(X)\nfor i in range(1, K + 1):\n if s + i <... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s000268952', 's032626061', 's264404969'] | [14792.0, 14232.0, 14316.0] | [157.0, 162.0, 150.0] | [944, 984, 935] |
p03274 | u417794477 | 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())\narr = list(map(int, input().split()))\n\nans = float('inf')\nfor i in range(N+1-K):\n print(arr[i],arr[i+K-1])\n if arr[i]<= 0 and arr[i+K-1]>0:\n preans = min(abs(arr[i]*2) + arr[i+K-1], abs(arr[i]) + arr[i+K-1]*2)\n elif arr[i]<=0 and arr[i+K-1]<=0:\n preans ... | ['Wrong Answer', 'Accepted'] | ['s818594507', 's444998677'] | [14844.0, 14564.0] | [173.0, 104.0] | [426, 397] |
p03274 | u426764965 | 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\nfor i in range(k-1, n):\n dR = abs(x[i]) + abs(x[i] - x[i-k+1])\n dL = abs(x[i-k+1]) + abs(x[i] - x[i-k+1])\n ans = min(ans, dR, dL)\n print(i, dR, dL)\nprint(ans)', 'n, k = map(int, input().split())\nx = list(map(int, input().spl... | ['Wrong Answer', 'Accepted'] | ['s696216361', 's743228633'] | [14384.0, 14224.0] | [194.0, 98.0] | [243, 224] |
p03274 | u427344224 | 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 = list(map(int, input().split()))\n\nresult = []\nfor i in range(N-K):\n start = i\n end = i + K -1\n result.append(abs(x_list[start] + abs(x_list[end] - x_list[start])))\n result.append(abs(x_list[end]) + abs(x_list[end] - x_list[start] ))\nprint(min(result))', '... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s052467542', 's313040621', 's449962042', 's717507149', 's728026986'] | [14392.0, 14384.0, 14252.0, 14780.0, 14568.0] | [91.0, 96.0, 91.0, 1215.0, 90.0] | [305, 311, 303, 481, 309] |
p03274 | u439176910 | 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(item) for item in input().split()]\ncandles = []\nfor item in input().split():\n if int(item) == 0:\n K -= 1\n continue\n candles.append(int(item))\nK = max(K-1, 0) \nprint(K)\nl = []\nfor i, candle in enumerate(candles):\n sign = candle > 0\n s = 1 if sign else -1\n ik = i-K if sign else i+K\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s429714710', 's966368228', 's987802691'] | [14920.0, 14612.0, 14224.0] | [171.0, 168.0, 109.0] | [503, 503, 293] |
p03274 | u442810826 | 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\ncount_m = 0\ncount_p = 0\nfor i in range(N):\n if x[i] > 0:\n count_m = i\n count_p = N-i\n break\n elif x[i] == 0:\n count_m = i\n count_p = N-i-1\n K -= 1\n N -= 1\n x.remove(x[i])\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s443980963', 's550701223', 's890566134', 's931672816', 's962692596', 's489302443'] | [14480.0, 14240.0, 14228.0, 14252.0, 2940.0, 14484.0] | [318.0, 107.0, 302.0, 307.0, 17.0, 107.0] | [1116, 1164, 1078, 1074, 1164, 1072] |
p03274 | u445226180 | 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(" "))))\n\nans=0\nfor i in range(N-K+1):\n tans=abs(X[i]-X[i+K])+abs(X[i])\n\n if i==0 or ans>tans:\n ans=tans\n \nprint(ans)', 'N,K=map(int,input().split(" "))\nX=sorted(list(map(int,input().split(" "))))\n\nans=0\nfor i in range(N-... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s107349246', 's168142280', 's672742712'] | [14568.0, 14384.0, 14252.0] | [69.0, 61.0, 99.0] | [200, 199, 299] |
p03274 | u445624660 | 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\n\nn, k = map(int, input().split())\narr = list(map(int, input().split()))\n\n\ndef lower_bound(arr, n):\n \n left, right = 0, len(arr)\n while left < right:\n mid = (left + right) // 2\n if arr[mid] < n:\n left = mid + 1\n else:\n right = mid\n return right\n... | ['Wrong Answer', 'Accepted'] | ['s213359442', 's570689224'] | [14532.0, 14480.0] | [128.0, 102.0] | [1016, 681] |
p03274 | u445927145 | 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... | ['class Solver(object):\n def __init__(self):\n self.n, self.k = list(map(int, input().split(" ")))\n self.x_s = sorted(list(map(int, input().split(" "))))\n\n def solve(self):\n candidates = []\n for i in range(self.n - self.k + 1): # 0 .. n-k\n candidates.append((i, i + s... | ['Wrong Answer', 'Accepted'] | ['s880287372', 's242553746'] | [14384.0, 14368.0] | [86.0, 89.0] | [1821, 1880] |
p03274 | u451017206 | 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()]\na = []\na2 = []\nfor i in x:\n if i < 0:\n a2.append(2 * abs(i))\n else:\n a.append(i)\n\nif len(a2) == 0:\n print(a[K-1])\n exit()\na2 = sorted(a2)\nc1 = float('inf')\n\nfor i, v in enumerate(a):\n if K - i > len(a2... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s012964468', 's259878382', 's729772971', 's943912311'] | [15788.0, 15632.0, 15788.0, 14392.0] | [103.0, 140.0, 113.0, 97.0] | [653, 655, 649, 232] |
p03274 | u455317716 | 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 K==1 and (0 in x):\n print(0)\nelse:\n if 0 in x:\n pass\n else:\n K += 1\n counter = 0\n for i in x:\n if i > 0:\n break\n else:\n counter += 1\n x.in... | ['Runtime Error', 'Accepted'] | ['s158712099', 's350040086'] | [14844.0, 14252.0] | [2104.0, 103.0] | [660, 246] |
p03274 | u497625442 | 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\no = 0\nif x[N-1] <= 0:\n\tprint(x[N-K])\n\texit()\nif x[0] >= 0:\n\tprint(x[K-1])\n\texit()\nif 0 in x:\n\ti = x.index(0)\n\tdel x[i]\n\tN,K = N-1,K=1\n\nwhile x[o] < 0:\n\to += 1\n\tif o == N-1:\n\t\tbreak\n\nMIN = float("inf")\nfor i in range(-K... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s266142328', 's530808733', 's725543172', 's847759556', 's870423601', 's202670977'] | [3064.0, 2940.0, 3064.0, 2940.0, 3064.0, 14384.0] | [18.0, 17.0, 18.0, 17.0, 17.0, 87.0] | [504, 310, 485, 389, 604, 296] |
p03274 | u503221936 | 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 main(lines):\n N, K = map(int, lines[0].split())\n a = list(map(int, lines[1].split()))\n ans = 1000000000000\n for i in range(N):\n if i + K - 1 >= N:\n break\n b = a[i]\n c = a[i + K - 1]\n if b < 0 and c >= 0:\n ans = min(ans, max(abs(b), abs(c)) + 2*min(abs(b), abs(c)))... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s618689545', 's979458592', 's481964643'] | [16164.0, 16164.0, 16164.0] | [86.0, 89.0, 87.0] | [494, 494, 494] |
p03274 | u504562455 | 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(_) for _ in input().split()]\nx = [int(_) for _ in input().split()]\npos_i = -1\nfor i in range(len(x)):\n if x[i] >= 0:\n pos_i = i\n break\n\nmin_t = 200000000\nif pos_i == -1:\n min_t = -x[-K]\nelse:\n for i in range(N-K+1):\n if i+K < pos_i:\n min_t = -x[pos_i-... | ['Wrong Answer', 'Accepted'] | ['s803098210', 's761938782'] | [14224.0, 14480.0] | [98.0, 93.0] | [457, 482] |
p03274 | u506858457 | 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())))\n\nans=0\nfor i in range(N-K+1):\n tmp1=abs(x[i])+abs(x[i+K-1]-x[i])\n tmp2=abs(x[i+K-1])+abs(x[i+K-1]-x[i])\n tmp=min(tmp1,tmp2)\n ans=min(tmp,ans)\n\nprint(ans)\n\n ', 'N,K=map(int,input().split())\nx=sorted(list(map(int,input().sp... | ['Wrong Answer', 'Accepted'] | ['s960476520', 's715274078'] | [14568.0, 14252.0] | [107.0, 106.0] | [240, 249] |
p03274 | u518042385 | 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,m=map(int,input().split())\nl=list(map(int,input().split()))\nl1=[]\nfor i in range(n-m+1):\n if l[i]>=0:\n l1.append(l[i+m]-l[i])\n elif l[i]<=0<=l[i+m]:\n l1.append(l[i+m]-l[i]+min(l[i],l[i+m]))\n else:\n l1.append(l[i+m]-l[i])\nprint(min(l1)) ', 'n,m=map(int,input().split())\nl=list(map(int,input(... | ['Runtime Error', 'Accepted'] | ['s698468707', 's667075406'] | [14252.0, 14384.0] | [83.0, 95.0] | [253, 262] |
p03274 | u518556834 | 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 = []\nfor i in range(N-K+1):\n b.append(min(abs(a[i])+abs(a[i+k-1]-a[i]),abs(a[i+k-1])+abs(a[i+k-1]-a[i])))\nprint(min(b))\n ', 'N,K = map(int,input().split())\na = list(map(int,input().split()))\nb = []\ndis = N-K+1\nfor i in range(dis):\n b.ap... | ['Runtime Error', 'Accepted'] | ['s741122641', 's435236217'] | [14380.0, 14384.0] | [43.0, 100.0] | [191, 204] |
p03274 | u519968172 | 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\nst=0\nm=3*10**8\nfor i in range(n-1):\n if x[i]<0 and x[i+1]>=0:\n st=i+1\n\nfor i in range(n-k+2):\n mi=x[k+i-1]-x[i]+min(abs(x[k+i-1]),abs(x[i]))\n print(x[k+i-1],x[i],mi)\n if k+i<st or i>st:continue\n if mi <m:m=mi\nprint(m)', 'n,k=map(int,... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s708626240', 's856171586', 's507984248'] | [20120.0, 20056.0, 20084.0] | [136.0, 140.0, 90.0] | [288, 288, 248] |
p03274 | u527261492 | 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()))\ntime=1000000\nfor i in range(n-k+1):\n l=x[i]\n r=x[i+k-1]\n time=min(time,abs(l)+l-r,abs(r)+l-r)\nprint(time)\n \n \n \n', "n,k=map(int,input().split())\nx=list(map(int,input().split()))\ntime=float'inf'\nfor i in range(n-k+1):\n l=x[i]\n r=... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s574608002', 's930464931', 's360311718'] | [14384.0, 2940.0, 14252.0] | [82.0, 17.0, 81.0] | [184, 187, 189] |
p03274 | u559126797 | 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=[]\nfor i in (N-K+1):\n if a[i]<0:\n b.append(-2*a[i]+a[i+K-1])\n else:\n b.append(a[i]+a[i+K-1])\nprint(min(b))\n', 'N,K=map(int,input().split())\na=list(map(int,input().split()))\nb=[]\nfor i in range(N-K+1):\n b.append(min(abs... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s635211046', 's746260384', 's072224785'] | [14384.0, 2940.0, 14252.0] | [42.0, 17.0, 99.0] | [191, 184, 185] |
p03274 | u560867850 | 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\ninput = sys.stdin.readline\n\n\ndef main():\n N, K = map(int, input().split())\n X = [int(c) for c in input().split()]\n\n def fullsearch():\n for i in range(N-K):\n l = X[i]\n r = X[i+K-1]\n distance = abs(r - l)\n if abs(l) > abs(r):\n ... | ['Wrong Answer', 'Accepted'] | ['s503639115', 's207366892'] | [14172.0, 14172.0] | [66.0, 58.0] | [499, 340] |
p03274 | u566428756 | 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 \tl=i\n r=l+K-1\n ans=min(ans,min(abs(X[l]),abs(X[r]))+X[r]-X[l])\nprint(ans)", "N,K=map(int,input().split())\nX=list(map(int,input().split()))\nans=float('inf')\nfor l in range(N-K+1):\n r=l+K-1\n ... | ['Runtime Error', 'Accepted'] | ['s894526815', 's748068544'] | [2940.0, 14384.0] | [17.0, 86.0] | [183, 176] |
p03274 | u573272932 | 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()))\nk = 2*N\nfor i in range(N-K+1):\n\tl = X[i]\n\tr = X[i+K-1]\n\tk = min(k, abs(l)+abs(r-l), abs(r)+abs(r-l))\nprint(k)', 'N, K = map(int, input().split())\nX = list(map(int, input().split()))\nk = float("INF")\nfor i in range(N-K+1):\n\tl = X[i]\n\... | ['Wrong Answer', 'Accepted'] | ['s676389596', 's770530402'] | [14384.0, 14640.0] | [84.0, 94.0] | [178, 187] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.