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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03355 | u335295553 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = input()\nK = int(input())\nls = []\nfor i in range(1,len(s)+1):\n for j in range(i,len(s)+1):\n tmp = s[i:j]\n if tmp != "":\n ls.append(s[i:j])\nprint(sorted(list(set(ls)))[K-1])', 's = input()\nK = int(input())\nprint(sorted(set([s[j:j+i] for j in range(len(s)) for i in range(1,K+1)]... | ['Runtime Error', 'Accepted'] | ['s544533987', 's938235783'] | [3060.0, 4980.0] | [2350.0, 32.0] | [203, 110] |
p03355 | u340515675 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = input("string:")\nK = int(input("K:"))\n# substrings = {}\nsubstrings = []\nfor i in range(1,len(s)+1):\n for j in range(0,len(s)):\n if s[j:j+i] not in substrings:\n \n substrings.append(s[j:j+i])\nprint(sorted(substrings)[K-1])', 's = input()\nK = int(input())\n# substrings = {}\... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s670878004', 's706238134', 's802514872', 's008144001'] | [4196.0, 2940.0, 4196.0, 4072.0] | [2104.0, 17.0, 2104.0, 1535.0] | [285, 264, 285, 266] |
p03355 | u355853184 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s= input()\nK = int(input())\n\nans_list = []\nfor i in range(len(s)-K+1):\n for j in range(i+1,i+K+1):\n ans_list.append(s[i:j])\n\nans_set = set(ans_list)\nans_list_min = sorted(list(ans_set))\nprint(ans_list_min[K-1])', 's= input()\nK = int(input())\n\nans_list = []\nfor i in range(len(s)):\n for j in... | ['Runtime Error', 'Accepted'] | ['s195664852', 's368889381'] | [11148.0, 11160.0] | [43.0, 48.0] | [220, 266] |
p03355 | u367130284 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s=input()\nn=int(input())\nl=[]\nfor t in range(1,len(s)+3):\n for r in range(len(s)-t+1):\n l.append(s[r:r+t])\nprint(sorted(sorted(set(l)),key=lambda x:len(x))[n-1])', 's=input();print(sorted(set(s[t:t+i]for t in range(9)for i in range(1,9)))[int(input())-1])', 's=input();print(sorted(set(s[t:t+i]for t in... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s031553571', 's223164048', 's675691969'] | [1993136.0, 3060.0, 7144.0] | [2288.0, 19.0, 48.0] | [171, 90, 95] |
p03355 | u395672550 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = str(input())\nK = int(input())\nL = []\nM = []\ncon = 0\nfor i in s:\n L.append(i)\nL = list(set(L))\nL.sort()\nfor j in range(len(s)):\n if s[j] == L[0]:\n for k in range(1,6):\n if j + k >=len(s):\n M.append(s[j:])\n break\n else:\n M.append(s[j:j+k])\n\nfor l i... | ['Runtime Error', 'Accepted'] | ['s923432022', 's139733537'] | [10356.0, 10084.0] | [40.0, 42.0] | [730, 751] |
p03355 | u405483159 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = input()\nN = len( s )\nK = int( input() )\n\ns_set = set()\nfor i in range( N - K + 1 ):\n for j in range( 1, K + 1 ):\n t = s[ i : i + j ]\n s_set.add(t)\n\nprint( sorted( list( s_set ) )[ K - 1 ] )', 's = input()\nN = len( s )\nK = int( input() )\n\ns_set = set()\nfor j in range( 1, K + 1 ):\n for i in ... | ['Runtime Error', 'Accepted'] | ['s084339686', 's164500065'] | [4592.0, 4592.0] | [36.0, 34.0] | [200, 200] |
p03355 | u413165887 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = str(input())\nk = int(input())\nresult = []\nfor i in range(1, k+1):\n for j in range(len(s)-i):\n result.append(s[j:j+i])\nr = set(result)\nout = list(r)\nout.sort()\nprint(out[k-1])', "def main():\n s = str(input())\n s += '0'\n k = int(input())\n result = set()\n for i in range(1, 6):\... | ['Runtime Error', 'Accepted'] | ['s014080452', 's882755672'] | [5068.0, 4464.0] | [35.0, 32.0] | [188, 273] |
p03355 | u419963262 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ["s = input()\nK = int(input())\nans_lis = []\ns_length = len(s)\nlis = [[] for i in range(26)]\n\nfor i in range(s_length):\n lis[ord(s[i]) - ord('a')].append(i)\n\n\nfor i in range(26):\n k = 1\n while k <= s_length:\n for j in lis[i]:\n ans_lis.append(s[j:j + k + 1])\n k += 1\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s316454005', 's822048998', 's162912557'] | [22092.0, 9500.0, 9444.0] | [2206.0, 106.0, 37.0] | [413, 425, 402] |
p03355 | u442030035 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ["s = input()\nK = int(input())\n\nct = 0\nalp = 'abcdefghijklmnopqrstuvwxyz'\nfor i in alp:\n ct += s.count(i)\n if ct >= K:\n key = i\n break\n\nlist_rank = []\nfor i in range(len(s)):\n if s[i] > key:\n continue\n if i < len(s) - K + 1:\n for j in range(K):\n if s[i... | ['Runtime Error', 'Accepted'] | ['s656044730', 's921808407'] | [3064.0, 3064.0] | [29.0, 28.0] | [545, 538] |
p03355 | u445624660 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['\ns = input()\nk = int(input())\nans = []\nfor i in range(len(s)):\n for j in range(i + 1, min(len(s), i + 5 + 1)):\n t = "".join(s[i:j])\n if t not in ans:\n ans.append("".join(s[i:j]))\n ans = sorted(ans)[:5]\nprint(ans[k - 1])\n', ',\ns = input() + " "\nk = int(input())\nans ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s114865752', 's351379541', 's399815975'] | [9188.0, 8892.0, 11192.0] | [58.0, 23.0, 48.0] | [338, 331, 178] |
p03355 | u452786862 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['# n = int(input())\n# a, b = map(int, input().split())\n# c = list(map(int, input().split()))\n# d = [list(map(int, input().split())) for _ in range(n)]\n\nalphabet = "abcdefghijklnmopqrstuvwxyz"\ns = input()\nk = int(input())\ns_set = set(s)\nans = set()\n\nif k == 1:\n s_set_list = list(s_set)\n s_set_list.so... | ['Wrong Answer', 'Accepted'] | ['s993052598', 's200757194'] | [3188.0, 3188.0] | [32.0, 45.0] | [800, 776] |
p03355 | u455696302 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ["s = list(input())\nk = int(input())\nsub = []\nsub += s[:]\n \nfor j in range(2,K+1):\n charGram = [''.join(s[i:i+j]) for i in range(len(s)-1)]\n sub += charGram\nsub = list(set(sub))\nprint(sorted(sub)[k-1])", "s = list(input())\nk = int(input())\nsub = []\nsub += s[:]\n \nfor j in range(2,k+1):\n charGram ... | ['Runtime Error', 'Accepted'] | ['s276181751', 's486053050'] | [3188.0, 5196.0] | [18.0, 35.0] | [205, 205] |
p03355 | u533039576 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = str(input())\nn = int(input())\n\ncand = [s[0]]\nfor i in range(len(s)):\n if s[i] > cand[len(cand)-1]:\n continue\n for j in range(i, len(s)):\n tmp = s[i:j+1]\n #print(i,j, tmp, cand)\n if tmp in cand:\n continue\n cand += [tmp]\n if len(cand) > n:\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s229066722', 's415955041', 's484454504', 's708110851'] | [3060.0, 3444.0, 3060.0, 5084.0] | [2104.0, 2104.0, 2104.0, 33.0] | [376, 436, 389, 191] |
p03355 | u543954314 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = input()\nk = int(input())\nsub = set()\nfor i in range(n):\n for j in range(1,k):\n sub.add(s[i:i+j])\nprint(sorted(list(sub))[k-1])', 'n,m = map(int, input().split())\np = list(map(int,input().split()))\nd = [list() for _ in range(n+1)]\ncnt = 0\nfor _ in range(m):\n x,y = map(int, input().split())\n d[x].... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s540721667', 's726444305', 's407504681'] | [3060.0, 3064.0, 4592.0] | [17.0, 18.0, 35.0] | [134, 512, 141] |
p03355 | u623687794 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s=input()\nn=int(input())\nlst=[]\nfor i in range(len(s)):\n for j in range(i+1,min(i+n+1,len(s)+1)):\n lst.append(s[i:j])\nsub=set(lst)\nsub.sort()\nprint(sub[n-1])', 's=input()\nn=int(input())\nlst=[]\nfor i in range(len(s)):\n for j in range(i+1,min(i+n+1,len(s)+1)):\n lst.append(s[i:j])\nsub=set(lst)\nsub... | ['Runtime Error', 'Accepted'] | ['s944920932', 's270506824'] | [4980.0, 5084.0] | [30.0, 37.0] | [161, 167] |
p03355 | u648881683 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ["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', 'Accepted'] | ['s308365969', 's195152459'] | [10140.0, 10140.0] | [36.0, 45.0] | [1092, 949] |
p03355 | u651952230 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['S = str(input())\nK = int(input())\n\nsub = set()\nfor i in range(1,min(K, len(S))+1):\n for j in range(len(S)-K+1):\n sub.add(S[j:j+i])\nm=list(sub)\nm.sort()\nprint(m[K-1])', 'S = str(input())\nK = int(input())\n \nsub = set()\nfor i in range(1,min(K, len(S))+1):\n for j in range(len(S)-i+1):\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s391366381', 's698202971', 's754142065'] | [4464.0, 5096.0, 4464.0] | [33.0, 55.0, 33.0] | [175, 209, 176] |
p03355 | u663710122 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ["import heapq\n\nS = input()\nK = int(input())\n\nq = []\n\nfor i in range(len(S)):\n for j in range(i, len(S) + 1):\n heapq.heappush(q, S[i:j])\n\nlast = ''\nprint(q)\nwhile K > 0:\n s = heapq.heappop(q)\n if s != last:\n K -= 1\n last = s\n\nprint(last)\n", "import heapq\n\nS = input()\... | ['Wrong Answer', 'Accepted'] | ['s656672326', 's485316650'] | [3188.0, 4552.0] | [2342.0, 46.0] | [266, 269] |
p03355 | u667024514 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = str(input())\nk = str(input())\nlis = []\nans = "zzz"\nli = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]\nfor k in range(6):\n\tfor i in range(len(s)):\n\t\ttry:\n\t\t\tif s[i:i+k] == "":\n\t\t\t\tcontinue\n\t\t\tif s[i:i+k] not in lis:\n\t\t\t\tlis.app... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s360258200', 's972518843', 's568652283'] | [3932.0, 3932.0, 3932.0] | [1530.0, 1531.0, 1794.0] | [393, 229, 230] |
p03355 | u669696235 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s=input()\nK=int(input())\nl=len(s)\nd=[[s[i],l-i] for i in range(len(s))]\nd=sorted(d)\nh=dict()\nans=0\nca=d[0][0] \n\nfor i in d:\n if(i[0]!=i[0][0]):\n break\n z=min(i[1]+1,6)\n for j in range(1,z):\n if(s[l-i[1]:l-i[1]+j] not in h):\n ans+=1\n h.update({s[l-i[1]:l-i... | ['Wrong Answer', 'Accepted'] | ['s378409167', 's043186982'] | [5648.0, 5656.0] | [59.0, 54.0] | [357, 371] |
p03355 | u673338219 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = str(input())\nk = int(input())\nsub = []\nc = 5\nif len(s) < 5:\n c = len(s)\nfor i in range(c):\n for j in range(len(s)-i-1):\n sub.append(s[j:j+i+1])\n\nsub = list(set(sub))\nsub.sort()\nprint(sub[k-1])\n', 's = str(input())\nk = int(input())\nsub = []\nc = 5\nif len(s) < 5:\n c = len(s)\nfor i in range... | ['Runtime Error', 'Accepted'] | ['s716657199', 's794378631'] | [5084.0, 5068.0] | [34.0, 33.0] | [203, 201] |
p03355 | u723180465 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ["s = input().strip()\nk = int(input())\n\nss = set()\nfor i in range(len(s)):\n for j in range(i, len(s)):\n ss.add(s[i:j+1])\n\nprint('test')", 'def all_index(s, c):\n ins = []\n for i in range(len(s)):\n if s[i] == c:\n ins.append(i)\n\n return ins\n\n\ns = input().strip()\nk = i... | ['Wrong Answer', 'Accepted'] | ['s404716797', 's172795772'] | [1882972.0, 3188.0] | [2217.0, 34.0] | [143, 456] |
p03355 | u733608212 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = input()\nK = int(input())\nl = [chr(i) for i in range(97, 97+26)]\nselected = []\nfor i in l:\n if i in s:\n index = []\n for ind, j in enumerate(s):\n if i == j:\n index.append(ind)\n print(index)\n for j in index:\n for k in range(len(s)):\n if j+k == len(s):\n brea... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s826536394', 's892157466', 's698741120'] | [935652.0, 4576.0, 4568.0] | [2329.0, 41.0, 33.0] | [459, 496, 437] |
p03355 | u760171369 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ["import sys\n\ns = input()\nK = int(input())\n\nchars = sorted(set(s))\nn = len(s)\n\nfor j in range(min(3, len(chars))):\n ans = chars[j]\n K -= 1\n if K == 0:\n print(ans)\n break\n while True:\n places = []\n index = -1\n while True:\n index = s.find(ans, index+1)\n if index == -1:\n ... | ['Wrong Answer', 'Accepted'] | ['s100921363', 's131487110'] | [3316.0, 3188.0] | [37.0, 37.0] | [634, 614] |
p03355 | u767664985 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['from collections import Counter\n\ns = input()\nK = int(input())\nc = Counter(s)\n\nkey = sorted(c.keys())\nans = []\nqueue = []\n\nwhile (len(ans) < K):\n if queue:\n queue = sorted(list(set(queue)))\n res = queue.pop(0)\n ans.append(res)\n ans = list(set(ans))\n else:\n c = ... | ['Runtime Error', 'Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s152887808', 's265228777', 's391424157', 's505537457', 's848408024', 's865754432', 's205732878'] | [4844.0, 4844.0, 4716.0, 935524.0, 10288.0, 935524.0, 4844.0] | [34.0, 34.0, 2104.0, 2367.0, 2104.0, 3147.0, 34.0] | [522, 570, 463, 514, 485, 488, 578] |
p03355 | u777923818 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['# -*- coding: utf-8 -*-\ndef inpl(): return map(int, input().split())\nN = int(input())\nballs = [input().replace(" ", "") for _ in range(2*N)] + ["END"]\n\nB = ["END"] + ["B{}".format(i) for i in range(1, N+1)[::-1]]\nW = ["END"] + ["W{}".format(i) for i in range(1, N+1)[::-1]]\n\nans = 0\nfor i in range(2*N):\n ... | ['Runtime Error', 'Accepted'] | ['s116651294', 's288498388'] | [3188.0, 3064.0] | [19.0, 29.0] | [629, 313] |
p03355 | u784022244 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['from numba import njit\ns=input()\nK=int(input())\n\nN=len(s)\nL=[]\n@njit\ndef solve():\n for i in range(N):\n for j in range(i,N):\n L.append(s[i:j+1])\nL=sorted(list(set(L)))\nprint(L[K-1])', '\nN=len(s)\nL=[]\nflag=False\nfor a in abc:\n for i in range(N):\n if s[i]==a:\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s481178928', 's752965507', 's157158164'] | [3064.0, 3064.0, 24688.0] | [18.0, 17.0, 195.0] | [201, 367, 431] |
p03355 | u785205215 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['import math\nimport itertools\nfrom heapq import heapify, heappop, heappush\nfrom sys import stdin, stdout, setrecursionlimit\nfrom bisect import bisect, bisect_left, bisect_right\nfrom collections import defaultdict, deque\n\n\n\n\n# inf = float("inf")\n\n\n\ndef LM(t, r): return list(map(t, r))\ndef R(): return std... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s449292817', 's832327083', 's004615870'] | [1219672.0, 11068.0, 4848.0] | [2175.0, 2104.0, 153.0] | [1158, 1350, 1323] |
p03355 | u803848678 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['def cut_kouho(s, char):\n ret = []\n for i in range(s.count(char)):\n ind = s.find(char)\n ret.append(s[ind:])\n if ind == len(s) -1 :\n break\n s = s[ind+1:]\n print(ret)\n return ret\n\ns = input()\nk = int(input())\n\nif len(s) < 51 and False:\n tmp = []\n f... | ['Wrong Answer', 'Accepted'] | ['s644565120', 's380418628'] | [52472.0, 16624.0] | [117.0, 36.0] | [1069, 1034] |
p03355 | u808585569 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s=input()\nK=int(input())\nD=[]\nfor i in range(len(s)):\n for j in range(len(s)-i-1):\n D.append(s[i:i+j+1])\nD = sorted(list(set(D)))\nprint(D[K-1])', 's=input()\nK=int(input())\nD=[]\nfor i in range(len(s)+1):\n for j in range(min(len(s)-i,5)):\n D.append(s[i:i+j+1])\nD = sorted(list(set(D)))\n#print(D)\np... | ['Runtime Error', 'Accepted'] | ['s904645142', 's748431608'] | [3060.0, 5068.0] | [2598.0, 37.0] | [147, 164] |
p03355 | u814781830 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = input()\nK = int(input())\n\nsub = []\nfor i in range(1, len(s)+1):\n for k in range(len(s)-i+1):\n sub.append(s[k:k+i])\n\nsub = list(set(sub))\nsub.sort()\nprint(sub[k-1])\n', 's = input()\nK = int(input())\n\nsub = []\nfor i in range(1, len(s)+1):\n for k in range(len(s)-i+1):\n sub.append(... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s174100308', 's331981094', 's567559956'] | [3060.0, 2051888.0, 5068.0] | [2272.0, 2284.0, 34.0] | [178, 178, 173] |
p03355 | u814986259 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['import collections\ns = input()\nK = int(input())\n\nabc = collections.defaultdict(list)\n\nfor i in range(len(s)):\n for j in range(1,K+1):\n if i+j < len(s):\n abc[s[i:i+j]].append(i)\n\n\nabc = list(abc.items())\nabc.sort(key=lambda x: x[0])\n\n\nprint(abc[K][0])\n', 'import collections\ns = input()\nK ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s427131362', 's926907607', 's756905660'] | [7852.0, 4852.0, 7844.0] | [58.0, 29.0, 58.0] | [262, 277, 264] |
p03355 | u859897687 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s=input()\nk=int(input())\nl=[]\nfor i in range(len(s)-1):\n for j in range(i+1,min(len(s),i+5)):\n if s[i:j] not in l:\n l.append(s[i:j])\nl.sort()\nprint(l[k-1])', 's=input()\nk=int(input())\nl=[]\nfor i in range(len(s)):\n for j in range(i+1,min(len(s),i+k)+1):\n if s[i:j] not in l:\n l.append(s[... | ['Runtime Error', 'Accepted'] | ['s574463378', 's529426673'] | [3692.0, 3944.0] | [908.0, 1761.0] | [164, 165] |
p03355 | u941407962 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['def sub_k(string, I, K):\n temp = []\n for i in range(len(string)):\n if i-1+I == len(string):\n continue\n temp.append(string[i:i+I])\n return sorted(set(temp))[0:K]\n\ndef main(string, K):\n for i in range(K):\n print(sub_k(string, i+1, K-i))\n\nstring = input()\nK = int(... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s117614590', 's603625665', 's717019912'] | [3536.0, 3064.0, 3528.0] | [31.0, 17.0, 31.0] | [329, 324, 381] |
p03355 | u941884460 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['s = input().rstrip()\nk = int(input())\nresult = []\nfor i in range(len(s)):\n for j in range(i+1,i+k):\n if i+k <= len(s):\n result.append(s[i:j])\nresult.sort()\nprint(result[k-1])', 's = input().rstrip()\nk = int(input())\nresult = []\nfor i in range(len(s)):\n for j in range(i+1,i+k+1):\n if j <= len... | ['Runtime Error', 'Accepted'] | ['s756682116', 's564659704'] | [4084.0, 3944.0] | [35.0, 1794.0] | [183, 208] |
p03355 | u944209426 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ["s = input()\nk = int(input())\n\nx = ['a', 'b', 'ab', 'ba', 'aba']\na=[]\nm = min(s)\nfor i in range(len(s)):\n a.append(s[i])\n if s[i]==m:\n a.append(s[i:min(len(s)-1,i+2)])\n a.append(s[i:min(len(s)-1,i+3)])\n a.append(s[i:min(len(s)-1,i+4)])\n a.append(s[i:min(len(s)-1,i+5)])\na=... | ['Runtime Error', 'Accepted'] | ['s297270337', 's709074893'] | [4324.0, 5052.0] | [31.0, 39.0] | [365, 325] |
p03355 | u987164499 | 2,000 | 1,048,576 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | ['from sys import stdin\nfrom sys import setrecursionlimit\nsetrecursionlimit(10 ** 7)\n\ns = stdin.readline().rstrip()\nk = int(stdin.readline().rstrip())\n\n\nfinish = set()\nS = len(s)\n\nfor i in range(S):\n for j in range(1,6):\n finish.add(s[i:i+j])\n\nfinish = list(finish)\n\nprint(finish[k-1])', 's = ... | ['Wrong Answer', 'Accepted'] | ['s482495388', 's030575705'] | [4464.0, 4464.0] | [29.0, 39.0] | [293, 267] |
p03356 | u023229441 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ["from subprocess import*\ncall(('pypy3','-c',))\n", 'n,m=map(int,input().split())\nP=[i-1 for i in list(map(int,input().split()))]\n\nclass UnionFind():\n def __init__(self,num):\n self.n = num \n self.parents = [-1 for i in range(self.n)]\n \n\n \n def find(self,x):\n if... | ['Time Limit Exceeded', 'Accepted'] | ['s240548938', 's462510086'] | [154516.0, 20416.0] | [2206.0, 435.0] | [3126, 2689] |
p03356 | u094191970 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['from sys import stdin\nnii=lambda:map(int,stdin.readline().split())\n\nclass UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parent... | ['Wrong Answer', 'Accepted'] | ['s409317655', 's902887388'] | [13876.0, 14516.0] | [485.0, 493.0] | [765, 779] |
p03356 | u106778233 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ["\nn,m=map(int,input().split())\nroot=[i for i in range(n+1)]\nrank=[0]*(n+1)\ndef find(x):\n if x==root(x):\n return x \n else:\n return find(root[x])\n\ndef union(x,y):\n x=find(x)\n y=find(y)\n if rank[x]>rank[y]:\n root[y]=x \n else rank[x]<rank[y]:\n root[x]=y\n ... | ['Runtime Error', 'Accepted'] | ['s773779095', 's121454950'] | [2940.0, 20704.0] | [17.0, 725.0] | [822, 535] |
p03356 | u218843509 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['class UnionFind():\n\tdef __init__(self, size):\n\t\tself.table = [-1 for _ in range(size)]\n\n\tdef find(self, x):\n\t\twhile self.table[x] >= 0:\n\t\t\tx = self.table[x]\n\t\treturn x\n\n\tdef union(self, x, y):\n\t\ts1 = self.find(x)\n\t\ts2 = self.find(y)\n\t\tif s1 == s2:\n\t\t\treturn\n\t\telif:\n\t\t\tif self.... | ['Runtime Error', 'Accepted'] | ['s305666754', 's985879822'] | [2940.0, 13812.0] | [17.0, 720.0] | [742, 830] |
p03356 | u348868667 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ["class UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y)... | ['Wrong Answer', 'Accepted'] | ['s084260141', 's345620739'] | [14308.0, 13812.0] | [2104.0, 725.0] | [1459, 1010] |
p03356 | u367130284 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['class UNION_FIND(object):\n def __init__(self,n):\n \n \n \n self.parent=[-1 for i in range(n)]\n \n def root(self,x):\n \n if self.parent[x]<0:\n return x\n else:\n self.parent[x]=self.root(self.parent[x]) \n return self.... | ['Runtime Error', 'Accepted'] | ['s000610698', 's383450962'] | [14320.0, 13812.0] | [45.0, 722.0] | [1697, 1674] |
p03356 | u371787528 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['n, m = map(int, input().split())\np = list(map(int, input().split()))\n\npar = {x:x for x in range(1, n+1)}\n\ndef root(node):\n if par[node] == node:\n return node\n par[node] = root(par[node])\n return par[node]\n\nfor _ in range(m):\n x, y = map(int, input().split())\n par[root[x]] = root[y]... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s024910191', 's546412298', 's518407809'] | [20704.0, 20704.0, 20704.0] | [52.0, 52.0, 668.0] | [406, 403, 403] |
p03356 | u379692329 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['class UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n)]\n self.rank = [0]*n\n \n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n \n def union(self... | ['Runtime Error', 'Accepted'] | ['s146670571', 's671859468'] | [30216.0, 30176.0] | [349.0, 681.0] | [943, 943] |
p03356 | u497046426 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ["class UnionFind:\n def __init__(self, N):\n # negative value: represents the root of a tree; its absolute value is the size of the tree\n # positive value: the parent's index\n self.vertices = [-1 for _ in range(N)]\n self.rank = [0] * N\n \n def find(self, v):\n if sel... | ['Runtime Error', 'Accepted'] | ['s518853951', 's462235833'] | [14452.0, 13812.0] | [511.0, 677.0] | [1676, 1680] |
p03356 | u572142121 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['N,M=map(int, input().split()) \nP=list(map(int,input().split()))\npar=[i for i in range(N+1)]\nrank=[0]*(N+1)\n\n\ndef find(x):\n if par[x]==x:\n return x\n else:\n par[x]==find(par[x])\n return par[x]\n\n\ndef same(x,y):\n return find(x)==find(y)\n\ndef union(x,y):\n x=find(x)\n y=find(y)\n if x==y:\n... | ['Runtime Error', 'Accepted'] | ['s966338545', 's900119937'] | [15844.0, 13812.0] | [829.0, 548.0] | [629, 669] |
p03356 | u704284486 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['from sys import stdin\nfrom collections import defaultdict\nimport heapq\nclass UnionFind:\n def __init__(self,n):\n self.parent = [i for i in range(n)]\n self.rank = [0]*n\n self.n = n\n def find(self,x):\n if self.parent[x] == x:\n return x\n else:\n se... | ['Wrong Answer', 'Accepted'] | ['s688275176', 's094356976'] | [33724.0, 18544.0] | [2104.0, 522.0] | [1631, 1118] |
p03356 | u747703115 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['import sys\nreadline = sys.stdin.readline\n\nclass UnionFind(object):\n def __init__(self, n):\n self._par = list(range(n))\n self.size = [1]*n\n\n def root(self, v):\n if self._par[v] == v:\n return v\n self._par[v] = self.root(self._par[v])\n return self._par[v]\n... | ['Runtime Error', 'Accepted'] | ['s243028433', 's683588428'] | [20332.0, 89772.0] | [58.0, 483.0] | [911, 675] |
p03356 | u762540523 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ["class UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y)... | ['Runtime Error', 'Accepted'] | ['s138240476', 's259482710'] | [11316.0, 14708.0] | [27.0, 737.0] | [1389, 1390] |
p03356 | u763115743 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['group_id = 0\ngroups = []\n\ndef solve(graphs, ps):\n global group_id, groups\n groups = [-1] * (len(ps) + 1)\n\n for key in range(1, len(ps) + 1):\n if key < len(graphs) and groups[key] == -1:\n group_id += 1\n dfs(graphs, key)\n\n ans = 0\n for key, value in enumerate(ps,... | ['Runtime Error', 'Accepted'] | ['s759392275', 's602353292'] | [26832.0, 13876.0] | [423.0, 660.0] | [1048, 1049] |
p03356 | u801476312 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['\n\nclass Board:\n\n \n \n \n h = {}\n m = {}\n\n island = 0 \n\n \n def add(self, h, new_item):\n self.h[new_item] = h\n\n \n def merge(self, h1, h2):\n self.m[h2] = self.m[h1]\n\n \n def new_pair(self, x, y):\n new_h = len(self.m) + 1\n self.island +=... | ['Wrong Answer', 'Accepted'] | ['s577018766', 's274890579'] | [26448.0, 42544.0] | [585.0, 858.0] | [1955, 1908] |
p03356 | u860002137 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['class UnionFind:\n def __init__(self, n):\n self.root = list(range(n + 1))\n self.size = [1] * (n + 1)\n\n def find(self, x):\n root = self.root\n while root[x] != x:\n root[x] = root[root[x]]\n x = root[x]\n return x\n\n def union(self, x, y):\n ... | ['Runtime Error', 'Accepted'] | ['s259659691', 's423893744'] | [3316.0, 13812.0] | [21.0, 561.0] | [894, 884] |
p03356 | u882868478 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['sys.setrecursionlimit(100000)\n\ndef dfs(i, g, visited):\n visited.add(i)\n for j in g[i]:\n if not (j in visited):\n dfs(j, g, visited)\n\ndef main():\n n, m = map(int, input().split())\n p = (list(map(int, input().split())))\n g = [[] for i in range(n + 1)]\n for i in range(m):\n x, y = map(int, in... | ['Runtime Error', 'Accepted'] | ['s762699259', 's314937569'] | [3064.0, 85732.0] | [17.0, 608.0] | [645, 656] |
p03356 | u921009792 | 2,000 | 1,048,576 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ['N,M = map(int, input().split())\nP = list(map(int, input().split()))\n\nuf = uf(N)\n\nfor _ in range(1,M+1):\n x,y = map(int, input().split())\n uf.unite(x,y)\n\ncount = 0\nfor n in range(N):\n if uf.is_same_group(P[n-1],n+1):\n count += 1\n\nprint(count)\n', 'class uf():\n def __init__(self,n):\n ... | ['Runtime Error', 'Accepted'] | ['s832610511', 's226507011'] | [13880.0, 14452.0] | [41.0, 693.0] | [258, 844] |
p03358 | u340781749 | 2,000 | 1,048,576 | There is a tree with N vertices numbered 1 through N. The i-th edge connects Vertex x_i and y_i. Each vertex is painted white or black. The initial color of Vertex i is represented by a letter c_i. c_i = `W` represents the vertex is white; c_i = `B` represents the vertex is black. A cat will walk along this tree. More... | ["def first_cut(links, colors):\n tmp_links = links.copy()\n for v, neighbors in tmp_links.items():\n while len(neighbors) == 1 and colors[v]:\n del links[v]\n par = neighbors.pop()\n links[par].remove(v)\n v = par\n neighbors = links[par]\n return ... | ['Wrong Answer', 'Accepted'] | ['s166498009', 's121733965'] | [60836.0, 65632.0] | [2106.0, 736.0] | [1519, 1480] |
p03363 | u001024152 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ["from collections import defaultdict\nN = int(input())\na = list(map(int, input().split()))\n\nruiseki = [0]\nfor ai in a:\n ruiseki.append(ruiseki[-1] + ai)\n\nd = defaultdict(lambda:0)\nfor ri in ruiseki:\n d[ri] += 1\n\ndef comb_fermat(n:int, r:int)->int:\n # Fermat's little theorem: O(r)\n # return nCr... | ['Runtime Error', 'Accepted'] | ['s628192401', 's722215268'] | [41728.0, 41728.0] | [261.0, 1516.0] | [569, 442] |
p03363 | u004025573 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['import math\n\nN = int(input())\n\na = list(map(int, input().split()))\nb = [a[0] for i in range(N)]\n\nfor i in range(1, N):\n b[i] = b[i-1] + a[i]\n \nb.sort()\nc = 1\nans = 0\n\ndef P(n, r):\n return math.factorial(n)//math.factorial(n-r) \n\ndef C(n, r):\n return P(n, r)//math.factorial(r)\n\nif N==... | ['Wrong Answer', 'Accepted'] | ['s139705729', 's174520894'] | [27268.0, 27268.0] | [2108.0, 1579.0] | [709, 705] |
p03363 | u007808656 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['from itertools import combinations, product\nn=int(input())\ns=[["a" for _ in range(n)] for _ in range(n)]\nfor i in range(n):\n s[i]=list(input())\n\nres=0\nfor a in product(range(n)):\n for i,j in combinations(range(n),2):\n if(s[(i+a)%n][(j)%n]!=s[(j+a)%n][(i)%n]):\n break\n else:\n res+=1\n\nprint(r... | ['Runtime Error', 'Accepted'] | ['s256040079', 's806057501'] | [506160.0, 39296.0] | [2142.0, 213.0] | [310, 235] |
p03363 | u013617325 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['def main(N,A):\n B=[0]\n count = 0\n for i in range(N):\n T = A[i] + B[i]\n print(B)\n if T in B:\n\n print(\'count:\',count)\n count += B.count(T)\n\n\n \n #\n # count = [ count + 1 for m in range(len(B)) if B[i] - B[i-m] == 0]\n\n # for m in range(... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s173564642', 's289440721', 's421717642', 's899318218', 's299713485'] | [148348.0, 9000.0, 31552.0, 31616.0, 31680.0] | [2401.0, 22.0, 2206.0, 74.0, 175.0] | [727, 587, 605, 485, 505] |
p03363 | u024383312 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['from collections import Counter\nimport numpy as np\n\nN = int(input())\nA = list(map(int, input().split()))\n\ncumulative_sum = [0] + np.cumsum(A)\ncounts = Counter(cumulative_sum)\nans = 0\nfor v in counts.values():\n ans += v * (v-1) // 2\n \nprint(ans)', 'from collections import Counter\nimport numpy as np\... | ['Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s000863649', 's180922157', 's702348716', 's713190832', 's879617950'] | [45916.0, 45920.0, 35720.0, 35712.0, 45916.0] | [334.0, 322.0, 2109.0, 2109.0, 323.0] | [250, 270, 334, 287, 248] |
p03363 | u026788530 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ["N = int(input())\n\nA = raw_input().split(' ')\n\ntotal = 0\nB = [0]\ndic = {}\n\nfor i in range(N):\n total += int(A[i])\n B.append(total)\n\nfor b in B:\n if b in dic:\n dic[b] +=1\n else:\n dic[b] = 1\ndef C(n):\n return int(n*(n-1)/2)\n\nans = 0;\n\nfor k,v in dic.items():\n ans +=... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s242845576', 's283930168', 's769094804', 's802753916', 's880212349', 's433387601'] | [3064.0, 3064.0, 3060.0, 3060.0, 19324.0, 47380.0] | [17.0, 17.0, 17.0, 17.0, 37.0, 257.0] | [313, 312, 308, 308, 304, 309] |
p03363 | u029169777 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['N=int(input())\nA=list(map(int,input().split()))\nB=[0]\ntotal=0\ncount=1\nanswer=0\n\nfor i in range(len(A)):\n total+=A[i]\n B.append(total) \n\nB.sort() \n\nfor i in range(len(B)-1):\n if B[i]==B[i+1]:\n count+-1\n else:\n answer+=count*(count-1)/2 \n \n \nprint(int(answer))', 'N=int(input())\nA=li... | ['Wrong Answer', 'Accepted'] | ['s018307179', 's922985140'] | [25976.0, 25724.0] | [239.0, 240.0] | [489, 440] |
p03363 | u042802884 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['N=int(input())\nA=list(map(int,input().split()))\nd={}\nsum=0\nd[sum]=1\nfor i in range(N):\n sum+=A[i]\n if sum in d:\n d[sum]+=1\n else:\n d[sum]=1\nans=0\nprint(d)\nfor x in d:\n ans+=d[x]*(d[x]-1)//2 # 1*0//2=0\nprint(ans)', 'N=int(input())\nA=list(map(int,input().split()))\nd={}\nsu... | ['Wrong Answer', 'Accepted'] | ['s680767088', 's624083412'] | [42096.0, 38644.0] | [286.0, 202.0] | [241, 232] |
p03363 | u063896676 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['N = int(input())\nA = list(map(int, input().split()))\n\nsum_list = [None] * (N+1)\n\nsum_list[0] = 0\nfor i in range(N):\n sum_list[i+1] = sum_list[i] + A[i]\n\noutput = 0\nfor i in range(N+1):\n for j in range(i+1, N+1):\n if sum_list[j] - sum_list[i] == 0:\n print("(", str(i), ",", str(j), ... | ['Wrong Answer', 'Accepted'] | ['s167950091', 's833501775'] | [27132.0, 27260.0] | [2105.0, 342.0] | [348, 423] |
p03363 | u065446124 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n=int(input())\na=list(map(int,input().split()))\nans=0\ns=0\ndic={}\nfor i in a:\n s+=i\n dic.get(s,0)+=1\n ans+=dic[s]-s!=0\nprint(ans)', 'n=int(input())\na=list(map(int,input().split()))\nans=0\ns=0\ndic={}\nfor i in a:\n s+=i\n dic[s]=dic.get(s,0)+1\n ans+=dic[s]\n if s!=0:\n ans-=1\nprint(ans) '] | ['Runtime Error', 'Accepted'] | ['s111685169', 's657953353'] | [3064.0, 38676.0] | [18.0, 208.0] | [131, 157] |
p03363 | u075304271 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['import numpy as np\nimport math\nimport collections\nimport fractions\nimport itertools\n\ndef solve():\n n = int(input())\n a = list(map(int, input().split()))\n ruiseki = [0]\n ans = 0\n for i in range(n-1):\n ruiseki.append(ruiseki[i]+a[i+1])\n if ruiseki[i]+a[i+1] == 0:\n a... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s052579911', 's542834711', 's674111079', 's697819457', 's286454951'] | [53388.0, 51332.0, 26000.0, 53544.0, 45400.0] | [334.0, 312.0, 128.0, 339.0, 180.0] | [486, 472, 387, 509, 387] |
p03363 | u077025302 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n = int(input())\na = list(map(int,input().split()))\nlist_S = [0]\nans = 0\nfor i in range(n):\n list_S.append(list_S[i] + a[i])\n\ndict_S = {}\nfor i in list_S:\n if i in dict_S:\n dict_S[i] = 1\n else:\n dict_S[i] += 1\n\nfor v in dict_S.values():\n ans += v * (v-1) // 2\n\nprint(ans)', '... | ['Runtime Error', 'Accepted'] | ['s355107823', 's391178348'] | [26716.0, 41196.0] | [123.0, 207.0] | [297, 458] |
p03363 | u099918199 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n = int(input())\nlist_a = list((map(int, input().split())))\nmemo = 0\nmemo_dict = {0:1}\nfor i in range(0,n):\n memo += list_a[i]\n if memo in memo_dict:\n memo_dict[memo] += 1\n else:\n memo_dict[memo] = 1\nprint(memo_dict)\nans = 0\nfor number in memo_dict.values():\n ans += number * (nu... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s086379236', 's842704676', 's011506512'] | [42096.0, 38644.0, 39532.0] | [234.0, 210.0, 196.0] | [333, 356, 316] |
p03363 | u102242691 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['\nn = int(input())\na = list(map(int,input().split()))\nb = [0]\nfor i in range(n):\n b.append(b[-1] + a[i])\n\nans = 0\nb.sort()\n\nfor i in range(n+1):\n if i == 0:\n x = b[0]\n m = 1\n else:\n if x == b[i]:\n m += 1\n if i == n:\n ans += m*(m-1)//2... | ['Wrong Answer', 'Accepted'] | ['s740606819', 's759180903'] | [25976.0, 25724.0] | [217.0, 231.0] | [421, 338] |
p03363 | u104282757 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['N = int(input()) - 1\n\nLARGE = 10**9+7\n\ndef ex_euclid(x, y):\n c0, c1 = x, y\n a0, a1 = 1, 0\n b0, b1 = 0, 1\n \n while c1 != 0:\n m = c0 % c1\n q = c0 // c1\n \n c0, c1 = c1, m\n a0, a1 = a1, (a0 - q * a1)\n b0, b1 = b1, (b0 - q * b1)\n \n return c0, a0, b0\n\nfac... | ['Wrong Answer', 'Accepted'] | ['s877626008', 's272945568'] | [20916.0, 39544.0] | [964.0, 267.0] | [976, 426] |
p03363 | u105210954 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['from collections import Counter\nfrom math import factorial\n\n\nn = int(input())\na = list(map(int, input().split()))\n\ns = [0]\ns_elem = 0\n\nfor ai in a:\n \n s_elem += ai\n s.append(s_elem)\n\nans = 0\nfor c in Counter(s).values():\n if c > 1:\n ans += i*(i-1)//2\n \nprint(ans)', 'from collections impo... | ['Runtime Error', 'Accepted'] | ['s311809919', 's554957251'] | [41728.0, 41720.0] | [152.0, 169.0] | [273, 259] |
p03363 | u112902287 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['\u2028\u2028\u2028def solve(A):\n cumsum = [0]\n for elem in A:\n cumsum.append(cumsum[-1]+elem)\n d = dict()\n for i in cumsum:\n try:\n d[i] += 1\n except:\n d[i] = 1\n res = 0\n for value in d.values():\n res += (value * (value - 1)) // 2\n ret... | ['Runtime Error', 'Accepted'] | ['s293224602', 's699776881'] | [2940.0, 41108.0] | [17.0, 192.0] | [419, 410] |
p03363 | u118642796 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['import bisect\n \nN = int(input())\nA = [int(i) for i in input().split()]\n \nB = {}\nB[0] = 1\n\ns = 0\nans = 0\n\nfor a in A:\n s += a\n ans += B.get(a,0)\n B[a] = B.get(a,0) + 1\n\nprint(ans)\n ', 'inport bisect\n\nN = int(input())\nA = [int(i) for i in input().split()]\n\nB = [0]\nX = [0]\nans = 0\n\... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s106285370', 's139857974', 's508607216', 's689971069', 's710999868', 's785703402', 's621142311'] | [33652.0, 2940.0, 2940.0, 25724.0, 25604.0, 26608.0, 39540.0] | [205.0, 17.0, 17.0, 2104.0, 2104.0, 80.0, 203.0] | [193, 351, 156, 155, 337, 287, 168] |
p03363 | u123543140 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['import collections\n\n#n=int(input())\n#a=list(map(int,input().split(" ")))\nn=5\na=[1,-2,3,-4,5]\nb=[0 for i in range(n+1)]\ns=[0 for i in range(n+1)]\nfor i in range(1,n+1):\n s[i]=s[i-1]+a[i-1]\nc=collections.Counter(s).most_common()\nd=0\nfor i in c:\n if i[1]<2:\n break\n d+=i[1]*(i[1]-1)//2\nprint(d)', 'i... | ['Wrong Answer', 'Accepted'] | ['s786706522', 's217560230'] | [3316.0, 48668.0] | [21.0, 241.0] | [297, 271] |
p03363 | u134387396 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n = int(input())\nnums = input()\nA =[int(x.strip()) for x in nums.split()]\n\nS = [0]\nfor i in range(n):\n S.append(S[i]+A[i])\n\nS.sort()\n# print(S)\n\nans = 0\nfor i in range(n):\n for j in range(n-i):\n print(i,i+j+1)\n if S[i] == S[i+j+1]:\n ans += 1\n if S[i] < S[j+1]:\n ... | ['Wrong Answer', 'Accepted'] | ['s969184350', 's403461267'] | [34980.0, 43508.0] | [2110.0, 193.0] | [328, 286] |
p03363 | u143492911 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n=int(input())\na=list(map(int,input().split()))\nimport math\ns=[0]*(n+1)\na.insert(0,0)\nfor i in range(1,n+1):\n s[i]=s[i-1]+a[i]\nprint(s)\nfrom collections import Counter\ndata=Counter(s)\ndef combination_cout(n,r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\nans=[]\nfor i in data.... | ['Wrong Answer', 'Accepted'] | ['s366380684', 's513275717'] | [44588.0, 41428.0] | [1532.0, 191.0] | [508, 356] |
p03363 | u149260203 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['N = int(input())\nA = [int(i) for i in input().split()]\nca = [A[0]] + [0]*(N-1)\n\nfor i in range(1,N):\n ca[i] = ca[i-1] + A[i]\n\ncount = 0\nfor i in list(set(ca)):\n if i == 0:\n count += sum([1 if j == 0 else 0 for j in ca])\n number = sum([1 if j == i else 0 for j in ca])\n count += number * ... | ['Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s161615627', 's524517994', 's735612119', 's934507407'] | [33396.0, 34712.0, 44028.0, 39508.0] | [2105.0, 292.0, 2110.0, 226.0] | [334, 366, 351, 274] |
p03363 | u170201762 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['N = int(input())\na = list(map(int,input().split()))\ns = [0]*(len(a)+1)\nfor i in range(len(a)):\n s[i+1] = s[i] + a[i]\ns.sort()\nn = 0\nfor x in set(s):\n l = s.count(x)\n n += l*(l-1)/2\nprint(n)', 'a = list(map(int,input().split()))\nn = 0\nfor i in range(1,N+1):\n for j in range(N+1-i):\n S =... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s112583043', 's751728867', 's623043255'] | [32824.0, 3060.0, 52488.0] | [2105.0, 18.0, 354.0] | [198, 197, 274] |
p03363 | u182249053 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['N = int(input())\nA = list(int(i) for i in input().split())\nB = []\nB.append(0)\nn = 1\ncnt = 0\n\nfor i in A:\n B[0] += i\n B.append(B[0])\nB[0] = 0\nB.sort()\n\nfor i in range(1,N+1):\n if B[i] == B[i-1]:\n n += 1\n else:\n cnt += int(n*(n-1)/2)\n n = 1\n\ncnt += int(n*(n-1)/2)6\n\... | ['Runtime Error', 'Accepted'] | ['s364903918', 's245397267'] | [3064.0, 26136.0] | [17.0, 268.0] | [307, 306] |
p03363 | u187894032 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['N = int(input())\nA = list(map(int, input().split()))\n\nC = [0 for _ in A]\nC[0] = A[0]\nfor i in range(1, len(A)):\n C[i] = C[i-1] + A[i]\n\nfrom collections import Counter\nimport scipy.misc as scm\n\ncount = Counter(C)\n\nli = list(count.values())\n\nres = 0\nfor l in li:\n if l == 1:\n pass\n els... | ['Wrong Answer', 'Accepted'] | ['s673026711', 's757236676'] | [51224.0, 41540.0] | [664.0, 182.0] | [364, 340] |
p03363 | u215743476 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n = int(input())\na = list(map(int, input().split()))\n\nans = 0\nfor i in range(n):\n sum = 0\n for j in range(i, n):\n sum += a[i]\n if sum == 0:\n ans += 1\n\nprint(ans)', 'from collections import Counter\n\nn = int(input())\na = list(map(int, input().split()))\n\nl_sum = [0]\ns= 0\n... | ['Wrong Answer', 'Accepted'] | ['s115563201', 's132914738'] | [26720.0, 41696.0] | [2104.0, 207.0] | [192, 299] |
p03363 | u218843509 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n = int(input())\na = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n):\n sum_list = [sum(a[i:j]) for j in range(i + 1, n + 1)]\n print(sum_list)\n ans += sum_list.count(0)\n \nprint(ans)', 'from collections import Counter\nn = int(input())\na = list(map(int, input().split()))\nb = 0\nc = C... | ['Wrong Answer', 'Accepted'] | ['s097286120', 's366890200'] | [25976.0, 39264.0] | [2104.0, 329.0] | [204, 183] |
p03363 | u223646582 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['N, P = map(int, input().split())\nodd = sum([int(i) % 2 for i in input().split()])\neven = N-odd\n\nif odd == 0:\n if P == 0:\n print(2**even)\n else: # P==1\n print(0)\nelse:\n print(2**even * (2**odd//2))\n', 'N = int(input())\nA = [int(i) for i in input().split()]\n\ns = [0]\nsum = 0\nfor i... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s383436757', 's707612765', 's715261983'] | [3060.0, 35156.0, 41472.0] | [17.0, 2105.0, 165.0] | [221, 227, 227] |
p03363 | u223904637 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n=int(input())\nl=list(map(int,input().split()))\nr[0]*(n+1)\nfor i in range(n):\n r[i+1]=r[i]+l[i]\nr.sort()\nr.append(100000000000)\nf=1\nans=0\nfor i in range(n+1):\n if r[i]==r[i+1]:\n f+=1\n else:\n ans+=f*(f-1)//2\n f=1\nprint(ans)', 'n=int(input())\nl=list(map(int,input().split())... | ['Runtime Error', 'Accepted'] | ['s628353233', 's377211611'] | [26716.0, 25720.0] | [69.0, 243.0] | [252, 254] |
p03363 | u227082700 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['import math\ndef aPb(a,b):return(math.factorial(a)//math.factorial(a-b))\ndef aCb(a,b):return(aPb(a,b)//math.factorial(b))\ndef ex(X):\n b=X[:]\n b.append("null")\n a=[]\n for i in range(len(X)):\n if b[i]!=b[i+1]:a.append(b[i])\n return a\nn,a=int(input()),list(map(int,input().split()));b=[0]\nfor i in a:b.a... | ['Runtime Error', 'Accepted'] | ['s924110532', 's811690158'] | [27268.0, 47484.0] | [2105.0, 277.0] | [393, 211] |
p03363 | u228759454 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['import numpy as np\n\nN = int(input())\na_list = list(map(int, input().split()))\n\ni_sum_list = []\nzero_cnt = 0\nfor i in range(2, N + 1):\n if i == 2:\n for j in range(0, N - i + 1):\n if j < N - i:\n i_sum_list.append(sum(a_list[j:j + i]))\n\n if j == N - i:\n ... | ['Wrong Answer', 'Accepted'] | ['s634774136', 's752814065'] | [34592.0, 45036.0] | [2109.0, 207.0] | [614, 177] |
p03363 | u232429509 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['#include <bits/stdc++.h>\n \nusing namespace std;\n \n#define rep(i,n) for(int i=0;i<n;i++)\n#define REP(i,s,n) for(int i=(s);i<(n);i++)\n#define repr(i,n) for(int i=n-1;i>=0;i--)\n#define REPR(i,s,n) for(int i=(s);i>=(n);i--)\n#define all(a) (a).begin(),(a).end()\n\n\n\n#define pb push_back\n#define pf push_front\n#... | ['Runtime Error', 'Accepted'] | ['s096025594', 's254567175'] | [2940.0, 39208.0] | [18.0, 213.0] | [1298, 319] |
p03363 | u257974487 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n = int(input())\nnums = list(map(int,input().split()))\n\nS = [0]\n\nfor i in range(n):\n S.append(S[i] + nums[i])\n\nS.sort()\nprint(S)\n\nans = 0\n\nfor i in range(n):\n for j in range(i+1, n+1):\n if S[i] == S[j]:\n ans += 1\n elif S[i] > S[j]:\n break\n\nprint(ans)', 'n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s059996268', 's082338703', 's685247011'] | [30040.0, 30040.0, 41696.0] | [2105.0, 2105.0, 349.0] | [292, 292, 316] |
p03363 | u268792407 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n=int(input())\na=list(map(int,input().split()))\nb=[]\nfor i in range(n):\n if i==0:\n b.append(a[0])\n else:\n b.append(b[-1]+a[i])\nans = b.count(0)\nbp = [i for i in b if i>0]\nbm = [i for i in b if i<0]\nfor i in bp:\n ans += bm.count(-i)\nprint(ans)', 'n=int(input())\na=list(map(int,input().split()))\n... | ['Wrong Answer', 'Accepted'] | ['s393394212', 's268843729'] | [26720.0, 26136.0] | [2105.0, 230.0] | [251, 338] |
p03363 | u268793453 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n = int(input())\ns = [input() for i in range(n)]\n\ncnt = 0\n\nfor i in range(n):\n i_ = (n+i)%n\n for k in range(n):\n for l in range(n):\n if s[(i_+k)%n][l] != s[(i_+l)%n][k]:\n break\n else:\n continue\n break\n else:\n cnt += 1\n\nprint(cn... | ['Runtime Error', 'Accepted'] | ['s018000774', 's714438497'] | [8024.0, 39040.0] | [22.0, 216.0] | [305, 202] |
p03363 | u278430856 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ["if __name__ == '__main__':\n N, numbers = get_input()\n s = [0]\n for i in range(N):\n s.append(s[-1] + numbers[i])\n s.sort()\n print(s)\n count = 1\n result = 0\n for i in range(N):\n if(s[i] == s[i+1]):\n count += 1\n else:\n result += count * (cou... | ['Runtime Error', 'Accepted'] | ['s848720711', 's777532847'] | [3064.0, 25724.0] | [17.0, 245.0] | [396, 867] |
p03363 | u312025627 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['import itertools\nimport collections\nn = int(input())\na = list(map(int,input().split()))\n\nb = [0] + a\ns = list(itertools.accumulate(b))\n\n\nc = collections.Counter(s)\ncm = c.most_common()\nprint(cm)\ncnt = 0\nfor v in cm:\n if v[1] > 1:\n cnt += (v[1]*(v[1]-1) // 2) \nprint(cnt)', "def main():\n f... | ['Wrong Answer', 'Accepted'] | ['s046070654', 's600169462'] | [60156.0, 41620.0] | [349.0, 140.0] | [280, 334] |
p03363 | u314057689 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['import sys\nimport os\nimport time\nimport re\nfrom pydoc import help\nimport string\nimport math\nimport numpy as np\nfrom operator import itemgetter\nfrom collections import Counter\nfrom collections import deque\nfrom collections import defaultdict as dd\nimport fractions\nfrom heapq import heappop, heappush, heap... | ['Runtime Error', 'Accepted'] | ['s755819497', 's070322073'] | [15284.0, 52864.0] | [269.0, 389.0] | [1381, 1717] |
p03363 | u325264482 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['from collections import Counter\n\nN = int(input())\nA = list(map(int, input().split()))\n\nS = []\n\nfor i, a in enumerate(S):\n S.append(S[0] + a)\n\nS.sort()\na = Counter(S).most_common()\n\ncnt = 0\n\nfor i in range(len(a)):\n cnt += ((a[i][1]-1)*a[i][1])//2\n\nprint(cnt)\n', 'from itertools import accumula... | ['Wrong Answer', 'Accepted'] | ['s448449940', 's585709233'] | [27508.0, 48272.0] | [78.0, 213.0] | [265, 311] |
p03363 | u327248573 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ["import numpy\nN = int(input())\nary = list(map(int, input().split(' ')))\ncount = 0\nzero_count = 0\nfor i in range(N):\n if ary[0] == 0:\n zero_count += 1\n ary.pop(0)\n continue\n elif ary[0] == ary[1]:\n ary.pop(0)\n continue\n else:\n if zero_count != 0:\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s503895557', 's617078913', 's837900286'] | [34664.0, 34660.0, 34652.0] | [2109.0, 2109.0, 354.0] | [580, 803, 384] |
p03363 | u363074342 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n = int(input())\na = list(map(int,input().split()))\ndic_S = {0:[0]}\nS = 0\nans = 0\nfor i in range(n):\n S += a[i]\n if S not in dic_S:\n dic_S[S] = []\n else:\n pass\n dic_S[S].append(a[i])\n \n\nfor k in dic_S.keys():\n I = len(dic_S[k])\n if 3 <= I:\n ans += (I*(I-1))//... | ['Runtime Error', 'Accepted'] | ['s842965425', 's818204419'] | [2940.0, 54780.0] | [17.0, 424.0] | [373, 372] |
p03363 | u367130284 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['from itertools import*\nfrom collections import*\nfrom operator import mul\nfrom functools import reduce\n \ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n \n \nn,*a=map(int,open(0).read().spl... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s100846488', 's233631259', 's622405680', 's861391971', 's641052388'] | [39172.0, 39176.0, 39908.0, 25108.0, 41568.0] | [135.0, 129.0, 137.0, 71.0, 138.0] | [401, 397, 409, 282, 396] |
p03363 | u371467115 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['n=int(input())\na=list(map(int,input().split()))\ncnt=0\nn=[]\nfor i in range(len(a)):\n for j in range(i+1,len(a)):\n if n[i-1]==0:\n continue\n elif sum(a[i:j])==0:\n cnt+=1\nprint(cnt)', 'from collections import Counter\nn=int(input())\na = [int(i) for i in input().split()]\nb=[0]\ns=0\nfor i in a... | ['Runtime Error', 'Accepted'] | ['s974274957', 's322550063'] | [26720.0, 41472.0] | [72.0, 284.0] | [194, 209] |
p03363 | u372345564 | 2,000 | 262,144 | We have an integer sequence A, whose length is N. Find the number of the non-empty **contiguous** subsequences of A whose sums are 0. Note that we are counting **the ways to take out subsequences**. That is, even if the contents of some two subsequences are the same, they are counted individually if they are taken fro... | ['def main():\n N = int(input())\n A = [int(i) for i in input().split()]\n \n result = 0\n s = [0]\n for i in range(N):\n s.append(s[-1] + A[i])\n \n s.sort()\n print(s)\n \n count = 1\n for i in range(N):\n if(s[i] == s[i+1]):\n count += 1\n else:... | ['Wrong Answer', 'Accepted'] | ['s421597736', 's723271156'] | [30552.0, 26720.0] | [226.0, 196.0] | [469, 470] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.