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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03074 | u390618988 | 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... | ['rom sys import stdin\n\nN, K = [int(x) for x in stdin.readline().rstrip().split()]\nS = stdin.readline().rstrip()\ncnt = 1\nrun = []\nfor i in range(1, len(S)):\n if S[i - 1] == S[i]:\n cnt += 1\n else:\n run.append(cnt)\n cnt = 1\n if i == len(S) - 1:\n run.append(cnt)\nX = [sum(... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s275768528', 's309489038', 's967246449', 's889074932'] | [2940.0, 4980.0, 4852.0, 4864.0] | [17.0, 2104.0, 2104.0, 95.0] | [422, 672, 423, 754] |
p03074 | u391277538 | 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\npeople = []\nprev = s[0]\nneg = False\nif prev == "0":\n\tneg = True\n\ncount = 1\n\nfor i in range(1, len(s)):\n\tif prev != s[i]:\n\t\tpeople.append(count)\n\t\tcount = 0\n\t\tprev = s[i]\n\tcount += 1\npeople.append(count)\n\nprint(people)\n\nif len(people)/2 <= k:\... | ['Wrong Answer', 'Accepted'] | ['s195750474', 's606688546'] | [5108.0, 4596.0] | [98.0, 91.0] | [811, 796] |
p03074 | u391875425 | 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() + "1"\narr = []\ncnt = 0\nflg = 1\nfor s in S:\n if s == "1" and 1 - flg:\n flg = 1\n arr.append(cnt)\n cnt = 1\n elif s == "0" and flg:\n flg = 0\n arr.append(cnt)\n cnt = 1\n else:\n cnt += 1\narr.append(cn... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s755164977', 's954503536', 's020601862'] | [8040.0, 10084.0, 8856.0] | [153.0, 159.0, 104.0] | [622, 623, 632] |
p03074 | u398000383 | 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()\nlast_s = "0"\ncount = 0\nA = []\nfor i, s in enumerate(S):\n\tif i == 0:\n\t\tcount += 1\n\telse:\n\t\tif s != last_s:\n\t\t\tA.append(count)\n\t\t\tcount = 0\n\t\tcount += 1\n\tlast_s = s\n\nif count != 0:\n\tA.append(count)\n\nB = []\n\nfor i in range(len(S)-(2*K+1)-1)... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s008208971', 's624742521', 's853369815'] | [4724.0, 4476.0, 4596.0] | [2104.0, 99.0, 105.0] | [332, 484, 887] |
p03074 | u404710939 | 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 = np.array([int(i) for i in input()])\npos1 = np.linspace(0,N-1,N)[S == 1]\nprint(pos1)\nlst = []\nst =[0]\nfor i in pos1:\n if st[-1] + 1 == i:\n st.append(i)\n else:\n lst.append(st)\n st = [i]\n if i == pos1[-1]:\n ls... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s039320704', 's231871639', 's524663810', 's139534320'] | [22536.0, 21924.0, 22600.0, 21952.0] | [429.0, 360.0, 368.0, 361.0] | [453, 570, 468, 658] |
p03074 | u405660020 | 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\ndef rle(string):\n _rle_str = string[0]\n _rle_cnt = 1\n _ans_l = []\n for _i in range(1, len(string)):\n if _rle_str == string[_i]:\n _rle_cnt += 1\n else:\n _ans_l.append([_rle_str, _rle_cnt])\n _rle_str = string[... | ['Wrong Answer', 'Accepted'] | ['s589096992', 's954506421'] | [17832.0, 17728.0] | [342.0, 162.0] | [1294, 1044] |
p03074 | u408620326 | 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,re,copy\ninput = sys.stdin.readline\n\nN,K=[int(x) for x in input().strip().split()]\n\nf=1\ncnt=0\nS=[]\nr=0\nfor s in input().strip():\n s=int(s)\n if s==f:\n cnt+=1\n else:\n r+=cnt\n S.append(r)\n cnt=1\n f=1-f\nelse:\n r+=cnt\n S.append(r)\nif len(S)%2... | ['Runtime Error', 'Accepted'] | ['s550847328', 's749550629'] | [7788.0, 7908.0] | [120.0, 126.0] | [507, 548] |
p03074 | u412989489 | 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\nzeros = []\nnum_zeros = 0\nstart = 0\ncont = False\nfor i in range(N):\n s = int(S[i])\n if s == 0 and not cont:\n start = i\n cont = True\n num_zeros += 1\n zeros.append([start,1])\n continue\n\n elif s == 0 and cont:\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s232561369', 's438579023', 's891270897', 's522632242'] | [11480.0, 11480.0, 8792.0, 3316.0] | [97.0, 2104.0, 204.0, 68.0] | [1337, 1295, 591, 231] |
p03074 | u417365712 | 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 groupby\nn, k = map(int, input().split())\nS = input().strip()\nL = [len(list(g)) for v, g in groupby(S)]\nA = [sum(L[:2*k+1])]\nfor i in range(0, len(L)-2*k-1, 2):\n A += A[-1]-L[i]-L[i+1]+L[i+2*k+1]+L[i+2*k+2],\nprint(max(A))', "from itertools import groupby\nn, k = map(int, input().split()... | ['Runtime Error', 'Accepted'] | ['s737301298', 's625869746'] | [5508.0, 5524.0] | [91.0, 94.0] | [245, 311] |
p03074 | u426108351 | 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 itertools\nN, K = map(int, input().split())\nS = input()\n\n\nhuman = []\nhumancount = []\nfor key, group in itertools.groupby(S):\n human.append(key)\n humancount.append(len(list(group)))\n\nhumancount\nhuman[0]\nhuman\n\nhumancount_ac = [0] + list(itertools.accumulate(humancount))\n\nans = 0\nj = 0\nte... | ['Wrong Answer', 'Accepted'] | ['s899720826', 's093192492'] | [12132.0, 9552.0] | [491.0, 211.0] | [753, 692] |
p03074 | u426764965 | 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())\nhead = s[0]\n\ncounts = []\n_hd = head\n_cnt = 0\nfor _s in s:\n if _s == _hd:\n _cnt += 1\n else:\n counts.append(_cnt)\n _hd = _s\n _cnt = 1\nelse:\n counts.append(_cnt)\n\nacc = [0]\nfor c in counts:\n acc.append(acc[-1] + c)\n\nif len(counts) <= ... | ['Runtime Error', 'Accepted'] | ['s378421829', 's703360309'] | [7924.0, 7932.0] | [59.0, 91.0] | [574, 615] |
p03074 | u434282696 | 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 = s + '#'\nleft = 0\nright =0\nl = []\nwhile left < n:\n if s[right] == s[right+1]:\n right += 1\n else:\n l.append(right-left+1)\n right += 1\n left = right\nif s[0] == '0':\n l.insert(0,0)\nif s[n-1] == '0':\n l.append(0)\nn = le... | ['Wrong Answer', 'Accepted'] | ['s470316788', 's446078526'] | [7932.0, 7932.0] | [125.0, 110.0] | [548, 550] |
p03074 | u439063038 | 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\ns = []\ncnt = 1\nfor i in range(N-1):\n if S[i] == S[i+1]:\n cnt += 1\n else:\n s.append(cnt)\n cnt = 1\ns.append(cnt)\n\nans = 0\nif S[0] == '0':\n s = [0] + s\nif S[-1] == '0':\n s = s + [0]\n\nif 2*K + 1 > len(s):\n print(sum(s))\... | ['Wrong Answer', 'Accepted'] | ['s337092441', 's034083965'] | [10704.0, 13732.0] | [2206.0, 97.0] | [438, 622] |
p03074 | u441575327 | 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 = list(map(int,input().rstrip().split()))\nS = list(input())\nif S[0] == '0':\n zero_start = True\nelse:\n zero_start = False\n\nN_normalized = [0] if zero_start else []\ntmp = '0' if zero_start else '1'\ncnt = 0\nfor i in range(len(S)):\n if tmp == S[i]:\n cnt += 1\n ... | ['Wrong Answer', 'Accepted'] | ['s752238956', 's817062895'] | [14660.0, 14436.0] | [2108.0, 227.0] | [761, 884] |
p03074 | u451017206 | 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... | ['package main\n\nimport (\n\t"bufio"\n\t"fmt"\n\t"os"\n\t"strconv"\n\t"strings"\n)\n\n// An Item is something we manage in a priority queue.\ntype Item struct {\n\tvalue []int\n\tpriority int64\n\t// The index is needed by update and is maintained by the heap.Interface methods.\n\tindex int // The index of the item... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s292202027', 's343197564', 's465965396'] | [2940.0, 2940.0, 8016.0] | [17.0, 17.0, 160.0] | [2388, 969, 553] |
p03074 | u451598761 | 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\ndef main():\n if \'get_ipython\' not in globals(): \n # For Subsession\n N,K = map(int, input().split())\n S = sys.stdin.readline\n else:\n # For Test\n # N = 5\n # K = 1\n # S = "00010"\n N = 14\n K = 2\n S = "11101010110011"\n # N = 1\n # K = 1\n # S = "1"\n ... | ['Runtime Error', 'Accepted'] | ['s924341987', 's087776979'] | [3064.0, 8088.0] | [18.0, 83.0] | [787, 1017] |
p03074 | u454524105 | 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 = int(input())\n\nt = [[0] * 10 for _ in range(10)]\nfor i in range(1, N + 1):\n s = str(i)\n t[int(s[0])][int(s[-1])] += 1\n\nresult = 0\nfor i in range(1, 10):\n for j in range(1, 10):\n result += t[i][j] * t[j][i]\nprint(result)', 'from itertools import accumulate\nn, k = map(int, input().split()... | ['Runtime Error', 'Accepted'] | ['s396727302', 's589783535'] | [3064.0, 8604.0] | [17.0, 95.0] | [238, 513] |
p03074 | u460245024 | 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 functools import reduce\nfrom operator import add\n\nn, k = map(int, input().split())\ns_law = input()\n\ncurrent_status = "1"\ns = [0]\nfor h in s_law:\n if h == current_status:\n s[-1] += 1\n else:\n s.append(1)\n current_status = h\n\njoin_num = k * 2 + 1\n\nmax_rev = 0\nfor i, stat... | ['Wrong Answer', 'Accepted'] | ['s419121176', 's805393222'] | [5216.0, 3316.0] | [2104.0, 239.0] | [394, 1051] |
p03074 | u463655976 | 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().rstrip()\nans = 1\ni = 1\nleft = 0\nright = 1\nwhile i < n:\n if k > 0:\n pos = s.find('1', i)\n if pos == -1:\n i = n\n right = n - 1\n else:\n pos = s.find('0', pos)\n if pos == -1:\n i =... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s113633708', 's358859621', 's616324907', 's729948548', 's946554029', 's960319953', 's298765898'] | [3316.0, 4084.0, 2940.0, 3316.0, 2940.0, 3316.0, 3316.0] | [96.0, 173.0, 17.0, 89.0, 17.0, 99.0, 105.0] | [560, 533, 415, 561, 629, 631, 837] |
p03074 | u466331465 | 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 = 0\nright = 0\nleft = 0\ng = 0\nsu = 0\nif A[0] == 0:\n for i in range(len(s)):\n su +=s[right]\n if right%2==0:\n g += 1\n right +=1\n if g<=K:\n a = max(a,su)\n else:\n while g>K:\n su -= s[left]\n if left%2==0:\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s051678708', 's583377780', 's644199656', 's771789322', 's924986161', 's722903343'] | [3064.0, 3064.0, 3064.0, 10712.0, 3064.0, 10072.0] | [17.0, 18.0, 17.0, 297.0, 19.0, 214.0] | [696, 1032, 1033, 981, 1044, 949] |
p03074 | u471212175 | 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\na = [0]\ntmp = 1\nfor i in range(n-1):\n if s[i] == s[i+1]:\n tmp += 1\n else:\n a.append(tmp)\n tmp += 1\na.append(tmp)\nm = len(a)\nans = 1\nif len(a) == 2 or m-2*k < 1:\n ans = a[m-1]\nelif s[0] == "1":\n for i in range(1,m-2*... | ['Wrong Answer', 'Accepted'] | ['s362039325', 's946548690'] | [7888.0, 7848.0] | [116.0, 119.0] | [757, 465] |
p03074 | u473633103 | 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# Your code here!\n\nimport time\n\nt = time.time()\nn,k = map(int,input().split())\n\ns = input()\n\ns = "10"*10**5\n\nnow = s[0]\ntmp = 0\n\nh = []\nif s[0]=="0":\n h.append(0)\n\nfor i in s:\n if i != now:\n now = i\n h.append(tmp)\n tmp=0\n tmp+=1\nh.append(tmp)\n\na... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s032500933', 's408153701', 's266169880'] | [6828.0, 4340.0, 21424.0] | [2104.0, 2104.0, 1933.0] | [393, 434, 374] |
p03074 | u474423089 | 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 accumulate\n\nn,k = list(map(int,input().split(" ")))\ns = input()\n\ndef solve():\n cnt=0\n l=[]\n prev = "1"\n for i in s:\n if prev ==i:\n cnt += 1\n else:\n l.append(cnt)\n cnt = 1\n prev =i\n l.append(cnt)\n if prev=="0... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s034114992', 's113376851', 's185435607', 's611743199', 's636974271', 's813641528', 's816465605', 's888851903', 's119593105'] | [8700.0, 8700.0, 8700.0, 8700.0, 3316.0, 8700.0, 9276.0, 8700.0, 8700.0] | [45.0, 45.0, 45.0, 45.0, 18.0, 46.0, 52.0, 46.0, 46.0] | [539, 530, 518, 546, 513, 538, 569, 539, 528] |
p03074 | u475503988 | 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()\nNums = [0]\nnow = 1 \ncnt = 0 \nfor i in range(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:\n Nums.append(cnt)\n\n\nif len(Nums) % 2 == 0:\n Nums.append(0)\n\nAdd = 2 *... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s052705923', 's804254180', 's580062548'] | [4088.0, 3316.0, 7884.0] | [2104.0, 18.0, 130.0] | [786, 783, 944] |
p03074 | u486990800 | 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 = int(input())\nS = input()\nn = list(map(int, str(S)))\ncount = 1\nmas = []\nfor i in range(N-1):\n if n[i] == n[i + 1]:\n count += 1\n else:\n mas.append(count)\n count = 1\n if i == N-2:\n mas.append(1)\n \nl = len(mas)\nmas2 = []\nfor m in K:\n \n\n if l... | ['Runtime Error', 'Accepted'] | ['s510068592', 's979971783'] | [3064.0, 10160.0] | [17.0, 91.0] | [977, 736] |
p03074 | u493520238 | 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\n\nn,k = map(int, input().split())\ns = input()\n\ncnt_01 = []\nprev = ''\ncnt = 0\nfor c in s:\n if c == prev:\n cnt_01.append(cnt)\n cnt = 0\n else: \n cnt += 1\n prev = c\nelse:\n cnt_01.append(cnt)\n\n\nif len(cnt_01) <= 2*k:\n print(n)\n exit()... | ['Wrong Answer', 'Accepted'] | ['s628704639', 's145291820'] | [4340.0, 5236.0] | [112.0, 118.0] | [564, 949] |
p03074 | u494058663 | 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.append('X')\nlist_1 = []\nlist_0 = []\nList = []\nstart = 0\nans = 0\nfor i in range(1,N+1):\n if (S[i-1] != S[i]):\n if S[i-1] == '0':\n list_0.append(i-start)\n else:\n list_1.append(i-start)\n start = i\n\n\nfor i in... | ['Wrong Answer', 'Accepted'] | ['s718518068', 's455771704'] | [6268.0, 8572.0] | [2108.0, 128.0] | [784, 578] |
p03074 | u495903598 | 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# coding: utf-8\n\n# In[24]:\n\nimport sys\n#input = sys.stdin.readline\nN, K = map(int, input().split())\nS = input()\n\n\n# In[26]:\n\ntmp = S[0]\nc_list = []\ncounter = 1\nfor i in range(1, len(S)):\n #counter += 1\n #print(S[i], i)\n if S[i] != tmp:\n c_list.append(counter)\n counter = 0\... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s256694546', 's889458251', 's746162088'] | [5364.0, 9100.0, 9120.0] | [2104.0, 93.0, 96.0] | [630, 784, 1414] |
p03074 | u501952592 | 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\nS += '2'\nl = []\ncnt = 1\nfor i in range(N):\n if S[i] == S[i+1]:\n \tcnt += 1\n else:\n l.append(cnt)\n cnt = 1\n\nif S[0] == '0':\n cur = sum(l[:2*K])\n ans = cur\n for j in range(1, len(l), 2):\n cur += -sum(l[j-2: j]) + sum(l[j+2*K-1:j+2*K+1])\n ... | ['Wrong Answer', 'Accepted'] | ['s780243889', 's958039781'] | [4596.0, 4596.0] | [109.0, 120.0] | [479, 495] |
p03074 | u503228842 | 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())\nS = input()\nstands = []\ntemp = ''\nfirst_handstand = False\nfor i,s in enumerate(S):\n if i == 0:\n temp += s\n continue\n if temp[-1] == s:\n temp += s\n else:\n stands.append(len(temp))\n temp = s\nstands.append(len(te... | ['Wrong Answer', 'Accepted'] | ['s545155932', 's794371276'] | [15584.0, 15640.0] | [275.0, 262.0] | [678, 655] |
p03074 | u504562455 | 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 = [1] + [int(i) for i in list(input())] + [1,0]\none2zero = [i for i in range(n+2) if s[i] == 1 and s[i+1] == 0]\nprint(one2zero)\nans = 1\nfor i in range(len(one2zero)-k):\n if one2zero[i + k] - one2zero[i] > ans:\n ans = one2zero[i + k] - one2zero[i]\nprint(ans)', 'n,... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s595028124', 's937694649', 's161152617'] | [6792.0, 8072.0, 8072.0] | [64.0, 62.0, 72.0] | [304, 549, 557] |
p03074 | u508927589 | 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())\nt = list(str(input()))\nt = [int(s) for s in t]\nlast = t[0]\ntemp_c = 0\ns = []\ncon_c = 0\ntemp_con_c = 0\ncorrent_p = 0\nsum_t = []\nfor i in range(n):\n if last == t[i]:\n temp_c += 1\n else:\n last = t[i]\n s.append(temp_c)\n temp_c = 1\ns.append(... | ['Wrong Answer', 'Accepted'] | ['s811870283', 's273252715'] | [8476.0, 8476.0] | [139.0, 122.0] | [594, 1035] |
p03074 | u513094698 | 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] = input().split(" ")\ns = input()\n\ncnt = 0\ninit = (s[0]==\'1\')\nh=[1]\nh_cnt = 0\n\nfor i in range(1,n):\n if(s[i]!=s[i-1]):\n h_cnt+=1\n h.append(1)\n else:\n h[h_cnt]+=1\n\nh_cnt+=1\n\nzero_num = 0\nans = 0\n\nif(init): #start with 1\n zero_num = h_cnt//2;\n if(zero_num<=k... | ['Runtime Error', 'Accepted'] | ['s808365420', 's127226811'] | [3064.0, 5712.0] | [17.0, 84.0] | [911, 959] |
p03074 | u517447467 | 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\ndef search(first, count):\n change = 0\n past = S[first]\n for i in range(first, len(S)):\n now = S[i]\n if past != now:\n change += 1\n if change == count*2:\n for j in range(i, len(S)):\n if S[first] != S[j]:\n retu... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s199510588', 's288024820', 's301914463', 's304485740', 's375068708', 's437291935', 's485799971', 's590368105', 's963153391'] | [3316.0, 4468.0, 3316.0, 3316.0, 3316.0, 3316.0, 4596.0, 3316.0, 3316.0] | [2104.0, 76.0, 2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 161.0] | [586, 428, 569, 561, 559, 561, 402, 559, 344] |
p03074 | u518042385 | 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,m=map(int,input().split())\nl1=list(input())\nl=[]\nlm=[]\nc=0\nd=l1[0]\nfor i in l1:\n if i==d:\n c+=1\n else:\n d=i\n l.append(c)\n c=1\nl.append(c)\nif l1[0]=="1":\n if len(l)//2<=m:\n print(n)\n else:\n j=0\n for i in range((len(l)-2*m-1)//2+1):\n lm.append(sum(l[j:j+2*m])+l[j+2*m]... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s029461762', 's916436143', 's916898036', 's907753164'] | [5304.0, 4120.0, 5156.0, 4120.0] | [2104.0, 52.0, 2104.0, 79.0] | [578, 366, 535, 420] |
p03074 | u525227429 | 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.count("1") == N or S.count("0") == N:\n print(N)\nelse:\n ans = 0\n for i in range(N):\n cnt = 0\n change = 0\n for j in range(i, N):\n if j != 0 and S[j] == "0" and S[j - 1] == "1":\n change += 1\n if change <= K:\n cnt += 1\n ... | ['Wrong Answer', 'Accepted'] | ['s564163434', 's047711031'] | [3316.0, 8004.0] | [2104.0, 136.0] | [364, 560] |
p03074 | u525404340 | 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(map(int, input()))\n \nZ = [j for j, s in enumerate(S) if (j > 0 and s == 0 and S[j] != S[j-1]) or (j == 0 and s == 0)] + [N]\nY = [j for j, s in enumerate(S) if (j > 0 and s == 1 and S[j] != S[j-1]) or (j == 0 and s == 1)]\nresult = 0\nif len(Z) <= K:\n print(N)\nelse:\n... | ['Runtime Error', 'Accepted'] | ['s143520423', 's529583750'] | [7704.0, 7968.0] | [84.0, 95.0] | [465, 489] |
p03074 | u528124741 | 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 s[0] == "0":\n s_num = [0]\nelse:\n s_num = []\npre = s[0]\nnum = 0\n\nfor i in s:\n if pre == i:\n num += 1\n else:\n s_num.append(num)\n num = 1\n pre = "1" if pre == "0" else "0"\nelse:\n s_num.append(num)\n\nsum... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s025468484', 's068649455', 's246071179', 's380725854', 's564410251', 's783928510', 's654363936'] | [9388.0, 9384.0, 9380.0, 4792.0, 8616.0, 4776.0, 8616.0] | [92.0, 71.0, 90.0, 44.0, 84.0, 43.0, 99.0] | [516, 514, 516, 277, 505, 572, 499] |
p03074 | u529180657 | 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()\nc = [int(s[i]) for i in range(n)]\nids = [0]\nfor i in range(1,n):\n if c[i] != c[i-1]:\n ids.append(i)\nids.append(n)\nl = len(ids)\nresult = []\nfor i in range(l-1):\n if c[ids[i]] == 0:\n if i + 2*k < l:\n result.append(ids[i+2*k] - ids[i])\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s193467944', 's340307023'] | [11776.0, 11892.0] | [116.0, 120.0] | [462, 466] |
p03074 | u531436689 | 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()\nnew_S = []\ncount_S = []\n\ncur_c = S[0]\ncur_count = 0\n\nnew_S.append(cur_c)\nfor c in S:\n if c == cur_c:\n cur_count += 1\n else:\n new_S.append(c)\n count_S.append(cur_count)\n cur_count = 1\n cur_c = c\ncount_S.append(cur_co... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s280230195', 's751874448', 's884474913', 's938259875', 's254478521'] | [3064.0, 3064.0, 27004.0, 3064.0, 6540.0] | [17.0, 17.0, 2105.0, 17.0, 93.0] | [905, 905, 1223, 901, 960] |
p03074 | u532966492 | 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()+"2"\nif S[0]=="1":\n _list=[]\nelse:\n _list=[0]\ncnt=1\nfor i in range(N):\n if S[i]==S[i+1]:\n cnt+=1\n else:\n _list.append(cnt)\n cnt=1\nprint(_list)\nC=len(_list)\nK=min(C,K)\nmax([sum(_list[2*i:2*i+2*K+1]) for i in range(C-K+1)])', 'N,K=ma... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s481456299', 's512360114', 's545914088', 's788859482'] | [5284.0, 5284.0, 10860.0, 9412.0] | [2104.0, 2104.0, 81.0, 69.0] | [292, 299, 467, 451] |
p03074 | u535907456 | 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()\ni,j = 0,0\nonenumber = [0] * (K+1)\nzeronumber = [0] * K\ntest, answer = 0,0\ninfront = ''\n\nfor x in S:\n if x == '0':\n if infront == '1':\n test += onenumber[j]\n answer = max(answer,test)\n print(answer)\n if j == K... | ['Wrong Answer', 'Accepted'] | ['s943340395', 's390144355'] | [4852.0, 4852.0] | [146.0, 101.0] | [815, 789] |
p03074 | u537782349 | 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, b = map(int, input().split())\nc = list(input() + "2")\nd = 1\ne = []\nfor i in range(1, len(c)):\n if c[i] != c[i-1]:\n if c[i-1] == "1":\n e.append(d)\n else:\n e.append(-d)\n d = 1\n else:\n d += 1\nf = 0\ng = 0\nh = 0\nprint(e)\nfor i in range(len(e)):\n ... | ['Wrong Answer', 'Accepted'] | ['s393496728', 's887084068'] | [5796.0, 4092.0] | [151.0, 167.0] | [505, 652] |
p03074 | u538632589 | 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()\n\nlength_list = []\n\ntmp_one_length = 0\ntmp_zero_length = 0\n\nfor i in range(n):\n if s[i] == "1" and i > 0 and s[i-1] == "0":\n length_list.append([tmp_zero_length, tmp_one_length])\n tmp_one_length = 0\n tmp_zero_length = 0\n if s[... | ['Wrong Answer', 'Accepted'] | ['s375800362', 's411632885'] | [10196.0, 8728.0] | [142.0, 93.0] | [1146, 866] |
p03074 | u539517139 | 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()\nfrom itertools import groupby\na=[len(list(j)) for i,j in groupby(s)]\nif s[0]==0:\n a=[0]+a\nif s[n-1]==0:\n a=a+[0]\nw=2*k+1\nif len(a)<=w:\n print(n)\n exit()\nm=sum(a[:w])\nx=m\nfor i in range(2,len(a)-2*k,2):\n m=m-a[i-1]-a[i-2]+a[i+k+1]+a[i+k+2]\n x=max(x,m)\nprint... | ['Wrong Answer', 'Accepted'] | ['s132856559', 's722726738'] | [4596.0, 4980.0] | [92.0, 90.0] | [304, 308] |
p03074 | u540761833 | 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 '0' not in s:\n print(len(s))\nelse:\n s2 = []\n count = 1\n for i in range(1,len(s)):\n if s[i-1] == s[i]:\n count += 1\n if s[i-1] != s[i]:\n s2.append(count)\n count = 1\n s2.append(count)\n if s[0] != '1... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s023910824', 's984546401', 's370514109'] | [4468.0, 4916.0, 7108.0] | [2104.0, 2104.0, 94.0] | [500, 569, 399] |
p03074 | u545368057 | 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 accumulate\n\nN, K = map(int,input().split())\nS = input()\n\nnums = []\ntmp = "1" \ncount = 0\nfor s in S:\n if tmp == s:\n count += 1\n else:\n nums.append(count)\n count = 1\n tmp = s\nnums.append(count)\nif tmp == "0":\n l.append(0) \n\n# print(nums)\n\n\... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s135358440', 's564883376', 's679137234', 's970638889', 's117928248'] | [8700.0, 8692.0, 8692.0, 8692.0, 8700.0] | [67.0, 46.0, 61.0, 45.0, 60.0] | [744, 643, 649, 643, 747] |
p03074 | u547001323 | 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\n\nN, K = map(int, input().split())\nS = [int(x) for x in input()]\n\ncount = 0\nflag = True\n\nla = deque([])\nfor c in S:\n if int(flag) == c:\n count += 1\n else:\n la.append(count)\n count = 1\n flag = not flag\n\nla.append(count)\n\nprint(la)\n\nltm... | ['Runtime Error', 'Accepted'] | ['s106402759', 's231570294'] | [8328.0, 8216.0] | [147.0, 147.0] | [1042, 865] |
p03074 | u552357043 | 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_list = []\ncum_list = [0]\ntmp = 1\ncount = 0\n\nfor i in range(N):\n if i == 0:\n if int(S[i]) == tmp:\n count += 1\n else:\n S_list.append(count)\n count = 1\n else:\n if S[i] == S[i - 1]:\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s438830553', 's896257224', 's602298971'] | [7932.0, 9536.0, 9536.0] | [77.0, 98.0, 104.0] | [798, 826, 794] |
p03074 | u552823722 | 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\nprint(N)\nprint(K)\n\n# make seq_cnt_list\nseq_cnt_list = []\nseq_cnt = 0\nlast_man = ""\nfor i in range(N):\n cur_man = S[i]\n if cur_man != last_man:\n #print("S[%d]=%s is change" % (i, S[i]))\n if seq_cnt > 0:\n if last_man == "0":\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s726984548', 's966904731', 's679575644'] | [10748.0, 9884.0, 11292.0] | [2206.0, 64.0, 130.0] | [1488, 1476, 1256] |
p03074 | u556225812 | 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\nsys.setrecursionlimit(1000000)\nN, K = map(int, input().split())\nS = list(input())\nX = []\ncnt = 1\nfor i in range(1, N):\n if S[i] != S[i-1]:\n X.append(cnt)\n cnt = 0\n cnt += 1\n if i == N-1:\n X.append(cnt)\n\nl = len(X)\nif S[0] == '0' and (l+1)//2 <= k:\n print(N)\... | ['Runtime Error', 'Accepted'] | ['s954000623', 's649876421'] | [4816.0, 4816.0] | [69.0, 132.0] | [906, 872] |
p03074 | u556326496 | 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()\nintS = int(S)\n\ncalc_list = [1 if S[0] == '0' else 0]\nfor i in range(1, len(S)):\n if S[i] == '0':\n if S[i-1] == '1':\n calc_list.append(1)\n elif S[i-1] == '0':\n calc_list.append(calc_list[i-1] + 1)\n else:\n calc_lis... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s227426801', 's941614677', 's232808357'] | [3064.0, 12300.0, 9468.0] | [17.0, 211.0, 106.0] | [1073, 891, 948] |
p03074 | u559048291 | 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\nmans = [];\nseq = 0;\nnow = S[0];\nif(now == "0"):\n mans.append(0);\n\nfor i in S:\n if(i == now):\n seq += 1;\n else:\n mans.append(seq);\n seq = 1;\n if(now=="1"):\n now="0"\n else:\n now="1"\n\nif(s... | ['Wrong Answer', 'Accepted'] | ['s634191056', 's173306619'] | [9976.0, 7932.0] | [90.0, 83.0] | [879, 860] |
p03074 | u561231954 | 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\nnum_cnt=[]\nif s[0]=='1':\n num_cnt.append(0)\n\ncnt=1\nfor i in range(1,n):\n if s[i]==s[i-1]:\n cnt+=1\n else:\n num_cnt.append(cnt)\n cnt=1\nnum_cnt.append(cnt)\n\nleng=len(num_cnt)\nif leng//2>k:\n ans=sum(num_cnt[:2*k])\n tot=ans\n \n if leng%2==0:\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s299812168', 's636577130', 's645466669', 's300093523'] | [4596.0, 4476.0, 4596.0, 4476.0] | [83.0, 78.0, 82.0, 83.0] | [680, 631, 680, 692] |
p03074 | u572142121 | 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=[]\nB=[]\nif S[0]=='1':\n A.append(0)\nfor i in range(N-1):\n if S[i]=='0' and S[i+1]=='1':\n A.append(i+1)\n elif S[i]=='1' and S[i+1]=='0':\n B.append(i)\nif S[-1]=='1':\n B.append(N-1)\n\na=len(A)-K\nans=0\nfor i in range(a):\n l=B[i+K]-A[i]+1\n ans=max(l,an... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s173174511', 's630889312', 's604417812'] | [7248.0, 8836.0, 7108.0] | [75.0, 126.0, 82.0] | [344, 474, 446] |
p03074 | u572193732 | 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\ntmp_count = 1\ncount_list = []\nfor i in range(N-1):\n if S[i] == "0" and S[i+1] == "0":\n tmp_count += 1\n elif S[i] == "1" and S[i+1] == "1":\n tmp_count += 1\n elif S[i] == "0" and S[i+1] == "1":\n count_list.append(tmp_count)\n ... | ['Runtime Error', 'Accepted'] | ['s263376525', 's137872950'] | [5108.0, 8692.0] | [2104.0, 61.0] | [1798, 333] |
p03074 | u576432509 | 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 sys\n\nicase=0\nif icase==0:\n n,k=map(int,input().split())\n s=input()\nelif icase==1:\n n,k=14,2\n s="11101010110011"\nelif icase==2:\n n,k=15,2\n s="111010101100110"\nelif icase==3:\n n,k=16,2\n s="1110101011001101"\n s="1110101011001100"\n\nif n==1:\n print(1)\n sys.exit(... | ['Wrong Answer', 'Accepted'] | ['s638106203', 's614157557'] | [10748.0, 10040.0] | [130.0, 97.0] | [1491, 1287] |
p03074 | u577170763 | 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... | ["# input\n\n#s = input()\nn=14\nk=2\ns='11101010110011'\n\n# solve\n\n##. number of consecutive 0 groups and 1 groups\n##. ex:\n\n##. 0: 0, 0, 0, 00\n##. 1: 111, 1, 1, 11, 11\n\n##. ones = [3, 1, 1, 2, 2]\n##. (always count the edges of s as 1)\nzeros = []\nones = []\n_c = '1'\ncount = 0\nfor c in s:\n\... | ['Wrong Answer', 'Accepted'] | ['s928419061', 's866266839'] | [3064.0, 4356.0] | [18.0, 93.0] | [749, 922] |
p03074 | u577579003 | 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=[]\nn=0\nfor i in range(len(S)-1):\n n+=1\n if(S[i]!=S[i+1]):\n L.append(n)\n n=0\nif S[0]=="0":\n L.insert(0,0)\n\nmax_r = 0\nfor i in range(len(L)-K-2):\n R = sum(L[2*(i+1)-2:2*(i+1)-1+2*K+1])\n #print(R)\n if max_r < R:\n max_r... | ['Wrong Answer', 'Accepted'] | ['s671565883', 's052895320'] | [4468.0, 7160.0] | [2104.0, 70.0] | [319, 340] |
p03074 | u579170193 | 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()\nn = len(s)\n\nif n == 1:\n print(1)\n exit(0)\n\nl = []\nif s[0] == "0":\n l.append(0)\n\ntemp = 1\nfor i in range(1, n):\n if s[i] == s[i - 1]:\n temp += 1\n if i == n - 1:\n l.append(temp)\n else:\n l.append(temp)\n ... | ['Runtime Error', 'Accepted'] | ['s005753068', 's504687598'] | [8052.0, 8052.0] | [121.0, 127.0] | [667, 727] |
p03074 | u584174687 | 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 kakaka():\n a = list(map(int, input().split()))\n b = map(int, input().split())\n c = int(input())\n\ndef start_process():\n return\ndef main():\n all_num, inst_num = map(int, input().split())\n data = list(input())\n\n data_la = []\n ans_0, ans_1 = 0, 0\n for i in range(all_num):\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s079236094', 's626569380', 's669320888'] | [4816.0, 5712.0, 4776.0] | [71.0, 86.0, 78.0] | [1525, 1595, 1597] |
p03074 | u587199081 | 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 stdin\nsN,sK = stdin.readline().rstrip().split()\nN,K = int(sN), int(sK)\nS = stdin.readline().rstrip()\n\n# print(S)\n\nk = len(S.split("1"))\n# print("k:",k)\nnum = 0\nfor itr in range(0,N):\n if K < k:\n # print(S[:N-itr].split("1"))\n list1 = S[:N-itr].split("1")\n c = 0\n ... | ['Wrong Answer', 'Accepted'] | ['s537124139', 's839817682'] | [5504.0, 4092.0] | [2104.0, 169.0] | [632, 733] |
p03074 | u587482466 | 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 itertools\nimport sys\nimport math\nfrom functools import lru_cache\n\n\n# n = int(input())\n\n\nfrom queue import Queue\nfrom operator import mul\nfrom functools import reduce\nfrom queue import Queue\nfrom operator import mul\nfrom functools import reduce\nfrom functools import lru_c... | ['Wrong Answer', 'Accepted'] | ['s210191677', 's705630755'] | [5360.0, 4316.0] | [216.0, 131.0] | [1154, 1155] |
p03074 | u590211278 | 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()\nS2=[]\nkey=S[0]\ntmpcnt=1\nif key=='0':\n S2.append(0)\nS2.append(0)\nS2.append(0)\nfor i in range(1,len(S)):\n if key!=S[i]:\n if key == '0':\n S2.append(-1*tmpcnt)\n else:\n S2.append(tmpcnt)\n key=S[i]\n tmpcnt... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s175082719', 's452320158', 's675041356'] | [5232.0, 4096.0, 4212.0] | [143.0, 76.0, 139.0] | [877, 800, 878] |
p03074 | u593761424 | 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\n\nN, K = map(int, input().split())\nS = input()\ns_arr = np.fromiter(map(int, S), int)\n\n# search where 1\narr = np.array([0] + s_arr.tolist() + [0])\ndiff = np.diff(arr)\nheads = np.where(diff == 1)[0]\ntails = np.where(diff == -1)[0]\nassert heads.size == tails.size\n\nans = 0\nfor i, head in... | ['Wrong Answer', 'Accepted'] | ['s169743237', 's357645575'] | [15792.0, 18600.0] | [249.0, 272.0] | [425, 654] |
p03074 | u595786324 | 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... | ["#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n int n,k;\n cin >> n >> k;\n string s;\n cin >> s;\n\n int i=0;\n int j=0;\n\n int ans = 0;\n\n while(j<n)\n {\n while(j<n && s[j]=='1')\n {\n j++;\n }\n ans = max(ans,j-i);\n while... | ['Runtime Error', 'Accepted'] | ['s069678703', 's569931396'] | [2940.0, 4092.0] | [18.0, 71.0] | [631, 687] |
p03074 | u595952233 | 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(map(int, list(input())))\n\ni = 0\na = []\nwhile i < n:\n l = 1\n while i+1 < n and s[i]==s[i+1]:\n l+=1\n i+=1\n a.append(l)\n i+=1\n\nn = len(a)\nif s[0] == 0:\n st = 0\nelse:\n st = 1\n\nacum = [0]*(n+1)\nfor i in range(n):\n acum[i+1] =... | ['Wrong Answer', 'Accepted'] | ['s635510916', 's867666555'] | [14284.0, 14164.0] | [137.0, 114.0] | [463, 440] |
p03074 | u598860476 | 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 = tuple(input())\n\nnow = 1 \ncnt = 0 \nnums =[]\n\nfor i in range(n):\n if s[i] == '0'+str(now):\n cnt += 1\n else:\n nums.append(cnt)\n now ^= 1 \n cnt += 1\n\nif cnt != 0:\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n nums.append(0)\n\na... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s056442395', 's674312743', 's777518051'] | [7852.0, 7852.0, 4772.0] | [183.0, 85.0, 164.0] | [729, 717, 711] |
p03074 | u599114793 | 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_0_1 = [1]*(k+int(s[0]))\ns_1_0 = []\nfor i in range(n-1):\n if s[i] == "0" and s[i+1] == "1":\n s_0_1.append(i+2)\n elif s[i] == "1" and s[i+1] == "0":\n s_1_0.append(i+1)\ns_1_0.extend([n]*(k+int(s[-1])))\nprint(s_0_1)\nprint(s_1_0)\n\nans = 0\... | ['Wrong Answer', 'Accepted'] | ['s499027995', 's603367157'] | [10508.0, 8356.0] | [100.0, 85.0] | [386, 359] |
p03074 | u600402037 | 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 sys\nimport itertools\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\n\nstreak = [0, 0]\nN, K = lr()\nS = sr() + '2'\ncur = 1\nfor i in range(N):\n if S[i] != S[i+1]:\n streak.append(cur)\n cur = 1\n else:\... | ['Runtime Error', 'Accepted'] | ['s956008158', 's204237470'] | [7924.0, 7924.0] | [64.0, 78.0] | [699, 738] |
p03074 | u604398799 | 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"""\nCreated on Sat Apr 13 09:53:12 2019\n\n@author: Owner\n"""\n\nimport collections\nimport scipy.misc\nimport sys\nimport numpy as np\nimport math\nfrom operator import itemgetter\nimport itertools\nimport copy\nimport bisect\n\n\ndef prime_decomposition(n):\n i = 2\n table = []\n while... | ['Runtime Error', 'Accepted'] | ['s163998598', 's238652999'] | [14696.0, 18484.0] | [188.0, 228.0] | [2750, 3051] |
p03074 | u614314290 | 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\nzo_count = [1]\nfor n in range(1, N):\n\tif S[n] == S[n - 1]:\n\t\tzo_count[-1] += 1\n\telse:\n\t\tzo_count += [1]\n\nzo_sum = [0]\nfor zo in zo_count:\n\tzo_sum += [zo_sum[-1] + zo]\n\nif N <= K + 2:\n\tprint(zo_sum[-1])\n\texit()\n\nprint(zo_sum)\n\nzo_max = 0\nfor n... | ['Wrong Answer', 'Accepted'] | ['s322411615', 's550247249'] | [9968.0, 4468.0] | [123.0, 57.0] | [397, 562] |
p03074 | u614875193 | 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 ranlength(A):\n num = list(A)\n count = 1\n result = ''\n table = []\n for i in range(len(num)):\n try:\n if num[i] == num[i+1]:\n count = count + 1\n else:\n result += str(num[i]) + str(count)\n table.append(count)\n ... | ['Wrong Answer', 'Accepted'] | ['s030469662', 's493133480'] | [5384.0, 5068.0] | [225.0, 141.0] | [2145, 825] |
p03074 | u623231048 | 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\ndef main():\n n,k = map(int,input().split())\n s = input()\n li = np.array([])\n count = 1\n\n\n for i in range(n-1):\n if s[i] == s[i+1]:\n count += 1\n else:\n li = np.append(li,count)\n count = 1\n li = np.append(li,count)\n\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s168655818', 's462461642', 's518538970', 's318148194'] | [15476.0, 7160.0, 9204.0, 7160.0] | [2108.0, 81.0, 89.0, 86.0] | [786, 568, 579, 634] |
p03074 | u623687794 | 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 a=[0]\nelse:a=[]\ni=0\nc=0\nwhile True:\n c+=1\n if s[i]!=s[i+1]:\n a.append(c)\n c=0\n i+=1\n if i==len(s)-1:\n a.append(len(s)-sum(a))\n break\nl=len(a)\nif 2*k+1>=l:print(l)\nelse:\n c=sum(a[:2*k+1])\n ans=sum(a[:2*k+1])\n for i in range(... | ['Runtime Error', 'Accepted'] | ['s563245072', 's753971953'] | [4596.0, 14284.0] | [106.0, 158.0] | [368, 478] |
p03074 | u625963200 | 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\nT='0'+S+'0'\n\nans,cnt=0,0\nfor i,(a,b) in enumerate(zip(S,S[1:])):\n if a=='0' and b=='1':\n cnt+=1\n elif cnt==k and a=='1' and b=='0':\n ans=max(ans,i+1)\n break\nelse:\n print(n)\n exit()\n \nS,cnt=[::-1],0\nfor i,(a,b) in enumerate(zip(S,S[1:])):\n if a==... | ['Runtime Error', 'Accepted'] | ['s515829605', 's110744468'] | [3060.0, 7716.0] | [17.0, 81.0] | [601, 601] |
p03074 | u626337957 | 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 = []\nbefore = ''\ncnt = 0\nlen_l = 0\nfor i in range(N):\n if before == '0' and S[i] == '0'\n \tcnt += 1\n elif before == '0' and S[i] == '1'\n \tbefore = '1'\n L.append(cnt)\n len_l += 1\n cnt = 0\n elif before == '1' and S[i] == '0'\n before == '0... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s034211178', 's094314007', 's442848218', 's491281955', 's610476105', 's991460249', 's574405431'] | [2940.0, 4596.0, 3064.0, 2940.0, 3316.0, 4536.0, 4596.0] | [17.0, 86.0, 17.0, 18.0, 31.0, 77.0, 116.0] | [434, 747, 479, 438, 480, 991, 514] |
p03074 | u627417051 | 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 = list(input())\n\nL = [1]\n\nfor i in range(1, N):\n\tif S[i] == S[i - 1]:\n\t\tL[-1] += 1\n\telse:\n\t\tL.append(1)\n\nn = len(L)\nif S[0] == "1":\n\tif n // 2 <= K:\n\t\tprint(N)\n\telse:\n\t\tif S[-1] == "1":\n\t\t\tx = L[0]\n\t\t\tfor i in range(K):\n\t\t\t\tx += L[2 * i... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s191369220', 's277543944', 's357050302', 's550512765', 's720161464'] | [6408.0, 6408.0, 6408.0, 5584.0, 6316.0] | [95.0, 95.0, 93.0, 83.0, 96.0] | [1860, 1840, 1860, 1140, 2016] |
p03074 | u627655207 | 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 sub():\n N, K = [int(e) for e in input().split(" ")]\n ss = [int(e) for e in input()]\n if len(set(ss)) == 1:\n print(len(ss))\n return\n\n dd = [ss[i+1] - ss[i] for i in range(N-1)]\n idd = [0] + [i+1 for i, d in enumerate(dd) if d != 0]\n \n maxScore = 0\n for i in idd:\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s172476779', 's813244824', 's761559986'] | [9372.0, 3064.0, 9372.0] | [85.0, 17.0, 86.0] | [802, 834, 846] |
p03074 | u629246993 | 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\ndef findmax(s,k):\n if len(s) == 1:\n return 1\n begin = s[0]\n l = [0]\n cur = 0\n for i in range(len(s)):\n if s[i]==begin:\n l[cur]+=1\n else:\n if begin == '0' : begin ='1'\n else: begin = '... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s090627596', 's254032323', 's539591706'] | [9464.0, 5892.0, 8704.0] | [59.0, 2104.0, 49.0] | [617, 687, 534] |
p03074 | u630281418 | 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... | ['s = list(input())\nis_count_zero = True\nsl = [0]\nsl_ptr = 0\nfor c in s:\n if is_count_zero and c == \'1\':\n sl.append(1)\n sl_ptr += 1\n is_count_zero = False\n elif not is_count_zero and c == \'0\':\n sl.append(1)\n sl_ptr += 1\n is_count_zero = True\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s697834853', 's570026836'] | [3064.0, 5352.0] | [17.0, 112.0] | [929, 1301] |
p03074 | u638282348 | 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 = map(int, input().split())\nS = input()\n\noffset = not (int(S[0]) ^ (K & 1))\nruns = []\n\nprev = S[0]\nrun = 0\nfor c in S:\n if c != prev:\n runs.append(run)\n run = 0\n prev = c\n run += 1\nruns.append(run)\n\nL = len(runs)\ncandidates = []\n\nprev = sum(runs[max(0, offset - K): min(L... | ['Wrong Answer', 'Accepted'] | ['s402178230', 's771691229'] | [4468.0, 4340.0] | [100.0, 101.0] | [729, 730] |
p03074 | u643840641 | 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 = r = 0\na = []\nwhile l < n:\n while r < n and s[l] == s[r]:\n r += 1\n a.append(r-l)\n l = r\nm = len(a)\nasum = [0 for _ in range(m+1)]\nans = 0\nfor i in range(m):\n asum[i+1] = asum[i] + a[i]\nif s[0] == '0':\n if k >= m//2:\n ans = n\... | ['Wrong Answer', 'Accepted'] | ['s232260546', 's522613134'] | [7888.0, 8004.0] | [144.0, 141.0] | [848, 498] |
p03074 | u645250356 | 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\nN,K = map(int,input().split())\nS = input()\n\nli_s = []\ncount = 1\ntemp = S[0]\nif temp == "0":\n li_s.append(0)\nfor i in range(1,N):\n if S[i] != temp:\n if i == N-1:\n li_s.append(count)\n li_s.append(1)\n else:\n li_s.append(count)\n te... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s325898027', 's815142588', 's132713479'] | [4980.0, 4980.0, 4480.0] | [2104.0, 2104.0, 88.0] | [764, 749, 486] |
p03074 | u648881683 | 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 bisect, collections, copy, heapq, itertools, math, string, sys\ninput = lambda: sys.stdin.readline().rstrip() \nsys.setrecursionlimit(10**7)\nINF = float('inf')\ndef I(): return int(input())\ndef F(): return float(input())\ndef SS(): return input()\ndef LI(): return [int(x) for x in input().split()]\ndef LI_()... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s551602987', 's639861736', 's244669852'] | [13968.0, 14024.0, 14028.0] | [67.0, 66.0, 71.0] | [1313, 1317, 1356] |
p03074 | u651803486 | 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 = map(int, input())\n\nnow = 1\ncnt = 0\nnums = []\n\nfor i in range(n):\n if s[i] == now: cnt+=1\n else:\n nums.append(cnt)\n now = 1 - now \n cnt = 1 \n\nif cnt != 0: nums.append(cnt)\n\n\nif (len(nums) % 2 == 0): nums.append(0)\n\nadd = 2 * k + 1\ntm... | ['Runtime Error', 'Accepted'] | ['s182344350', 's466363767'] | [3064.0, 4768.0] | [17.0, 148.0] | [748, 774] |
p03074 | u652057333 | 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... | ['# D\nn, k = map(int, input().split())\ns = str(input())\nr = 0\nl = 0\nmax_len = 0\ncount = k\nans = 0\nif all([int(i) == 1 for i in list(s)]):\n ans = len(s)\nelse:\n while r < n:\n if r == n-1:\n break\n while count > 0:\n if r == n-1:\n break\n if... | ['Wrong Answer', 'Accepted'] | ['s087162361', 's532764027'] | [4864.0, 4980.0] | [308.0, 231.0] | [1121, 1102] |
p03074 | u657611449 | 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\nN, K = map(int, input().split())\nS = input()\n\nones = []\nt = 0\nfor i in range(N):\n if i == 0:\n t += 1\n pass\n elif (S[i - 1] != S[i]):\n ones.append(t)\n t = 1\n else:\n t += 1\nones.append(t)\n\nif S[0] == '0':\n t = ones\n ones = [0]\n ones.extend(t)\n... | ['Wrong Answer', 'Accepted'] | ['s262713610', 's411311286'] | [5364.0, 4852.0] | [119.0, 94.0] | [1013, 692] |
p03074 | u661707952 | 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 python3.4\n# -*- coding: utf-8 -*-\n\n# abc124_d\n\n# input\nn, k = [int(s) for s in input().split()]\nS = input()\n\ndef getp():\n now = S[0]\n for i, c in enumerate(S):\n if now != c:\n now = c\n yield i\npulse = list(getp())\npulse = [0] + pulse + [len(S)]*k*3\ndef... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s438293644', 's455131608', 's958528626', 's960562348', 's849466522'] | [9888.0, 11372.0, 10724.0, 11628.0, 8668.0] | [85.0, 2104.0, 2104.0, 2104.0, 111.0] | [661, 739, 522, 761, 864] |
p03074 | u667084803 | 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\nN, K = map(int, input().split())\ns = input()\n \ngroup = []\nsign = s[0]\ncurr = 0\nfor i in range(N):\n curr += 1\n if s[i] != sign: \n group += [curr-1]\n curr = 1\n sign = s[i]\nelse:group += [curr]\n\nif s[0] == '0' :\n if s[N-1] == '0':\n m = (len(group)+1)//2\n if K >= m:\n ... | ['Runtime Error', 'Accepted'] | ['s740150399', 's212276775'] | [5620.0, 5432.0] | [110.0, 114.0] | [969, 479] |
p03074 | u667458133 | 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\narray = [0]\nresult = 0\nif S[0] == '1':\n flag = False\n\nelse:\n flag = True\n\nflag2 = False\n\nfor i in range(N):\n if S[i] == '0':\n if not flag:\n flag = True\n array.append(i)\n if len(array) == K * 2 + 2:\n ... | ['Wrong Answer', 'Accepted'] | ['s749606624', 's024232388'] | [7108.0, 5344.0] | [769.0, 769.0] | [600, 620] |
p03074 | u669173971 | 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\njudge=[0]\nmax_=0\nfor i in range(n-1):\n if s[i]!=s[i+1]:\n judge.append(i+1)\njudge.append(n)\n\nif len(judge)//2<=k:\n print(len(s))\nelse:\n for i in range(len(judge)-2*k):\n if s[judge[i]]=='0':\n ans=judge[i+2*k]-judge[i]\n else:\n ans=judge... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s174252487', 's832080735', 's839163486', 's886659194'] | [7972.0, 11088.0, 11088.0, 7844.0] | [92.0, 74.0, 73.0, 123.0] | [365, 254, 244, 399] |
p03074 | u669240121 | 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().replace('\\n', '')\n\n\ndef solve(S, K):\n record = []\n temp = []\n for i in range(len(S) - 1):\n if S[i:i+2] == '01':\n temp.append(i + 1)\n elif S[i:i+2] == '10':\n if not temp: temp = [0, i]\n else: temp.append(i... | ['Runtime Error', 'Accepted'] | ['s289019379', 's765301353'] | [14952.0, 12532.0] | [98.0, 79.0] | [826, 785] |
p03074 | u672475305 | 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()\nnumbers = [len(c) for c in s.replace('0',' ').split()]\nzero = [len(c) for c in s.replace('1',' ').split()]\nans = 0\nif len(numbers) == 1:\n ans = numbers[0]\nelse:\n if len(zero) <= k:\n ans = sum(numbers) + sum(zero)\n else:\n for i in range(len(z... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s616880981', 's665027427', 's477457639'] | [4472.0, 4472.0, 4092.0] | [2104.0, 2104.0, 149.0] | [422, 338, 548] |
p03074 | u674343825 | 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 = []\ncount = 0\nlast = 1\nfor i in input():\n if i=='1':\n if last==1:\n count+=1\n else:\n s.append(count)\n count=1\n last = 1\n else:\n if last==0:\n count+=1\n else:\n s.append(count)... | ['Runtime Error', 'Accepted'] | ['s700723674', 's028403044'] | [10024.0, 10152.0] | [76.0, 75.0] | [616, 634] |
p03074 | u678167152 | 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()\ncnt = 1\ncounts = []\n\nif S[0]=='0':\n counts.append(0)\nif N == 1:\n counts.append(1)\n \nfor i in range(1,N):\n if S[i-1]!=S[i]:\n counts.append(cnt)\n cnt = 1\n else:\n cnt += 1\n print(i)\n if i == N-1:\n counts.append(cnt)\n\nprint(counts)\nm = 0... | ['Wrong Answer', 'Accepted'] | ['s672126498', 's710466939'] | [5840.0, 4596.0] | [2104.0, 121.0] | [408, 518] |
p03074 | u687053495 | 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\n\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 cnt = 1\n now = 1 - now\n\nif cnt != 0:\n Nums.append(cnt)\n\n\n\nif len(Nums) % 2 == 0:\n Nums.append(0)\n\nAdd = 2 * K + 1\n\... | ['Wrong Answer', 'Accepted'] | ['s546425985', 's884306194'] | [10488.0, 8180.0] | [204.0, 87.0] | [1071, 483] |
p03074 | u687343821 | 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\nstdin = sys.stdin \nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline()\n\ndef Solve():\n N,K=na();S=ns()\n l=[]\n N=len(S)\n if(S[0]=="0"):\n l.append(0)\n b=S[0]\n ct=1\n for i in S[1:]:\n if(b!=i):\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s223526025', 's441477709', 's631172779', 's723926307', 's821379812', 's926254229', 's168736691'] | [5336.0, 3316.0, 4332.0, 4328.0, 3316.0, 4328.0, 4596.0] | [51.0, 85.0, 68.0, 69.0, 86.0, 74.0, 44.0] | [783, 600, 2243, 2247, 602, 2247, 926] |
p03074 | u690781906 | 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\nans = 0\nfor i in range(n):\n if i != 0 and s[i-1] == '1':\n continue\n if i != 0 and s[i] == '0' and s[i-1] == '0':\n continue\n inv_count = 0\n continuous_count = 0\n for j in range(i, n):\n if i == 0 and s[0] == '0':\n ... | ['Wrong Answer', 'Accepted'] | ['s936561278', 's379394655'] | [3316.0, 4596.0] | [2104.0, 100.0] | [513, 391] |
p03074 | u692453235 | 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()+"2"\nL = []\ncnt = 0\ntemp = int(S[0])\n\nfor x in S:\n if temp == int(x):\n cnt += 1\n else:\n L.append(cnt)\n cnt = 1\n temp = int(x)\n\nif S[0] == "0":\n Lcs = [0, 0]\nelse:\n Lcs = [0]\n\nfor x in L:\n Lcs.append(Lcs[-1] + x)\n \nans = Lcs[1]\nN = len... | ['Wrong Answer', 'Accepted'] | ['s525655174', 's952655481'] | [14008.0, 13696.0] | [130.0, 116.0] | [497, 540] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.