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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03073 | u993461026 | 2,000 | 1,048,576 | N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two a... | ['S = input().rstrip()\nzero_zero = 0\none_zero = 0\nzero_one = 0\none_one = 0\none = 0\nzero = 0\nfor i in range(-(-len(S)//2)):\n tmp = S[i*2:i*2+2]\n if tmp == "00":\n zero_zero += 1\n elif tmp == "01":\n zero_one += 1\n elif tmp == "10":\n one_zero += 1\n elif tmp == "11":\n ... | ['Wrong Answer', 'Accepted'] | ['s839758362', 's609017961'] | [3188.0, 3188.0] | [43.0, 43.0] | [658, 645] |
p03073 | u998046228 | 2,000 | 1,048,576 | N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two a... | ['l =[int(i) for i in list(str(input()))]\nans = 0\nnum =0\nn = 0\n\nif l[0] == 1:\n l=[abs(i-1) for i in l]\nprint(l)\n\nfor i in l:\n if num%2 ==0:\n if i == 1:\n ans = ans +1\n else:\n if i == 0:\n ans =ans +1\n num = num +1\nprint(ans)', 'l =[int(i) for i in list(str(... | ['Wrong Answer', 'Accepted'] | ['s171845263', 's025035386'] | [4652.0, 4776.0] | [71.0, 64.0] | [268, 259] |
p03073 | u999893056 | 2,000 | 1,048,576 | N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two a... | ['S = int(input())\nn = len(S)\na = "10" * n + "1" * (n % 2)\nb = "01" * n + "0" * (n % 2)\n\nprint(min(bin(int(s,2) ^ int(a, 2) , bin(int(s, 2) ^ int(b, 2)))))', 'S = input()\n\nx = y = 0\nfor i, c in enumerate(S):\n if i % 2:\n a, b = 0, 1\n else:\n a, b = 1, 0\n if int(c) == a:\n x += 1... | ['Runtime Error', 'Accepted'] | ['s080869823', 's046548737'] | [3188.0, 3188.0] | [85.0, 95.0] | [153, 200] |
p03074 | u007991836 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n,k = map(int,input().split())\ns = input()\n\n\nif s[0] == '1':\n length_01 = [0]\nelse:\n length_01 = [0,0]\n\nfor i in range(n-1):\n if s[i] != s[i+1]:\n length_01.append(i+1)\n\nif s[n-1] == '0':\n length_01.append(n-1)\n\nnum_0 = int((len(length_01)+1)/2)\nif num_0 - 1 >= k:\n answer = 0\n ... | ['Runtime Error', 'Accepted'] | ['s648798385', 's347353631'] | [7160.0, 7156.0] | [65.0, 65.0] | [483, 530] |
p03074 | u010090035 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n,k=map(int,input().split())\ns=input()\n\nnums=[]\n\nif(s[0]=='0'):\n nums.append(0)\n\nnum=s[0]\nnumi=0\nfor i in range(n):\n if(s[i]==num):\n numi+=1\n else:\n nums.append(numi)\n numi=1\n num=s[i]\nelse:\n nums.append(numi)\n\nif(s[-1]=='1'):\n nums.append(0)\n\nprint(nu... | ['Wrong Answer', 'Accepted'] | ['s614972958', 's538599388'] | [10556.0, 10300.0] | [86.0, 82.0] | [626, 649] |
p03074 | u013408661 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n,k=map(int,input().split())\ns=list(input())\ns=list(map(int,s))\nstack=[]\ntmp=1\nflag=True\nfor i in range(1,len(s)):\n if s[i]!=s[i-1]:\n stack.append(tmp)\n tmp=1\n else:\n tmp+=1\nstack.append(tmp)\nodd=[]\neven=[]\ntmp=0\nif s[0]==0:\n flag=False\nelse:\n flag=True\nfor i in range(len(stack)):\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s049293105', 's545189338', 's552273409', 's971053318', 's064819220'] | [9200.0, 9320.0, 8728.0, 8776.0, 8592.0] | [112.0, 115.0, 103.0, 116.0, 111.0] | [562, 555, 1090, 1388, 828] |
p03074 | u013629972 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\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)]\... | ['Wrong Answer', 'Accepted'] | ['s634381572', 's681445479'] | [14288.0, 13780.0] | [234.0, 146.0] | [3356, 1588] |
p03074 | u015490689 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n,k=map(int,input().strip().split())\ns=input.strip()\nl=r=0\nc=0\nwhile r<n and s[r]=='1': r+=1\nwhile c<k:\n while r<n and s[r]=='0':r+=1\n while r<n and s[r]=='1':r+=1\n if r==n:print(n);exit()\n c+=1\nans=r-l\nwhile r<n:\n while l<n and s[l]=='1':l+=1\n while l<n and s[l]=='0':l+=1 \n while r<n and s[r]=='0':r+=1... | ['Runtime Error', 'Accepted'] | ['s531442140', 's667015169'] | [3064.0, 3316.0] | [17.0, 103.0] | [366, 370] |
p03074 | u017810624 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n,k=map(int,input().split())\ns=input()\ns='0'+s+'0'\nS=[]\nE=[]\nans=[]\nif s[1]=='0':\n S.append(1)\nfor i in range(n+1):\n if s[i:i+2]=='01':\n S.append(i+1)\n if s[i:i+2]=='10':\n E.append(i)\nif s[n]=='0':\n E.append(n)\nif S==[] and E==[]:\n print(n)\nelse:\n for j in range(len(E)-k):\n ans.appen... | ['Wrong Answer', 'Accepted'] | ['s149551031', 's391157202'] | [8884.0, 8884.0] | [91.0, 89.0] | [378, 358] |
p03074 | u021548497 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int, input().split())\ns = str(input())\n\nif s[0] == "1":\n s_first = 1\nelse:\n s_first = 0\n\nS_count = []\nt = 1\nfor i in range(n-1):\n if s[i] == s[i+1]:\n t += 1\n else:\n S_count.append(t)\n t = 1\nS_count.append(t)\n\nt = len(S_count)\nans_list = []\nif n-2*k <= 0:... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s197703752', 's739031111', 's299276506'] | [6188.0, 4596.0, 7236.0] | [2104.0, 77.0, 76.0] | [601, 1147, 452] |
p03074 | u023958502 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N,k = map(int,input().split())\nS = input()\nlenth = 0\nAllLen =[]\npreS0,preS1 = S.split('1'),S.split('0')\nS0 = [i for i in preS0 if i != '']\nS1 = [i for i in preS1 if i != '']\nnum0 = k\nif len(S0) <= k:\n\tprint(len(S))\nif S[0] == '0':\n\tJ = k\nelse:J = k + 1\nFirstLen = sum([len(S0[i]) for i in range(k)]) + s... | ['Runtime Error', 'Accepted'] | ['s582608463', 's734450199'] | [6456.0, 4476.0] | [61.0, 80.0] | [1537, 509] |
p03074 | u026155812 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["import sys\nfrom itertools import accumulate\nN, K = map(int, input().split())\nans = 0\nnum = 0\nS = input()\na = S.split('1')\nb = S.split('0')\nls = []\nfor x in a:\n if len(x) != 0:\n ls.append(len(x))\nc = [0] + list(accumulate(ls))\nls_ = []\nfor x in b:\n if len(x) != 0:\n ls_.append(len(x... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s033183101', 's150982237', 's192994147', 's196130223', 's280741289', 's488753075', 's853558342', 's930341871'] | [9580.0, 9452.0, 9580.0, 9580.0, 9580.0, 9580.0, 9580.0, 9452.0] | [71.0, 72.0, 68.0, 72.0, 73.0, 74.0, 72.0, 70.0] | [1185, 1009, 1177, 1173, 1121, 1181, 1117, 1009] |
p03074 | u028217518 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["read =input\nn,k = map(int, read().split())\na = read()\na = '1' + a + '1'\n\npstart = 0\npcnt = 0\nptype = '1'\nb = []\n# (start, end, cnt)\nfor tp in enumerate(a):\n i, c = tp\n if ptype == c:\n pcnt = pcnt + 1\n else :\n b.append((pstart, i-1, pcnt))\n pstart = i\n ptype = c\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s179267605', 's574192818', 's755391077'] | [18508.0, 18420.0, 21528.0] | [2105.0, 2105.0, 155.0] | [833, 833, 950] |
p03074 | u031598803 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int, input().split())\ns = list(input())\n# print(n, k, s)\n\na = []\ncnt = 0\nfor i in range(n-1):\n cnt += 1\n if s[i] != s[i+1]:\n a.append(cnt)\n cnt = 0 \na.append(cnt+1)\n\n\nif s[0] == "0": \n a.insert(0, 0)\nif s[-1] == "0": \n a.append(0)\n# print(a)\n# print((len(a)-2*k+... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s443583840', 's574395318', 's749613777', 's624610296'] | [5176.0, 5668.0, 7844.0, 7848.0] | [2104.0, 2104.0, 80.0, 85.0] | [736, 735, 391, 391] |
p03074 | u041382530 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N,K=map(int,input().split())\nS=input()\npo=[0]\nX=[]\ni=0\nfor i in range(N-1):\n\tif not S[i] == S[i+1]:\n\t\tpo.append(i+1)\npo.append(len(S))\nfor i in range(len(po)):\n\tif 2*K+i+1>=len(po):\n\t\tX.append(po[-1])\n\t\tbreak\n\telif 2*K+i+1>=len(po):\n\t\tX.append(po[2*K+i]-po[i])\n\t\tbreak\n\telif S[po[i]]=='0'... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s090905189', 's434406585', 's825956862', 's987585981', 's984003007'] | [10288.0, 9156.0, 10284.0, 7236.0, 10328.0] | [133.0, 167.0, 126.0, 117.0, 130.0] | [368, 548, 368, 652, 366] |
p03074 | u043545077 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["import math\nn, k = map(int, input().split())\ns = input()\n\nq = []\ntmp = 0\n\nif len(s) == 1:\n if k >= 1 or s[0] == '1':\n print(1)\n else:\n print(0)\nelse:\n if s[0] == '0':\n q.append(0)\n for i in range(len(s)):\n if i == 0:\n tmp += 1\n elif i != len(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s373292296', 's426356497', 's502721718'] | [4992.0, 4988.0, 4092.0] | [170.0, 163.0, 161.0] | [2028, 1039, 2016] |
p03074 | u044459372 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n,k=map(int,input().split())\ns=input()\na=[]\na.append(0)\nfor i in range(len(s)-1):\n\tif s[i] != s[i+1]:\n\t\ta.append(i+1)\na.append(n)\n\nprint(a)\n\n\nif s[-1]=='0':\n\tm=2*k\nelse:\n\tm=2*k+1\nif n<m or len(a)-m-1<0:\n\tprint(n)\nelif len(a)==2 and s[0]=='1' and k==0:\n\tprint(0)\nelse:\n\tprint(n)\nelse:\n\t_... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s120656534', 's185903368', 's270742283', 's336746131', 's349721038', 's367962213', 's563903121', 's592963488', 's657178730', 's661157833', 's733882913', 's904019357', 's959364419', 's713076215'] | [3064.0, 7156.0, 7920.0, 8572.0, 8572.0, 7164.0, 7540.0, 7164.0, 8572.0, 7928.0, 7156.0, 8572.0, 9208.0, 7164.0] | [17.0, 90.0, 163.0, 191.0, 186.0, 90.0, 2108.0, 90.0, 189.0, 165.0, 87.0, 191.0, 91.0, 92.0] | [421, 378, 334, 369, 371, 379, 277, 357, 369, 380, 370, 378, 425, 372] |
p03074 | u046187684 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['def solve(string):\n n, k, s = string.split()\n n, k = map(int, [n, k])\n s = "1" + s + "0"\n starts = [1]\n ends = []\n for i, (s0, s1) in enumerate(zip(s, s[1:])):\n if s0 == "0" and s1 == "1":\n starts.append(i + 1)\n elif s0 == "1" and s1 == "0":\n ends.append... | ['Runtime Error', 'Accepted'] | ['s014887768', 's718605558'] | [3064.0, 11080.0] | [18.0, 83.0] | [465, 386] |
p03074 | u047816928 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N, K = [int(c) for c in input().split()]\nS = [int(c) for c in input()]\n\nlongest=0\n\nfor bgn_flip in range(len(S)):\n\n S_copy=S[:]\n zero=False\n icluster=-1\n for i,s in enumerate(S):\n if s==0 and zero==False:\n zero=True\n icluster+=1\n if s==1:\n zero... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s597925399', 's880869889', 's985857077', 's650553205'] | [2940.0, 2940.0, 2940.0, 4468.0] | [17.0, 17.0, 17.0, 88.0] | [555, 527, 363, 368] |
p03074 | u059210959 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['# encoding:utf-8\nimport copy\nimport numpy as np\nimport random\nimport bisect \nimport math\n\n\nN,K = map(int,input().split())\nS = str(input())\n\nnow,cnt = 1,0\nNums = []\nfor i in range(N):\n if S[i] == str(now):\n cnt += 1\n else:\n Nums.append(cnt)\n cnt = 1\n now = 1 - now\n... | ['Wrong Answer', 'Accepted'] | ['s316437178', 's202949839'] | [15408.0, 14776.0] | [277.0, 291.0] | [1037, 1037] |
p03074 | u062459048 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N, K = map(int,input().split())\nS = list(input())\n\nSl = []\nc = 0\nif S[0] = "0":\n Sl.append(0)\nfor i in range(N-1):\n c += 1\n if S[i] != S[i+1]:\n Sl.append(c)\n c = 0\nif S[N-1] == "0":\n c += 1\n Sl.append(c)\n Sl.append(0)\nelse:\n c += 1\n Sl.append(c)\n\nKl = K*2+1\n\nmxl = []\nfor i in rang... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s094769046', 's895051251', 's840314882'] | [2940.0, 4792.0, 10152.0] | [17.0, 57.0, 102.0] | [359, 403, 555] |
p03074 | u063896676 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['# coding: utf-8\n\nn, k = map(int, input().split())\ns = input()\ns += "2"\nn += 1\n\nnums = []\nif s[0] == "0":\n nums.append(0)\n\nfin = False\ni = 0\nwhile i < n:\n if fin:\n break\n for j in range(i, n):\n if s[j] != s[i]:\n nums.append(j-i)\n i = j\n break\... | ['Runtime Error', 'Accepted'] | ['s751494719', 's625453298'] | [4092.0, 4212.0] | [145.0, 154.0] | [772, 777] |
p03074 | u065599736 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['import numpy as np\nN, K = map(int, input().split())\nx = list(input())\nxn = "1"\nc = 0\ny = []\nfor n in range(N):\n if x[n] == xn:\n c += 1\n else:\n xn = x[n]\n y.append(c)\n c = 1\ny.append(c)\nif len(y) % 2 == 0:\n y.append(0)\ny = np.array(y)\nprint(y)\nl = 2 * K + 1\nprint... | ['Wrong Answer', 'Accepted'] | ['s107471835', 's730205418'] | [16576.0, 20392.0] | [1222.0, 1160.0] | [451, 420] |
p03074 | u068112689 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = list(map(int, input().split()))\ns = str(input())\n\nnow = 1\ncnt = 0\nli = []\n\n\nfor i in range(n):\n if s[i] == str(now):\n cnt += 1\n else:\n li.append(cnt)\n now = 1 - now\n cnt = 1\n \nif len(li)%2 == 0:\n li.append(cnt)\n\nans = -1\nfor i in range(n):\n le... | ['Runtime Error', 'Accepted'] | ['s346520492', 's107124245'] | [4468.0, 5472.0] | [63.0, 82.0] | [474, 483] |
p03074 | u070351417 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["import re\n\ninput_str=input()\nN=int(input_str.split()[0])\nK=int(input_str.split()[1])\nstr_teams = str(input())\nsub_str_teams = str_teams\n\ndef next_check_val(check_val):\n if check_val == '1':\n return '0'\n else:\n return '1'\n\ncur_check_val = str_teams[0]\nteams_group = []\nteams_state = ''\n\n\nfor ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s107192883', 's284659085', 's974649094', 's306941891'] | [9624.0, 3188.0, 3064.0, 6052.0] | [158.0, 18.0, 17.0, 171.0] | [1551, 1418, 1416, 2086] |
p03074 | u077337864 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n, k = map(int, input().split())\ns = input().strip()\n\nwl = []\nwc = 0\nprevs = None\nfor i, _s in enumerate(s):\n if prevs is None:\n wl.append(i)\n prevs = _s\n if _s == '0':\n wc += 1\n elif prevs != _s:\n wl.append(i)\n prevs = _s\n if _s == '0':\n wc += 1\nwl.append(n)\nprint(wl, ... | ['Wrong Answer', 'Accepted'] | ['s964822891', 's703103445'] | [9200.0, 7924.0] | [68.0, 63.0] | [915, 902] |
p03074 | u088552457 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N, K = map(int, input().split())\nS = input()\n\nnums = []\nif S[0] != '1':\n nums.append(0)\n\ncurrent = S[0]\ncount = 1\nfor i, s in enumerate(list(S)):\n if i == len(S)-1:\n nums.append(count)\n break\n if S[i+1] != s:\n nums.append(count)\n count = 1\n current = s\n else:\n count += 1\n\nif ... | ['Wrong Answer', 'Accepted'] | ['s148813734', 's812524150'] | [9072.0, 8420.0] | [191.0, 126.0] | [610, 640] |
p03074 | u089142196 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N,K=map(int,input().split())\nS=list(input())\nT=[int(a) for a in S]\nU=[]\n\ntmp=T[0]\ncnt=1\nfor i in range(1,N):\n if i==N-1:\n if T[i]==T[i-1]:\n cnt+=1\n U.append((tmp,cnt) )\n else:\n U.append((tmp,cnt) )\n U.append((T[i],1))\n else:\n if T[i]==T[i-1]:\n cnt+=1\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s483763649', 's442491976'] | [31520.0, 17960.0] | [2104.0, 195.0] | [1090, 761] |
p03074 | u091051505 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int, input().split())\ns = input()\n\na = []\nj = 0\ntemp = 1\nprev = s[0]\nfor i in s[1:]:\n if i == prev:\n prev = i\n temp += 1\n else:\n a.append(temp)\n prev = i \n temp = 1\na.append(temp)\n\nb = []\nif s[0] == "1":\n b.append(sum(a[:2*k+1]))\n fo... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s036508350', 's316187698', 's575121543', 's926772504', 's151761224'] | [6024.0, 10660.0, 10316.0, 5888.0, 10236.0] | [2104.0, 136.0, 107.0, 52.0, 109.0] | [750, 601, 685, 759, 561] |
p03074 | u095426154 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n,k=map(int,input().split())\ns=list(input())\nst=[]\nen=[]\nif s[0]=="1":\n st.append(0)\nfor i in range(1,n):\n if s[i-1]=="0" and s[i]=="1":\n st.append(i)\n if s[i-1]=="1" and s[i]=="0":\n en.append(i)\nif s[n-1]=="1":\n en.append(n)\nans=0\nif len(en)+1<=k:\n print(n)\n exit()\nif... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s908209337', 's922278921', 's941861681', 's380196074'] | [9448.0, 9364.0, 9448.0, 7824.0] | [81.0, 83.0, 83.0, 81.0] | [675, 677, 679, 669] |
p03074 | u102126195 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N, K = map(int, input().split())\ns = list(input())\n\ncnt = 1\ncntlist = []\nfor i in range(1, N):\n if s[i - 1] != s[i]:\n cntlist.append(cnt)\n cnt = 1\n else:\n cnt += 1\n\ncntlist.append(cnt)\nif s[0] == "0":\n cntlist = [0] + cntlist\n\nans = 0\nfor i in range(2 * K + 1):\n if i... | ['Runtime Error', 'Accepted'] | ['s318998067', 's000705302'] | [5548.0, 5540.0] | [97.0, 93.0] | [624, 651] |
p03074 | u102275718 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int, input().split())\ns = input()\ns_split_0 = s.split("1")\ns_split_1 = s.split("0")\n\ns_split_1= [len(i) for i in s_split_1 if i!=""]\ns_split_0= [len(i) for i in s_split_0 if i!=""]\n\nif s[0]=="1":\n print(max([sum(s_split_0[i:i+k])+sum(s_split_1[i:i+k+1]) for i in range(len(s_split_0)-k+1)]))\nel... | ['Runtime Error', 'Accepted'] | ['s707295226', 's864765100'] | [5364.0, 4604.0] | [2108.0, 109.0] | [411, 636] |
p03074 | u102461423 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['import numpy as np\n\nN,K = map(int, input().split())\nS = [int(x) for x in input()]\n\nmemo = np.zeros(10**5+1, dtype = np.int64)\nW = min(2*K, 10**5)\n\ncurrent = 1 \np = 0\n\nfor x in S:\n if x == current:\n memo[x,p] += 1\n else:\n current = 1 - current\n p += 1\n\nans = memo[:W+1].sum()\nx = ans\nfor ... | ['Runtime Error', 'Accepted'] | ['s560982815', 's957913283'] | [13564.0, 15436.0] | [170.0, 402.0] | [463, 478] |
p03074 | u111365362 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N,K = map(int,input().split())\nS = input()\nif S[0] == '0':\n divide = []\nelse:\n divide = [0]\ntmp = 1\nfor i in range(1,N):\n if S[i] == S[i-1]:\n tmp += 1\n else:\n divide += [tmp]\n tmp = 1\ndivide += [tmp]\nle = len(divide)\nzero = [0]*2*le + divide + [0]*2*le\nsu = [0]\nfor i in range(0,5*le):\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s296560636', 's877281932', 's858685614'] | [26548.0, 32952.0, 9460.0] | [384.0, 419.0, 88.0] | [476, 490, 473] |
p03074 | u115110170 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['k = int(input().split(" ")[1])\ns = input()\n\nm = 0\n\nfor i in range(len(s)):\n if i>0:\n if s[i] == s[i-1]: continue\n j = i\n count = 0\n while j<len(s) and count <= k:\n if j==i:\n if s[j]=="0": \n count+=1\n elif s[j-1]=="1" and s[j]=="0": \n count+=1\n j +=1\n \n m = max(m,j-... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s255958435', 's359580358', 's967424650'] | [3316.0, 3316.0, 7932.0] | [2104.0, 2104.0, 99.0] | [312, 334, 397] |
p03074 | u119460590 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N, K = map(int, input().split())\ns = input() + "#"\n\npre, cons, comp = \'#\', 0, [(0, -1)]\nfor i in range(len(s)):\n if pre != \'#\' and pre != s[i]:\n if cons > 0:\n print(cons, s[i-1])\n comp.append((cons, s[i-1]))\n cons = 1\n else:\n cons += 1\n\n pre = s... | ['Wrong Answer', 'Accepted'] | ['s270419007', 's816655329'] | [15728.0, 15216.0] | [313.0, 589.0] | [674, 718] |
p03074 | u120691615 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n,k = map(int,input().split())\nsss = input()\n\nnow = 1\ncnt = 0\nx = []\n\nfor i in range(n):\n if sss[i] == str(now):\n cnt += 1\n else:\n x.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:\n x.append(cnt)\nif len(x) % 2 == 0:\n x.append(0)\n\nAdd = 2 * k + 1\nans = 0\n\n... | ['Runtime Error', 'Accepted'] | ['s878551803', 's200632353'] | [4212.0, 7932.0] | [2104.0, 124.0] | [475, 500] |
p03074 | u124498235 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n, k = map(int, input().split())\ns = input()\n\non = []\noff = []\n\nacnt = 0\nbcnt = 0\nfor i in s:\n if i == '0':\n if bcnt > 0:\n off.append(bcnt)\n bcnt = 0\n acnt += 1\n else:\n if acnt > 0:\n on.append(acnt)\n acnt = 0\n bcnt += 1\nif bcnt > 0:\n off.append(bcnt)\n bcnt = 0\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s383202294', 's611004608', 's876364565'] | [10340.0, 10228.0, 10336.0] | [114.0, 2206.0, 85.0] | [1034, 797, 1036] |
p03074 | u129019798 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N,K=(int(x) for x in input().split())\nS=input()\n\ndef Solve(S,N,K):\n if S.count("0")<=K:\n return len(S)\n if S[0]=="1":\n S="0"+S\n \n\n LA=[]\n LB=[]\n k=-1\n current="0"\n for i,s in enumerate(S):\n k+=1\n if s!=current:\n if s=="0":\n ... | ['Wrong Answer', 'Accepted'] | ['s043309560', 's147943728'] | [4356.0, 20804.0] | [2104.0, 299.0] | [859, 1188] |
p03074 | u129836004 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['import collections\nn, k = map(int, input().split())\ns = [int(i) for i in input()]\nc = []\nprv = 1\ncnt = 0\nfor i in s:\n if prv != i:\n c.append(cnt)\n cnt = 1\n prv = i\n else:\n cnt += 1\nif cnt > 0:\n c.append(cnt)\nif prv == 0:\n c.append(0)\nque = collections.deque(c[0... | ['Runtime Error', 'Accepted'] | ['s202082967', 's230655255'] | [5084.0, 5392.0] | [58.0, 120.0] | [559, 561] |
p03074 | u143322814 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['def cul(lst, m):\n r = 0\n for i in lst:\n r += i if i < m else m\n return r\n\nn, k = map(int,input().split())\ns = input()\nval = []\n\na = 1\nfor i in range(1, len(s)):\n if s[i-1] == s[i]:\n a += 1\n else:\n val.append(a)\n a = 1\nval.append(a)\nans = []\nnow = int(s[0]... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s230764653', 's656596824', 's635648539'] | [5132.0, 4944.0, 7924.0] | [2104.0, 2104.0, 129.0] | [476, 477, 508] |
p03074 | u145950990 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n,k = map(int,input().split())\ns = input()\na = []\nc = 1\nfor i in range(n-1):\n if s[i]==s[i+1]:\n c+=1\n else:\n a.append(c)\n c = 1\na.append(c)\n\nif s[0]=='0':\n l = min(len(a),2*k)\n ans = max(a[1::2]) if len(a)!=1 else 0\nelse:\n l = min(len(a),2*k+1)\n ans = max(a[::2]... | ['Wrong Answer', 'Accepted'] | ['s892750539', 's073454637'] | [8184.0, 7924.0] | [72.0, 100.0] | [455, 355] |
p03074 | u146597538 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int, input().split())\n\ns = list(str(input()))\n\nfirst_index=0\nlast_index=0\n\nres = 0\nfor f in range (first_index, n+1):\n for l in range (last_index, n+1):\n if f < l:\n continue\n check = 0\n for i in range(f, l+1):\n if s[i] == 0:\n check += 1\n if check <= k:\n i... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s320654705', 's442820230', 's616599714', 's827876132', 's873776264', 's930516456', 's973355231', 's106233269'] | [4084.0, 2940.0, 4152.0, 4084.0, 4084.0, 4084.0, 4084.0, 4780.0] | [2104.0, 17.0, 2104.0, 2104.0, 2104.0, 2107.0, 2104.0, 150.0] | [343, 2, 394, 396, 332, 387, 387, 674] |
p03074 | u149752754 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N,K = map(int,input().split())\nS = list(input())\n\nif len(S) == 1:\n print(1)\nelif len(S) == 2:\n print(2)\nelif S[0] == '0':\n LA = [0]\n LB = [0]\n for i in range(1,N-1):\n if (S[i] != S[i+1]) & (S[i] == '0'):\n LA.append(i+1)\n elif (S[i] != S[i+1]) & (S[i] == '1'):\n ... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s245160308', 's369507642', 's553282438', 's360058354'] | [9444.0, 3064.0, 7864.0, 7904.0] | [90.0, 17.0, 78.0, 99.0] | [1020, 967, 888, 981] |
p03074 | u162612857 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = list(map(int, input().split()))\ns = input()\n\nend = []\nstart = []\n\nif s[0] == "1":\n\tstart.append(0)\nelse:\n\t\n\tstart.append(0)\n\tend.append(0)\n\nfor i in range(n-1):\n\tif s[i] == "1" and s[i+1] == "0":\n\t\tend.append(i)\nfor i in range(1, n):\n\tif s[i-1] == "0" and s[i] == "1":\n\t\tstart.append... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s766221079', 's878739588', 's593903973'] | [9336.0, 8760.0, 7140.0] | [91.0, 79.0, 73.0] | [652, 658, 646] |
p03074 | u163320134 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n,k=map(int,input().split())\ns=str(input())\ns=s+'e'\narr=[[] for _ in range(3)]\ncount=1\nfor i in range(n):\n if s[i]==s[i+1]:\n count+=1\n else:\n if s[i]=='1':\n arr[0].append(count)\n count=1\n else:\n arr[1].append(count)\n count=1\nif len(arr[1])<=k:\n print(n)\nelse:\n if len... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s220705238', 's284280294', 's591603338', 's854498366', 's925747411', 's096058472'] | [4708.0, 6880.0, 4664.0, 4776.0, 4844.0, 4724.0] | [115.0, 2104.0, 112.0, 114.0, 119.0, 111.0] | [775, 437, 853, 769, 912, 726] |
p03074 | u169138653 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["from copy import deepcopy\nfrom itertools import accumulate\nn,k=map(int,input().split())\ns=input()\nl=[]\ncnt=1\nfor i in range(n-1):\n if s[i]==s[i+1]:\n cnt+=1\n else:\n l.append(cnt)\n cnt=1\nl.append(cnt)\nal=deepcopy(l)\nal=[0]+al\nal=list(accumulate(al))\nprint(al)\nans=0\nfor i in range(len(al)):\... | ['Wrong Answer', 'Accepted'] | ['s469657649', 's106775219'] | [10964.0, 8692.0] | [187.0, 145.0] | [464, 281] |
p03074 | u172035535 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N,K = map(int,input().split())\nS = input()\nL = [0]\nres = '1'\ni = 0\nfor s in S:\n if s != res:\n L.append(i)\n i += 1\n else:\n i += 1\n res = s\nL.append(i)\nif len(L)<=2*k+1:\n ans = N\nfor i in range(0,len(L)-k*2-2,2):\n ans = L[i+K*2+1]-L[i]\nprint(ans)", "N,K = map(int,inp... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s358033773', 's462538182', 's473040184', 's672607816', 's152365433'] | [7156.0, 5108.0, 5108.0, 4892.0, 7156.0] | [51.0, 56.0, 55.0, 2104.0, 48.0] | [280, 304, 312, 451, 403] |
p03074 | u177411511 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = list(map(int, input().split()))\ns = input()\nnow = 1\ncnt = 0\nNums = []\nfor i in range(len(s)):\n if s[i] == str(now):\n cnt += 1\n else:\n Nums.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:\n Nums.append(cnt)\nif len(Nums) % 2 == 0:\n Nums.append(0)\n\nans = 0\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s379353161', 's585358662', 's616197682'] | [8004.0, 8004.0, 4628.0] | [94.0, 88.0, 233.0] | [561, 561, 917] |
p03074 | u179169725 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["import sys\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_a_int():\n return int(read())\n\n\ndef read_matrix(H):\n '''\n H is number of rows\n '''\n return [list(map(int, read().split())) for _ in range(H)]\n\n\ndef read_map(H):\n \n retu... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s376454550', 's688511433', 's690381419', 's700143542', 's353830067'] | [5780.0, 7600.0, 5776.0, 5780.0, 8212.0] | [140.0, 139.0, 124.0, 137.0, 169.0] | [1601, 1603, 1609, 1651, 2257] |
p03074 | u185354171 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n,k = map(int,input().split())\ns = list(input())\nif s[0] == "1":\n cnt_list = []\nelse:\n cnt_list = [0]\ncnt = 1\nfor i in range(n-1):\n if s[i] == s[i+1]:\n cnt += 1\n else:\n cnt_list.append(cnt)\n cnt = 1\ncnt_list.append(cnt)\nif s[-1] == \'0\':\n cnt_list.append(0)\nprint(c... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s230377208', 's273605438', 's818096341', 's725404333'] | [9176.0, 8612.0, 5544.0, 8620.0] | [96.0, 92.0, 2104.0, 113.0] | [539, 540, 371, 545] |
p03074 | u186967328 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N,K = map(int,input().split())\nS = input()\n\nif S[N-1] == '1':\n S += '0'\nelse:\n S += '1'\n\nmemo = []\nnow = S[0]\ncnt = 1\nfor i in range(N):\n if S[i+1] == now:\n cnt += 1\n else:\n memo.append(cnt)\n cnt += 1\n now = S[i+1]\n\nm = 0\nl = []\nif S[0] == '1':\n for i i... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s362851489', 's626978130', 's817438528', 's552298112'] | [10276.0, 4468.0, 4988.0, 13204.0] | [96.0, 2104.0, 2104.0, 115.0] | [694, 535, 670, 739] |
p03074 | u189575640 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['from sys import exit\nN,K = [int(n) for n in input().split()]\n# N = int(input())\n# a = [int(input()) for _ in range(N)]\nS = str(input())\nL = len(S)\nlis = []\nif(S[0] == "0"):\n lis.append(0)\ntmp = S[0]\n\nfor i in range(1,L):\n if(S[i]!=S[i-1]):\n lis.append(len(tmp))\n tmp =S[i]\n else:\... | ['Wrong Answer', 'Accepted'] | ['s506017601', 's180871142'] | [7932.0, 7932.0] | [128.0, 106.0] | [874, 876] |
p03074 | u193264896 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["import sys\nimport time\nimport numpy as np\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\ndef main():\n N, K = map(int, readline().split())\n S = input()\n L = len(S)\n c... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s064694683', 's736488263', 's660081127'] | [15292.0, 15008.0, 14140.0] | [262.0, 279.0, 429.0] | [849, 817, 479] |
p03074 | u201856486 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['import sys\n\n# import math\n# import itertools\n# import numpy as np\n# import collections\n\n"""Template"""\n\n\nclass IP:\n \n\n def __init__(self):\n self.input = sys.stdin.readline\n\n def I(self):\n \n return int(self.input())\n\n def S(self):\n \n return self.inpu... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s015942599', 's844309039', 's895757097'] | [4680.0, 4604.0, 4356.0] | [56.0, 56.0, 93.0] | [5314, 5304, 964] |
p03074 | u206460435 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['import heapq\nimport sys\n\nimport numpy as np\n\nreatInt = lambda: int(sys.stdin.readline())\nreatIntN = lambda: [int(v) for v in sys.stdin.readline().split(" ")]\n\n\nn, k = reatIntN()\nss = sys.stdin.readline().strip()\n\n\nclass Node:\n def __init__(self, p, n, v):\n self.prev = p\n self.next = n... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s368980033', 's589727260', 's309158591'] | [40492.0, 43148.0, 22840.0] | [508.0, 811.0, 408.0] | [1734, 1937, 572] |
p03074 | u207707177 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n,k=map(int, input().split())\ns=input()\n\nruiwa = [0]\n\nfor i in range(1,len(s)):\n if s[i] != s[i-1]:\n ruiwa.append(i)\nruiwa.append(n)\n\nif s[0] == "1":\n ans = ruiwa[1]\n for i in range(((len(ruiwa)-1)//2)-k+1):\n ans = max(ans,ruiwa[min(2*k+1+2*i,len(ruiwa)-1)] - ruiwa[2*i])\nelse:\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s525858784', 's708971141', 's525328075'] | [7112.0, 2940.0, 7112.0] | [96.0, 17.0, 95.0] | [467, 718, 625] |
p03074 | u210827208 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n,k=map(int,input().split())\ns=input()\n\nI=[0,]\n\nfor i in range(n-1):\n if s[i]!=s[i+1]:\n I.append(i+1)\n\nif len(I)<k:\n I.extend([n+1]*(2*k+1))\n\nX=[]\n\nfor i in range(len(I)):\n if s[I[i]]=='0':\n X.append(I[i+2*k]-I[i])\n else:\n X.append(I[i+2*k+1]-I[i])\n\nprint(max(X))",... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s064650280', 's236109527', 's743237126', 's927270319', 's000841928'] | [10316.0, 10880.0, 10316.0, 10316.0, 18884.0] | [88.0, 99.0, 89.0, 87.0, 216.0] | [296, 325, 299, 294, 316] |
p03074 | u213497190 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N,K=map(int,input().split())\nS=input()+'E'\n\n# Initial values\nans=-1\nl=0\nr=1\nedge=[]\n\n\n\nif S[l]=='0':\n count=1\nelse:\n count=0 \n\n\nwhile(r < N+1):\n\n \n if (S[r] != S[r-1]) & (S[r]=='0'):\n count+=1\n\n \n while(count>K):\n l+=1\n \n if (S[l]!=S[l-1]) & ... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s005294804', 's075068401', 's078010540', 's270676221', 's370551167', 's399868335', 's470238468', 's529470742', 's544188161', 's612565867', 's782610080', 's792385166', 's905859451', 's552437363'] | [3316.0, 9668.0, 9132.0, 3060.0, 12032.0, 11108.0, 3316.0, 3064.0, 7112.0, 7536.0, 11044.0, 4880.0, 9668.0, 3316.0] | [153.0, 74.0, 104.0, 17.0, 141.0, 110.0, 2104.0, 17.0, 2104.0, 515.0, 119.0, 304.0, 72.0, 139.0] | [840, 254, 389, 283, 452, 289, 876, 420, 430, 852, 381, 839, 283, 854] |
p03074 | u218494572 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int, input().split())\nprint(n)', "n, k = map(int, input().split())\n\nS = input()\npara = [0]\nfor i, s in enumerate(S):\n if i == 0:\n para.append(1)\n else:\n if S[i] == S[i-1]:\n para[-1] += 1\n else:\n para.append(1+para[-1])\n\nif S[-1] == '0':\n pa... | ['Wrong Answer', 'Accepted'] | ['s005347499', 's173441076'] | [2940.0, 7156.0] | [17.0, 98.0] | [41, 873] |
p03074 | u226912938 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n, k = map(int, input().split())\ns = str(input())\n\ncount = 1\nNums_count = []\nnow = s[0]\nstart = 0\nfor i in range(1,n):\n if s[i] == str(now):\n count += 1\n else:\n Nums_count.append([start, count])\n now = s[i]\n start = i\n count = 1\n if i == n-1:\n Nums_co... | ['Runtime Error', 'Accepted'] | ['s007938996', 's920938742'] | [29888.0, 29888.0] | [250.0, 253.0] | [1115, 1113] |
p03074 | u227082700 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n,k=map(int,input().split());s=input();aa,b=[],[]\nr,l=0,s[0]\nfor i in range(n):\n if s[i]!=l:\n aa.append(r)\n b.append(l)\n l=s[i]\n r=1\n else:r+=1\naa.append(r);b.append(l)\na=[aa[0]]\nl=len(aa)\nfor i in range(1,l):a.append(a[-1]+aa[i])\nx=max(l-k*2-1,1)\nans=0\nfor i in range(x):\n ans=max(ans,a... | ['Wrong Answer', 'Accepted'] | ['s982748417', 's294394756'] | [8736.0, 4596.0] | [136.0, 94.0] | [332, 366] |
p03074 | u228223940 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['import numpy as np\n\nN,K = map(int,input().split())\n\nS = input()\nS = [int(i) for i in S]\n\narray = np.zeros(len(S))\n\n\nfor i in range(len(S)-1):\n if S[i] == S[i+1]:\n array[i] = 0\n else:\n array[i] = 1\n\nprint(array)\n\nres = np.cumsum(array)\nprint(res)\nma = int(np.max(res))\n\ncount =... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s447828590', 's466065967', 's721030654', 's685442342'] | [16872.0, 14952.0, 16868.0, 15304.0] | [2109.0, 2108.0, 2108.0, 267.0] | [615, 613, 617, 617] |
p03074 | u229621546 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N,K = map(int,input().split())\nS = input()\n\nA = [0]\nB = [0]\nfor s in S:\n if s == '1':\n A[-1] += 1\n elif A[-1] != 0:\n A.append(0)\n if s == '0':\n B[-1] += 1\n elif B[-1] != 0:\n B.append(0)\n\nans = 0\n\nfor i in range(min(len(A),len(B))):\n a = 0\n if S[0] == '1':\n a = sum(A[i:min(i + ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s560271441', 's961922031', 's757748909'] | [4400.0, 5184.0, 4528.0] | [2104.0, 226.0, 150.0] | [451, 886, 872] |
p03074 | u234985935 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N, K = map(int, input().split())\nS = input()\n\none_list = []\nzero_list = []\n\ncur_char = S[0]\nchar_num = 0\nfor i in range(N):\n if S[i] == cur_char:\n char_num += 1\n else:\n if cur_char == '0':\n zero_list.append(char_num)\n else:\n one_list.append(char_num)\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s055236843', 's189724150', 's485293997', 's519214685', 's537317066', 's861792904', 's481238047'] | [5540.0, 5624.0, 5716.0, 5584.0, 5780.0, 5612.0, 5540.0] | [95.0, 90.0, 92.0, 88.0, 93.0, 86.0, 90.0] | [1983, 1906, 1889, 1888, 1924, 1777, 1975] |
p03074 | u239316561 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int,input().split())\ns = list(input())\n\nNums = []\nnow = int(s[0])\ncnt = 1\n\nfor i in range(1,n):\n if s[i] == str(now):\n cnt += 1\n else:\n Nums.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:Nums.append(cnt)\n\n\n#if len(Nums) % 2 == 0:Nums.append(0)\n\nadd = 2... | ['Wrong Answer', 'Accepted'] | ['s016499393', 's203479823'] | [4792.0, 8568.0] | [2104.0, 129.0] | [812, 848] |
p03074 | u252828980 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n,k = map(int,input().split())\ns = input()\nzero,one = [],[]\ncnt = 0\nif s[0] == "0":\n flag = True\nelse:\n flag = False\nfor i in range(n-1):\n if s[i] == "0" and flag == True:\n cnt +=1\n if s[i] == "0" and s[i+1] =="1":\n zero.append(cnt)\n flag = False\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s590771326', 's755408814', 's784958942'] | [10132.0, 19276.0, 19984.0] | [93.0, 2206.0, 183.0] | [1274, 1008, 687] |
p03074 | u253952966 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n, k = map(int, input().split(' '))\ns = input()\ns10 = []\ncnt = 0\ns_prev = '1'\nfor si in s:\n if si == s_prev:\n cnt += 1\n else:\n s10.append(cnt)\n cnt = 1\n s_prev = si\ns10.append(cnt)\nif s[-1] == '0':\n s10.append(0)\n \nsum_max= 0\nfor i in range(len(s10)):\n sum_i = sum(s10[i:i+2*k+2])\n s... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s025064687', 's697155054', 's939709631', 's366324149'] | [4596.0, 4596.0, 4596.0, 4596.0] | [2104.0, 2104.0, 2104.0, 91.0] | [345, 331, 333, 490] |
p03074 | u261646994 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['import re\nimport numpy as np\nN, K = [int(item) for item in re.split(r"\\s", input())]\nS = [int(item) for item in list(input())]\n\nif sum(S) == len(S) or sum(S) == 0:\n print(len(S))\nelse:\n S = S + [2]\n\n index = [-1]\n for i in range(N):\n if S[i] != S[i + 1]:\n index.append(i)\n\... | ['Runtime Error', 'Accepted'] | ['s484041093', 's674104956'] | [24764.0, 23472.0] | [223.0, 221.0] | [629, 714] |
p03074 | u262869085 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N,K =map(int,input().split())\nS =input()\nlis = [[],[]]\nif S[0]=="0":\n lis[1].append(0)\nj = S[0]\nsu = 0\nfor i in S:\n if i ==j:\n su += 1\n else:\n lis[int(j)].append(su)\n j = i\n su = 1\nlis[int(j)].append(su)\nif j=="0":\n lis[1].append(0)\nif len(lis[0])<=K:\n prin... | ['Runtime Error', 'Accepted'] | ['s098318458', 's378988422'] | [4460.0, 4484.0] | [83.0, 86.0] | [531, 544] |
p03074 | u265065462 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N,K = map(int,input().split())\nS = input()\n\nhm_1 = [0] * N\nhm_2 = [0] * N\n\nfor i in range(N-1,-1,-1):\n\tif i == N-1:\n\t\tif S[i] == '1':\n\t\t\thm_1[i] = 1\n\telse:\n\t\tif S[i] == '0':\n\t\t\thm_1[i] = 0\n\t\telse:\n\t\t\thm_1[i] = hm_1[i+1] + 1\n\t\t\nfor i in range(N-1,-1,-1):\n\tif i == N-1:\n\t\tif S[i] ... | ['Wrong Answer', 'Accepted'] | ['s372455035', 's713576603'] | [9548.0, 9552.0] | [247.0, 187.0] | [868, 917] |
p03074 | u271469978 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int, input().split())\nS = input()\nstart =[]\nend = []\nif S[0] == "0":\n start.appned(0)\nelse:\n end.append(0)\nfor i in range(n):\n if S[i:i+2] == "10":\n start.append(i+1)\n elif S[i:i+2] == "01":\n end.append(i+1)\nif len(start) <= k:\n print(len(S))\nelse:\n start.app... | ['Runtime Error', 'Accepted'] | ['s337752785', 's612475349'] | [8736.0, 8724.0] | [78.0, 75.0] | [424, 402] |
p03074 | u273201018 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N, K = map(int, input().split())\nS = input()\n\nL = []\nt = S[0]\nl = 1\n\nfor s in S[1:]:\n if t == s:\n l += 1\n else:\n L.append(l)\n t = s\n l = 1\n\nL.append(l)\n\n\nprint(0)\n', "N, K = map(int, input().split())\nS = input()\n\nL = S.replace('01', '0,1')\nL = L.replace('... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s327845120', 's931062050', 's282153114'] | [4212.0, 5472.0, 5600.0] | [37.0, 27.0, 92.0] | [217, 167, 392] |
p03074 | u278260569 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N , K = map(int,input().split())\nS = list(input())\nrow = []\nfor i in range(N):\n\tif i == 0:\n\t\tjudge = S[i]\n\t\trow.append(1)\n\telse:\n\t\tif judge == S[i]:\n\t\t\trow[-1] += 1\n\t\telse:\n\t\t\tjudge = S[i]\n\t\t\trow.append(1)\n\nmax_row = 2 * K + 1\n\nif max_row >= len(row):\n\tprint(N)\nelse:\n\tif S[-1] ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s637757152', 's817492931', 's956805385', 's824335739'] | [6244.0, 13988.0, 6248.0, 6244.0] | [82.0, 2104.0, 82.0, 81.0] | [599, 667, 602, 596] |
p03074 | u278356323 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int, input().split())\ns = input()\n\nsl = []\nc = 1\nfor i in range(n):\n if (i == 0):\n if (s[i] == "1"):\n sl.append(0)\n if (i != 0):\n if (s[i] == s[i-1]):\n c += 1\n else:\n sl.append(c)\n c = 1\nsl.append(c)\n\ncl = []\nfor i in ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s244122215', 's355846782', 's435920666', 's756181838', 's839446971', 's339539680'] | [5220.0, 5824.0, 6544.0, 84212.0, 6260.0, 7932.0] | [2104.0, 2104.0, 174.0, 2104.0, 2104.0, 146.0] | [501, 872, 1042, 1109, 692, 869] |
p03074 | u278670845 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['import sys\nimport re\nn,k=map(int,input().split())\ns=input()\na=[]\ntmp=1\nfor i,j in zip(s[:n-1],s[1:]):\n if i==j:\n tmp+=1\n else:\n a.append((i,tmp))\n tmp=1\nif tmp!=1:\n a.append((s[-1],tmp))\ntmp=sum(1 for i in a if i[0]=="0")\nif tmp<=k:\n print(n)\n sys.exit()\n', 'import sys\nn,k=map(int,inp... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s415904216', 's562426642', 's917057667', 's127044250'] | [10740.0, 13432.0, 13432.0, 5620.0] | [58.0, 146.0, 145.0, 91.0] | [269, 467, 426, 646] |
p03074 | u281733053 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['a = []\n\nn,k = map(int, input().split())\nfor x in range(k+1):\n a.append(0)\nq = input()\n\np = 0\nc = 0\nmx = 0\n\nfor i in range(n-1):\n p = p+1\n c = c+1 \n if q[i] == q[i+1]:\n lalala = 1\n\n elif (int(q[i]) == 1) & (int(q[i+1]) == 0) :\n \n p = p-a[0]\n if p > mx:\n mx = p\n \n elif ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s165625844', 's274073250', 's370882220', 's456445054', 's580839281', 's979990646'] | [107280.0, 107100.0, 2940.0, 4016.0, 4016.0, 4016.0] | [2104.0, 2104.0, 17.0, 568.0, 548.0, 558.0] | [511, 519, 603, 496, 489, 496] |
p03074 | u281733950 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n,k = list(map(int, input().split()))\ns = input()\n\n# print(n, k, s)\n\nprevcCt = 0 \nnextCnt = 0 \n\n\n\nval = 0\nvals = []\nfor i in range(len(s)):\n\tif s[i] == "0":\n\t\tval -= 1\n\telse:\n\t\tval += 1\n\n\t#print(i, val, s[i], s[i+1])\n\t# print(i,len(s))\n\tif i == len(s) - 1 or s[i] != s[i+1]:\n\t\tvals.appe... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s025108702', 's207913549', 's706606958'] | [5720.0, 6412.0, 4860.0] | [2104.0, 2104.0, 138.0] | [919, 1366, 1460] |
p03074 | u285443936 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N, K = map(int, input().split())\nS = input()\nwidth,l,r = [],[],[]\n\nfor i in range(K):\n if "0" not in S:\n break()\n for j in range(N-1):\n if j == 0:\n sw = 1\n l.append(0)\n for k in range(j,N-1-j):\n if S[k] == "0" and S[k+1] == "1":\n r.append(k+1) \n sw = 2\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s651501043', 's897390897', 's085674404'] | [2940.0, 73008.0, 4596.0] | [17.0, 2108.0, 92.0] | [868, 866, 445] |
p03074 | u292810930 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N, K = map(int, input().split())\nS = input()\nS\nsplit_list = [0]\nsection_list = [0]\nfor i in range(1, N):\n if S[i-1] != S[i]:\n section_list.append(i - split_list[-1])\n split_list.append(i)\nsplit_list.append(N)\nsection_list.append(split_list[-1] - split_list[-2])\ndel split_list[0]\ndel secti... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s474723718', 's642477447', 's459948650'] | [8408.0, 8420.0, 8516.0] | [111.0, 95.0, 119.0] | [943, 593, 1034] |
p03074 | u297756089 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n,k=map(int,input().split())\ns=list(input())\nli=[]\nif s[0]=="0":\n a=0\n s.insert(0,"p")\n len_s=len(s)\n for i in range (1,len_s):\n if s[i-1]==s[i]:\n a=a+1\n else:\n li.append(a)\n a=1\n li.append(a)\nelse:\n a=1\n len_s=len(s)\n for j in range (1,len_s):\n if s[j-1]==s[j]:\n ... | ['Wrong Answer', 'Accepted'] | ['s629449288', 's980010743'] | [11224.0, 8656.0] | [103.0, 99.0] | [647, 811] |
p03074 | u297767059 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nNK = input().split(' ')\nN = int(NK[0])\nK = int(NK[1])\nS = input()\n\nprev = '0'\ncount = 0\nnums = []\nfor i in S:\n if i == prev:\n count += 1\n else:\n nums.append(count)\n count = 1\n prev = i\nif count > 0:\n nums.append(cou... | ['Wrong Answer', 'Accepted'] | ['s825373036', 's456175458'] | [7128.0, 5904.0] | [75.0, 109.0] | [552, 608] |
p03074 | u307516601 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['\n\nimport sys\nsys.setrecursionlimit(10**6)\n\nn, k = map(int, input().split())\ns = input()\n\nnums = []\nnow = 1 \ncnt = 0 \n\nfor i in range(n):\n if s[i] == str(now):\n cnt += 1\n else:\n nums.append(cnt)\n now ^= 1 \n cnt = 1 \nif cnt != 0:\n nums.append(cnt)\n\n\n\n\nif len... | ['Runtime Error', 'Accepted'] | ['s487487501', 's376018744'] | [13708.0, 13748.0] | [85.0, 115.0] | [1280, 1281] |
p03074 | u310233294 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n, k = map(int, input().split())\ns = input()\ns_re = re.split(r'(0+)', s)\nsrl = len(s_re)\nm = [0] * srl\nif (srl - 1 // 2) <= k:\n ans = n\nelse:\n for i, w in enumerate(s_re):\n m[i] = len(w)\n ans = [1]\n for i in range(0, srl, 2):\n ie = i + k * 2 + 1\n if ie <= srl:\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s351886693', 's876228803', 's842175615'] | [3316.0, 6004.0, 5528.0] | [18.0, 2104.0, 89.0] | [375, 336, 458] |
p03074 | u311636831 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['sys.setrecursionlimit(10000000)\nN,K=map(int,input().split())\nS=input()\n\n#N=14\n#K=2\n#S="11101010110011"\n\nLIST=[[[0] for j in range (2)]for i in range(N)]\n\nt=S[0]\nc=0\nk=0\nfor i in range(N):\n if(t!=S[i]):\n LIST[k][0]=c\n LIST[k][1]=t\n t=S[i]\n k+=1\n c=0\n c+=1\n\... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s014918420', 's160961750', 's225082812', 's438479475', 's796958624', 's888848469', 's636630843'] | [3064.0, 3320.0, 3188.0, 3064.0, 2940.0, 34672.0, 34676.0] | [17.0, 18.0, 17.0, 17.0, 17.0, 298.0, 307.0] | [660, 1508, 899, 659, 8, 1411, 1070] |
p03074 | u324314500 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["import sys\n\ndef i2s():\n return sys.stdin.readline().rstrip()\n\ndef ii2ss(n):\n return [sys.stdin.readline() for _ in range(n)]\n\ndef sp2nn(sp, sep=' '):\n return [int(s) for s in sp.split(sep)]\n\ndef ss2nn(ss):\n return [int(s) for s in list(ss)]\n\ndef analyze(S):\n data = []\n i0 = 0\n s0... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s117518882', 's392066669', 's735167782'] | [38416.0, 36836.0, 14284.0] | [2106.0, 2110.0, 103.0] | [1535, 1536, 1103] |
p03074 | u333404917 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int, input().split())\ns = [int(x) for x in list(input())]\n\nstate = 1\ncnt = 0\nl = []\nfor e in s:\n if e != state:\n l.append(cnt)\n cnt = 1\n state = e\n print(e, l)\n else:\n cnt += 1\n\nif cnt != 0:\n l.append(cnt)\n\nif len(l) % 2 == 1:\n l.append(0)\n... | ['Wrong Answer', 'Accepted'] | ['s396984230', 's042164693'] | [98080.0, 9240.0] | [2104.0, 126.0] | [568, 548] |
p03074 | u334712262 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, prod... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s026086732', 's174347328', 's842854184', 's935583819', 's950929368', 's995304200', 's531607430'] | [7096.0, 7096.0, 8328.0, 7096.0, 7256.0, 7096.0, 7136.0] | [195.0, 203.0, 351.0, 170.0, 192.0, 190.0, 111.0] | [2219, 2172, 2176, 2048, 2105, 2140, 1983] |
p03074 | u338824669 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["N,K=map(int,input().split())\nS=input()\nA=[]\na=S[0]\ncount=1\nfor i in range(1,N):\n if S[i]==a:\n count+=1\n else:\n A.append([a,count])\n count=1\n a=S[i]\nA.append([a,count])\nB=[]\nC=[]\nfor i in range(len(A)):\n if A[i][0]=='0':\n B.append(A[i][1])\n else:\n C.append(A[i][1])\nif K>=len(B... | ['Runtime Error', 'Accepted'] | ['s874619526', 's272334120'] | [14564.0, 7928.0] | [2105.0, 90.0] | [1063, 434] |
p03074 | u342869120 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N, K = map(int, input().split())\ns = "1"+input().strip()+"1"\ni = 0\ndp = []\nwhile i < len(s):\n l = i\n while i < len(s) and s[i] == \'1\':\n i += 1\n if l < i:\n dp.append([l, i-1])\n while i < len(s) and s[i] == \'0\':\n i += 1\n\n\nif len(dp) <= K:\n print(N)\nelse:\n ans ... | ['Wrong Answer', 'Accepted'] | ['s788532880', 's254210742'] | [12280.0, 11380.0] | [166.0, 111.0] | [458, 615] |
p03074 | u346308892 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['\nimport numpy as np\nimport sys\nsys.setrecursionlimit(100000)\n\ndirections = np.array([[1, 0], [0, 1], [-1, 0], [0, -1]])\n\n\ndef acinput():\n return list(map(int, input().split(" ")))\n\n\nsys.setrecursionlimit(100000)\n\n\ndirections = [[1, 0], [0, 1], [-1, 0], [0, -1]]\ndirections = list(map(np.array, direc... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s424253799', 's617779869', 's636497868'] | [15808.0, 15552.0, 15572.0] | [322.0, 284.0, 269.0] | [882, 723, 903] |
p03074 | u352048883 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["n, k = map(int, input().split())\ns = input()\n\nfrom collections import deque\nfrom itertools import groupby\n\ndef gen(s):\n if s[:1] == '0':\n \tyield 0\n for ke, g in groupby(s):\n yield len(list(g))\n if s[-1:] == '0':\n yield 0\n\n\nmc = 0\nddd = deque()\nr = 2 * k + 1\nfor p in gen(s):\n ddd.append(... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s004349253', 's063981790', 's155166304', 's479086835', 's664891805', 's864227293', 's894845001', 's629341509'] | [4324.0, 4596.0, 7180.0, 4160.0, 4716.0, 4324.0, 5060.0, 7180.0] | [2104.0, 2104.0, 86.0, 2104.0, 2104.0, 2104.0, 2104.0, 91.0] | [412, 365, 381, 629, 541, 419, 484, 445] |
p03074 | u353895424 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['n, k = map(int, input().split())\nS = list(input())\n\n\ncnt = []\n\n\nif S[0] == "0":\n cnt.append(0)\n\n\ni = 0\nwhile i < n:\n j = i\n while j < n and S[i] == S[j]:\n j += 1\n cnt.append(j-i)\n i = j\n\n\nif S[-1] == "0":\n cnt.append(0)\n\n\ncumCnt = [0]\nfor c in cnt:\n cumCnt.append(... | ['Wrong Answer', 'Accepted'] | ['s763325734', 's203324704'] | [15976.0, 14224.0] | [131.0, 114.0] | [635, 798] |
p03074 | u360090862 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['N,K=[int(i) for i in input().split()]\nS=input()\ncur=0\nline=[]\n\nfor i in range(len(S)):\n\tif i==0:\n\t\tif S[0]=="0":\n\t\t\tline.append(0)\n\t\tline.append(1)\n\telse:\n\t\tif S[i-1]!=S[i]:\n\t\t\tline.append(1)\n\t\telse:\n\t\t\tline[-1]+=1\nc=0\nfor i in range(len(line)):\n\n\tif i==0:\n\t\tif 2*K+1<=len(line... | ['Runtime Error', 'Accepted'] | ['s222711283', 's556917861'] | [4596.0, 4560.0] | [102.0, 107.0] | [500, 504] |
p03074 | u361381049 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["from collections import deque\nn, k = map(int, input().split())\ns = list(input())\nlis = []\nval = [0, 0]\nfor i in range(n):\n if s[i] == '1' and s[i-1] == '0':\n lis.append(val)\n val = [0,0]\n val[int(s[i])] += 1\nlis.append(val)\nlis2 = []\nval = [0,0]\ns.reverse()\nfor i in range(n):\n ... | ['Wrong Answer', 'Accepted'] | ['s012617695', 's708879691'] | [16272.0, 8004.0] | [231.0, 152.0] | [683, 633] |
p03074 | u362560965 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["import sys\n\nn,k = map(int,input().split())\ns = input()\n\n\ntmp1 = s[0]\ncount = 1\ndata = []\nzeros = 0\n\nfor i in range(1,len(s)):\n tmp2 = s[i]\n if tmp1 != tmp2:\n data.append((tmp1, count))\n if tmp1 == '0':\n zeros += 1\n tmp1 = tmp2\n count = 1\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s030565083', 's400230902'] | [10408.0, 10364.0] | [124.0, 119.0] | [2604, 814] |
p03074 | u367130284 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['from itertools import*\nfrom numpy import*\nn,k=map(int,input().split())\nk2=k+1\ns=input()\nif len(s)==1:\n if s=="1":\n print(1)\n else:\n print(0)\n exit()\nx=[len(list(v))for k,v in groupby(s)if k=="0"]\ny=[len(list(v))for k,v in groupby(s)if k=="1"]\nx1=array(x[:-k])\nx2=array(x[k:])\nx3=s... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s745852186', 's908023346', 's994902199', 's179559470'] | [18880.0, 17944.0, 14820.0, 14976.0] | [283.0, 224.0, 303.0, 306.0] | [427, 236, 476, 513] |
p03074 | u375870553 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["def main():\n n, k = [int(i) for i in input().split()]\n s = [int(i) for i in list(input())]\n table = []\n now = 1\n cnt = 0\n for i in range(n):\n if s[i] == now:\n cnt += 1\n else:\n table.append(cnt)\n cnt = 1\n now ^= 1 \n if cnt != 0... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s680091420', 's734569013', 's759862814', 's838720352', 's516025803'] | [3064.0, 5024.0, 5016.0, 5024.0, 5060.0] | [17.0, 2104.0, 2104.0, 2108.0, 96.0] | [960, 715, 686, 685, 971] |
p03074 | u379692329 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ['import sys\ninput = sys.stdin.readline \nN, K = map(int, input().split())\nS = list(map(int, input()))\n\ncnt = 0\nnow = 1\nNums = []\n\nfor i in range(N):\n if S[i] == now:\n cnt += 1\n else:\n Nums.append(cnt)\n now = 1 - now\n cnt = 1\n\nif cnt != 0:\n Nums.append(cnt)\nif len(... | ['Runtime Error', 'Accepted'] | ['s938587366', 's918521600'] | [4132.0, 4768.0] | [31.0, 144.0] | [684, 626] |
p03074 | u379959788 | 2,000 | 1,048,576 | N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo... | ["import math\nN, K = map(int, input().split())\nS = input()\n\n\ncnt_list = []\nflag = True if S[0] == '1' else False\ncnt = 1\nflag_flag = True\nfor i in range(1, N):\n if S[i] == '1':\n if i == N - 1:\n flag_flag = True\n if flag:\n cnt += 1\n else:\n flag = T... | ['Wrong Answer', 'Accepted'] | ['s144227351', 's296508657'] | [17348.0, 17348.0] | [148.0, 167.0] | [2067, 2126] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.