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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03724 | u022979415 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['def main():\n vertex, query = map(int, input().split())\n cnt = [0 for _ in range(vertex)]\n answer = "YES"\n for _ in range(query):\n a, b = map(lambda x: int(x) - 1, input().split())\n left = min(a, b)\n right = max(a, b)\n cnt[left] += 1\n if right < vertex - 1:\n ... | ['Wrong Answer', 'Accepted'] | ['s167044427', 's724798935'] | [7080.0, 4184.0] | [459.0, 355.0] | [734, 335] |
p03724 | u054106284 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['N, M = (int(i) for i in input().split())\nDP[N] = [False]*N\nfor i in range(M):\n a, b = (int(i) for i in input().split())\n for i in (a, b):\n DP[i-1] = not DP[i-1]\nfor i in range(N):\n if DP[i]:\n print(NO)\n break\nelse:\n print(YES)', 'N, M = (int(i) for i in input().split())\nDP = [False]*N\nfor i ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s457794533', 's673415900', 's692693354', 's875873162', 's947881406', 's598069444'] | [3828.0, 3828.0, 3828.0, 3828.0, 3828.0, 3828.0] | [19.0, 403.0, 18.0, 391.0, 19.0, 395.0] | [239, 236, 235, 236, 239, 240] |
p03724 | u075595666 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ["n,m = map(int,input().split())\nchk = [0]*n\nfor i in range(m):\n a,b = map(int,input().split())\n chk[a-1] += 1\n chk[b-1] += 1\nans = 'Yes'\nfor i in chk:\n if i % 2 == 1:\n ans = 'No'\nprint(ans)", "n,m = map(int,input().split())\nchk = [0]*n\nfor i in range(m):\n a,b = map(int,input().split())\n chk[a-1... | ['Wrong Answer', 'Accepted'] | ['s438300318', 's242968506'] | [3828.0, 3828.0] | [338.0, 332.0] | [196, 196] |
p03724 | u095426154 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['# coding: utf-8\nN,M=map(int,input().split())\nNL=[0 for i in range(N)]\nfor i in range(M):\n a,b=map(int,input().split())\n NL[a-1]+=1\n NL[b-1]+=1\n\nflg=True\n\nfor i in range(N):\n if NL[i]%2==1:\n flg=False\n\nif flg:\n print("Yes")\nelse:\n print("No")\n', '# coding: utf-8\nN,M=map(int,... | ['Wrong Answer', 'Accepted'] | ['s687814306', 's280938456'] | [3928.0, 3888.0] | [332.0, 341.0] | [267, 267] |
p03724 | u102960641 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['n,m = map(int, input().split())\nab = list(map(int, input().split()))\ns = [0] * (10 ** 5+1)\nfor a,b in ab:\n s[a] += 1\n s[b] += 1\nif any([s % 2 for i in s]):\n print("NO")\nelse:\n print("YES")\n \n', 'n,m = map(int, input().split())\nab = [list(map(int, input().split())) for i in range(m)]\ns = [0] * (10 **... | ['Runtime Error', 'Accepted'] | ['s768242287', 's523288008'] | [3828.0, 29072.0] | [18.0, 358.0] | [196, 212] |
p03724 | u134019875 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ["n, m = map(int, input().split())\nd = {i: 0 for i in range(1, n)}\nfor _ in range(n):\n a, b = map(int, input().split())\n d[a] += 1\n d[b] += 1\nfor k, v in d.items():\n if v % 2:\n print('NO')\n break\nelse:\n print('YES')\n", "n, m = map(int, input().split())\nd = {i: 0 for i in range(... | ['Runtime Error', 'Accepted'] | ['s024907554', 's872641651'] | [15084.0, 15084.0] | [334.0, 354.0] | [243, 245] |
p03724 | u163320134 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ["n,m=map(int,input().split())\ng=[[]*for _ in range(n+1)]\nfor _ in range(m):\n u,v=map(int,input().split())\n g[u].append(v)\n g[v].append(u)\nflag=True\nfor i in range(1,n+1):\n if g[i]%2==0:\n continue\n else:\n flag=False\n break\nif flag==True:\n print('YES')\nelse:\n print('NO')", "n,m=map(int,in... | ['Runtime Error', 'Accepted'] | ['s724987475', 's845602632'] | [2940.0, 20656.0] | [17.0, 374.0] | [284, 289] |
p03724 | u373047809 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['c = [0]*10**5\nfor i in open(0).read().split()[::2]: c[int(i)] ^= 1\nprint("NO" if any(c) else "YES")', 'c = [0]*10**5\nfor i in open(0).read().split()[2:]: c[int(i)-1] ^= 1\nprint("NO" if any(c) else "YES")'] | ['Runtime Error', 'Accepted'] | ['s877757969', 's694164204'] | [19060.0, 19060.0] | [67.0, 115.0] | [99, 100] |
p03724 | u375616706 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nN, M = int(input())\nnode = [0]*(N+1)\nfor _ in range(M):\n a, b = map(lambda x: int(x)-1, input().split())\n node[a] += 1\n node[b] += 1\n\nif all(x % 2 == 0 for x in node):\n print("YES")\nelse:\n ... | ['Runtime Error', 'Accepted'] | ['s441797536', 's060278431'] | [3060.0, 3828.0] | [17.0, 206.0] | [315, 305] |
p03724 | u391819434 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ["N,M,*ab=open(0).read().split()\nfrom collections import*\nC=Counter(ab)\nprint('YNeos'[any(v%2 for v in C.values())::2])", "N,M,*ab=open(0).read().split()\nfrom collections import*\nC=Counter(ab)\nprint('YNEOS'[any(v%2 for v in C.values())::2])"] | ['Wrong Answer', 'Accepted'] | ['s288664508', 's122088963'] | [28484.0, 28372.0] | [90.0, 89.0] | [117, 117] |
p03724 | u413165887 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['n, m = map(int, input().split())\n\ntree = [0 for _ in range(n+1)]\nfor _i in range(m):\n a, b = map(int, input().split())\n tree[a] += 1\n tree[b] += 1\nif all(i%2==0 for i in tree):\n print("Yes")\nelse:\n print("No")', 'n, m = map(int, input().split())\n\ntree = [0 for _ in range(n+1)]\nfor _i in ra... | ['Wrong Answer', 'Accepted'] | ['s992282698', 's294991444'] | [3888.0, 3888.0] | [315.0, 317.0] | [224, 224] |
p03724 | u426108351 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['N, M = map(int, input().split())\nnum = [0] * (N+1)\nfor i in range(M):\n a, b = map(int, input().split())\n num[a] += 1\n num[b] += 1\n\nflag = 1\nfor i in num:\n if i % 2 != 0:\n flag = 0\n\nif flag = 1:\n print("YES")\nelse:\n print("NO")\n', 'N, M = map(int, input().split())\nnum = [0] * ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s417969473', 's660316967', 's486289848'] | [3188.0, 2940.0, 3828.0] | [21.0, 17.0, 316.0] | [252, 254, 253] |
p03724 | u474423089 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ["N, M = map(int, input().split(' '))\nl = [0]*(N-1)\nfor i in range(M):\n a, b = map(int, input().split(' '))\n if 1 in [a, b]:\n a, b = sorted([a, b])\n l[b-2] += 1\n else:\n l[a - 2] += 1\n l[b - 2] += 1\nfor i in l:\n if i % 2 != 0:\n print('No')\n exit()\nprint... | ['Wrong Answer', 'Accepted'] | ['s856544723', 's027795760'] | [3828.0, 3828.0] | [351.0, 345.0] | [311, 311] |
p03724 | u518042385 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['n,m=map(int,input().split())\nl=[0]*n\nfor i in range(m):\n a,b=map(int,input().split())\n l[a-1]+=1\n l[b-1]+=1\nb=True\nfor i in range(m):\n if l[i]%2!=1:\n b=False\nif b:\n print("YES")\nelse:\n print("NO")', 'n,m=map(int,input().split())\nl=[0]*n\nfor i in range(m):\n a,b=map(int,input().split())\n l[a... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s288326368', 's913463055', 's789593079'] | [3828.0, 3828.0, 3828.0] | [330.0, 332.0, 333.0] | [205, 206, 206] |
p03724 | u538632589 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['n, m = map(int, input().split())\nc_list = [0]*n\nfor _ in range(m):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n c_list[a] += 1\n c_list[b] += 1\n\nok = True\nfor c in c_list:\n if c % 2 != 0:\n ok = False\nif ok:\n print("Yes")\nelse:\n print("No")\n', 'n, m = map(int, input... | ['Wrong Answer', 'Accepted'] | ['s548504406', 's193206127'] | [3828.0, 3828.0] | [330.0, 343.0] | [276, 276] |
p03724 | u619728370 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['from collections import Counter\n\nn,m = map(int,input().split())\ns = ""\nfor i in range(m):\n s = s + input()\ncounter = Counter(s)\nfor i in range(n+1):\n if counter[str(i)] % 2 != 0:\n print("NO")\n break\nif i == n -1:\n print("YES")', 'from collections import Counter\n\nn,m = map(int,inpu... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s002388077', 's556782912', 's222615808'] | [4584.0, 4464.0, 4564.0] | [279.0, 281.0, 267.0] | [249, 246, 246] |
p03724 | u619819312 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['import numpy as np\nn,m=map(int,input().split())\ns=np.zeros(n+1)\nfor i in range(m):\n a,b=map(int,input().split())\n s[a]+=1\n s[b]+=1\nprint(s%2,s)\nprint("NO" if sum(s%2)else"YES")', 'import numpy as np\nn,m=map(int,input().split())\ns=np.zeros(n+1)\nfor i in range(m):\n a,b=map(int,input().split())\n... | ['Wrong Answer', 'Accepted'] | ['s598858231', 's138719203'] | [14028.0, 14028.0] | [886.0, 877.0] | [185, 172] |
p03724 | u667084803 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['import sys\n\nN,M=list(map(int, input().split()))\np=[]\nq=0\ncount=0\nfor i in range(0,M):\n p.append(list(map(int, input().split())))\nfor i in range(0,M):\n q+=p[i][0]-p[i][1]\nif q%2==1:\n print("NO")\nelse:\n for j in range(0,M,M/100):\n for i in range(0,M):\n if p[i][0]==j or p[i][1]==j:\n co... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s028793608', 's120420140', 's236626116', 's700103072', 's729042010', 's939461306', 's097208421'] | [27368.0, 29396.0, 3064.0, 27368.0, 3064.0, 27364.0, 3888.0] | [378.0, 2105.0, 17.0, 604.0, 17.0, 382.0, 379.0] | [405, 410, 580, 409, 592, 229, 284] |
p03724 | u668785999 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ["N,M = map(int,input().split())\ncntNode = [0]*N\nfor i in range(N):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n cntNode[a] += 1\n cntNode[b] += 1\n\nflag = True\nfor i in range(N):\n if(cntNode[i] % 2 != 0):\n flag = False\n break\nif(flag):\n print('Yes')\nelse:\n print... | ['Runtime Error', 'Accepted'] | ['s217484777', 's583992160'] | [9632.0, 9468.0] | [221.0, 217.0] | [307, 307] |
p03724 | u670180528 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['n,_,*l=map(int,open(0).read().split())\nc=[0]*-~n\nfor a,b in zip(l[::2],l[1::2]):\n\tc[a]^=1;c[b]^=1\nprint("YNEOS"[any(i for i in l)::2])', 'n,_,*l=map(int,open(0).read().split())\nc=[0]*-~n\nfor a,b in zip(l[::2],l[1::2]):\n\tc[a]^=1;c[b]^=1\nprint("YNEOS"[any(i for i in c)::2])'] | ['Wrong Answer', 'Accepted'] | ['s998186129', 's924038993'] | [25076.0, 25076.0] | [98.0, 98.0] | [134, 134] |
p03724 | u708255304 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ["N, M = map(int, input().split()) \n\ncounter = [0] * N\n\nfor _ in range(M):\n a, b = map(lambda x: int(x) - 1, input().split())\n counter[a] += 1\n counter[b] += 1\n\nflag = True\nfor i in range(len(counter)):\n if counter[i] % 2 != 0:\n flag = False\n\n\nif flag:\n print('Yes')\nelse:\n pr... | ['Wrong Answer', 'Accepted'] | ['s279059696', 's676189281'] | [3828.0, 14660.0] | [389.0, 244.0] | [337, 298] |
p03724 | u727801592 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ["n,m=map(int,input().split())\ncnt=[]\nfor i in range(n):\n cnt.append(0)\nfor i in range(m):\n a,b=map(int,input().split())\n cnt[a-1]+=1\n cnt[b-1]+=1\nfor i in range(n):\n if cnt[i]%2==1:\n print('NO')\n exit()\nprint('Yes')", "n,m=map(int,input().split())\ncnt=[]\nfor i in range(n):\n cnt.append(0)\nfo... | ['Wrong Answer', 'Accepted'] | ['s885405240', 's923943950'] | [3964.0, 3888.0] | [340.0, 338.0] | [225, 225] |
p03724 | u736729525 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['def main():\n import sys\n input = sys.stdin.readline\n N, M = map(int, input().split())\n C = [0]*(N+1)\n for i in range(M):\n a, b = map(int, input().split())\n C[a]+=1\n C[b]+=1\n for i in range(N+1):\n if C[i] % 2 == 1:\n return "NO"\n return "YES"\n\nma... | ['Wrong Answer', 'Accepted'] | ['s087704366', 's233595439'] | [3828.0, 3828.0] | [144.0, 137.0] | [309, 316] |
p03724 | u784022244 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['N,M=map(int, input().split())\n\n\n\n\n\n\n\nD={} \nfor i in range(N):\n D[i+1]=0\nfor i in range(M):\n a,b=map(int, input().split())\n D[a]+=1\n D[b]+=1\n\nodds=0\nevens=0\nfor v in D.values():\n if v%2==0:\n evens+=1\n else:\n odds+=1\nif odds==0:\n print("Yes")\nelse:\n if evens>=odds... | ['Wrong Answer', 'Accepted'] | ['s749657906', 's916087103'] | [15084.0, 15084.0] | [384.0, 359.0] | [545, 282] |
p03724 | u785578220 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['N,M=map(int,input().split())\nimport collections\ne =[]\nfor i in range(N):\n ta,tb =map(int,input().split())\n e.extend([ta,tb])\nc = collections.Counter(e)\nprint(c)\nans = "YES"\nfor i in c:\n if c[i]%2 != 0:\n ans = "NO"\nprint(ans)\n', 'N,M=map(int,input().split())\nimport collections\ne =[]\nfor... | ['Runtime Error', 'Accepted'] | ['s110997501', 's373467001'] | [27140.0, 16004.0] | [438.0, 363.0] | [241, 242] |
p03724 | u798818115 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['N,M=map(int,input().split())\n\ncount=[0]*N\nfor _ in range(M):\n a,b=map(int,input().split())\n count[a-1]+=1\n count[b-1]+=1\n\nfor c in count:\n if c%2==0:\n print("NO")\n exit()\n\nprint("YES")', 'N,M=map(int,input().split())\n\ncount=[0]*N\nfor _ in range(M):\n a,b=map(int,input().sp... | ['Wrong Answer', 'Accepted'] | ['s760582229', 's162833471'] | [3828.0, 3828.0] | [319.0, 325.0] | [210, 210] |
p03724 | u816116805 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#\n\n"""\nagc014 B\n"""\n\nfrom collections import Counter\nn, m = map(int, input().split())\n\ncnt = Counter()\nfor i in range(m):\n a, b = map(int, input().split())\n cnt[a] += 1\n cnt[b] += 1\n\nfor a in range(1, n+1):\n if cnt[a] % 2 == 1:\n pr... | ['Wrong Answer', 'Accepted'] | ['s458510426', 's025936879'] | [9448.0, 9448.0] | [453.0, 468.0] | [353, 353] |
p03724 | u854685751 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['N = int(input())\n\nl = [0 for i in range(N)]\nad = [[] for i in range(N)]\nde1 = [0 for i in range(N)]\n\nfor i in range(N-1):\n\ta,b = map(int,input().split())\n\tl[a-1] += 1\n\tl[b-1] += 1\n\tad[a-1].append(b-1)\n\tad[b-1].append(a-1)\n\nfor i in range(N):\n\tif l[i] == 1:\n\t\tde1[ad[i][0]] += 1\n\nfor i in range... | ['Runtime Error', 'Accepted'] | ['s103845072', 's747850183'] | [3064.0, 3888.0] | [18.0, 324.0] | [368, 204] |
p03724 | u879870653 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['N,M = map(int,input().split())\n\nG = [[] for i in range(N)]\n\nfor i in range(M) :\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n G[a].append(b)\n G[b].append(a)\n\nans = "NO" if any(len(g) for g in G) else "YES"\n\nprint(ans)\n', 'N,M = map(int,input().split())\n\nG = [[] for i in range(N)]\n\n... | ['Wrong Answer', 'Accepted'] | ['s005377981', 's599637550'] | [20656.0, 20656.0] | [384.0, 407.0] | [236, 238] |
p03724 | u886747123 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['N, M = map(int, input().split())\nc = [0] * (N+1)\n\nfor _ in range(M):\n a, b = map(int, input().split())\n c[a] += 1\n c[b] += 1\n\nprint("Yes" if all(c[i]%2 == 0 for i in range(N+1)) else "No")', 'N, M = map(int, input().split())\nc = [0] * (N+1)\n\nfor _ in range(M):\n a, b = map(int, input().split())... | ['Wrong Answer', 'Accepted'] | ['s250503278', 's539578850'] | [3828.0, 3828.0] | [330.0, 319.0] | [197, 197] |
p03724 | u896741788 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['n,m=map(int,input().split())\nc=sum([list(map(int,input().split())) for i in range(m)],[])\nfrom collections import Counter as co\nfor i in co(c).values():\n if i%2:print("NO");exit()\n print("YES")', 'n,m=map(int,input().split())\nfrom collections import Counter as co\n\nfrom itertools import chain\nflatten=chai... | ['Runtime Error', 'Accepted'] | ['s774528171', 's129559211'] | [2940.0, 31388.0] | [17.0, 244.0] | [197, 243] |
p03724 | u905582793 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['import sys\nfrom collections import Counter\nn,m=map(int,input().split())\na=list(map(int,read().split()))\nc=Counter(a)\nans="YES"\nfor i in c.values():\n if i%2:\n ans="NO"\nprint(ans)', 'import sys\nfrom collections import Counter\nread=sys.stdin.read\nn,m=map(int,input().split())\na=list(map(int,read().split(... | ['Runtime Error', 'Accepted'] | ['s001252292', 's595818377'] | [3316.0, 24744.0] | [21.0, 95.0] | [181, 201] |
p03724 | u984276646 | 2,000 | 262,144 | Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice. First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge. Then, Aoki gave him M queries. The i-th of them is as follows: * Increment the number written at each edge along t... | ['N, M = map(int, input().split())\nD = {i: 0 for i in range(1, N + 1)}\nfor i in range(M):\n a, b = map(int, input().split())\n D[a], D[b] += 1\np = 0\nfor i in D:\n if i % 2 == 1:\n p = 1\nif p == 0:\n print("YES")\nelse:\n print("NO")', 'N, M = map(int, input().split())\nD = {i: 0 for i in range(1, N + 1)}\n... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s591255610', 's948876401', 's450883691'] | [3064.0, 15208.0, 15084.0] | [17.0, 359.0, 359.0] | [231, 238, 241] |
p03725 | u107077660 | 2,000 | 262,144 | Takahashi is locked within a building. This building consists of H×W rooms, arranged in H rows and W columns. We will denote the room at the i-th row and j-th column as (i,j). The state of this room is represented by a character A_{i,j}. If A_{i,j}= `#`, the room is locked and cannot be entered; if A_{i,j}= `.`, the r... | ['from collections import deque\nH, W, K = map(int, input().split())\nm = [input() for i in range(H)]\nv = [[0]*W for i in range(H)]\nf = 0\nfor i in range(H):\n\tif f:\n\t\tbreak\n\tfor j in range(W):\n\t\tif m[i][j] == "S":\n\t\t\tx = i\n\t\t\ty = j\n\t\t\tf = 1\n\t\t\tbreak\nstack = deque([[x,y,0]])\nv[x][y] = 1\nan... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s708613103', 's871926514', 's100634173'] | [104148.0, 9068.0, 9196.0] | [2110.0, 120.0, 1884.0] | [754, 746, 806] |
p03725 | u562935282 | 2,000 | 262,144 | Takahashi is locked within a building. This building consists of H×W rooms, arranged in H rows and W columns. We will denote the room at the i-th row and j-th column as (i,j). The state of this room is represented by a character A_{i,j}. If A_{i,j}= `#`, the room is locked and cannot be entered; if A_{i,j}= `.`, the r... | ["import sys\n\nsys.setrecursionlimit(10 ** 9)\n\n\ndef start_pos():\n for r in range(H):\n for c in range(W):\n if a[r][c] == 'S':\n return r, c\n return -1, -1\n\n\ndef shortest_len(y, x):\n return min(y, H - 1 - y, x, W - 1 - x)\n\n\ndef dfs(y, x, k):\n global need_len\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s318920338', 's491066886', 's401409530'] | [42984.0, 3064.0, 14444.0] | [247.0, 18.0, 280.0] | [1023, 1135, 1130] |
p03725 | u606045429 | 2,000 | 262,144 | Takahashi is locked within a building. This building consists of H×W rooms, arranged in H rows and W columns. We will denote the room at the i-th row and j-th column as (i,j). The state of this room is represented by a character A_{i,j}. If A_{i,j}= `#`, the room is locked and cannot be entered; if A_{i,j}= `.`, the r... | ['from collections import deque\n\nINF = float("inf")\n\nH, W, K = map(int, input().split())\nA = [list(input()) for _ in range(H)]\n\nSi, Sj = (0, 0)\nfor i, a in enumerate(A):\n if "S" in a:\n Si, Sj = (i, a.index("S"))\n break\n\ndist = [[INF] * W for _ in range(H)]\ndist[Si][Sj] = 0\n\nans = INF\n\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s350947711', 's454926951', 's599708295', 's934376850', 's053121967'] | [29744.0, 29112.0, 28992.0, 14672.0, 9196.0] | [2105.0, 2105.0, 2105.0, 324.0, 189.0] | [876, 890, 877, 876, 572] |
p03725 | u608297208 | 2,000 | 262,144 | Takahashi is locked within a building. This building consists of H×W rooms, arranged in H rows and W columns. We will denote the room at the i-th row and j-th column as (i,j). The state of this room is represented by a character A_{i,j}. If A_{i,j}= `#`, the room is locked and cannot be entered; if A_{i,j}= `.`, the r... | ['H,W,K = map(int,input().split())\nHW = [list(input()) for i in range(H)]\nfor i,h in enumerate(HW):\n\tif "S" in h:\n\t\ty = i\n\t\tx = h.index("S")\nA = [(x,y)]\nm = 800\ndef idou(a,b):\n\tX = []\n\tfor i2 in range(4):\n\t\tif i2 == 0:\n\t\t\tt,k = a - 1, b\n\t\telif i2 == 1:\n\t\t\tt,k = a, b - 1\n\t\telif i2 == 2:... | ['Wrong Answer', 'Accepted'] | ['s700714958', 's390614548'] | [71236.0, 11104.0] | [1653.0, 1802.0] | [760, 792] |
p03725 | u766684188 | 2,000 | 262,144 | Takahashi is locked within a building. This building consists of H×W rooms, arranged in H rows and W columns. We will denote the room at the i-th row and j-th column as (i,j). The state of this room is represented by a character A_{i,j}. If A_{i,j}= `#`, the room is locked and cannot be entered; if A_{i,j}= `.`, the r... | ["import sys\ninput=sys.stdin.readline\nsys.setrecursionlimit(10**9)\nfrom collections import deque\nfrom math import ceil\n\ndef dist(h,w,x,y):\n return min(x-1,h-x,y-1,w-y)\n\nh,w,k=map(int,input().split())\ndelta=[[1,0],[0,1],[-1,0],[0,-1]]\nMAP=[]\nA=['#']*(w+2)\nMAP.append(A)\nfor i in range(h):\n s=input()\... | ['Runtime Error', 'Accepted'] | ['s652705083', 's091462498'] | [60728.0, 14324.0] | [1086.0, 285.0] | [807, 747] |
p03725 | u844789719 | 2,000 | 262,144 | Takahashi is locked within a building. This building consists of H×W rooms, arranged in H rows and W columns. We will denote the room at the i-th row and j-th column as (i,j). The state of this room is represented by a character A_{i,j}. If A_{i,j}= `#`, the room is locked and cannot be entered; if A_{i,j}= `.`, the r... | ["import itertools, math\nH, W, K = [int(_) for _ in input().split()]\nA = [list(input()) for _ in range(H)]\nfor i, j in itertools.product(range(H), range(W)):\n if A[i][j] == 'S':\n break\nstack = [[i, j, 0]]\ncand = []\nwhile stack:\n h, w, dist = stack.pop()\n print(h, w, dist)\n A[h][w] = '#'\n ... | ['Wrong Answer', 'Accepted'] | ['s543970644', 's212982441'] | [113060.0, 11248.0] | [2111.0, 1944.0] | [749, 696] |
p03725 | u942033906 | 2,000 | 262,144 | Takahashi is locked within a building. This building consists of H×W rooms, arranged in H rows and W columns. We will denote the room at the i-th row and j-th column as (i,j). The state of this room is represented by a character A_{i,j}. If A_{i,j}= `#`, the room is locked and cannot be entered; if A_{i,j}= `.`, the r... | ['# coding: utf-8\n# Your code here!\nimport heapq as hq\nH,W,K = map(int,input().split())\nA = []\nX,Y=0,1\nstart = None\nfor h in range(H):\n tmp = list(input())\n A.append(tmp)\n if "S" in tmp:\n start = (tmp.index("S"), h)\n\ndef minCost(x,y):\n return min(start[X], W-1-start[X], start[Y], H-1-st... | ['Runtime Error', 'Accepted'] | ['s336813618', 's933264546'] | [14836.0, 14580.0] | [211.0, 404.0] | [966, 1077] |
p03733 | u063979080 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ["def main():\n line=input()\n line=line.split(' ')\n n=line[0]\n t=line[1]\n line=input()\n line=line.split(' ')\n total=0\n for i in range(1,n):\n total+=min(t,line[i]-line[i-1])\n print(total)\n \n\nif __name__=='__main__':\n main()", "def main():\n line = input()\n line... | ['Runtime Error', 'Accepted'] | ['s623371845', 's010742623'] | [19216.0, 19220.0] | [37.0, 162.0] | [259, 301] |
p03733 | u327466606 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N,W = map(int,input().split())\n\nitems = [tuple(map(int,input().split())) for i in range(N)]\n\nfrom collections import defaultdict\ndp = defaultdict(int) # w -> v\ndp[0] = 0\n\nfor w,v in items:\n for tw,tv in list(dp.items()):\n if tw+w <= W:\n dp[tw+w] = max(tv+v, dp[tw+w])\n\nprint(max(dp.values()))', '... | ['Runtime Error', 'Accepted'] | ['s869027219', 's311540733'] | [26964.0, 25200.0] | [65.0, 136.0] | [301, 106] |
p03733 | u337626942 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N, T=map(int, input().split())\na=list(map(int, input().split()))\n\nans=T\n\nfor i in range(N-1):\n space=a[i+1]-a[i]\n if space>=T:\n ans+=T\n else:\n loss=T-space\n ans+=T-loss\n', 'N, T=map(int, input().split())\na=list(map(int, input().split()))\n\nans=T\n\nfor i in range(N-1):\n ... | ['Wrong Answer', 'Accepted'] | ['s029849839', 's623616450'] | [26708.0, 25200.0] | [154.0, 161.0] | [199, 210] |
p03733 | u339199690 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nres = 0\nfor i in range(N - 1):\n res += min(T, t[i + 1] - t[i])\n\nif t[-2] + T <= t[-1]:\n res += T \n\nprint(res)\n', 'N, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nres = 0\nfor i in range(N - 1):\n res += ... | ['Runtime Error', 'Accepted'] | ['s337215973', 's853087188'] | [26836.0, 26708.0] | [151.0, 163.0] | [186, 158] |
p03733 | u373047809 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['n, T, *t = map(int, open(0).read().split())\nprint(sum(min(t[i+1] - t[i], T) for i in range(n)))', 'n, T, *t = map(int, open(0).read().split())\nprint(sum(min(t[i+1] - t[i], T) for i in range(n-1)) + T)'] | ['Runtime Error', 'Accepted'] | ['s428907086', 's655640179'] | [25132.0, 25132.0] | [128.0, 138.0] | [95, 101] |
p03733 | u375616706 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nans = T\n\nfor i in range(1, N):\n ans = min(T, t[i]-t[i-1])\nprint(ans)\n', 'N, T = map(int, input().split())\nt = list(map(int, input().split()))\nprint(T+sum(min(T, t[i]-t[i-1]) for i in range(1, N)))\n'] | ['Wrong Answer', 'Accepted'] | ['s225462328', 's582336360'] | [26836.0, 26836.0] | [138.0, 135.0] | [142, 124] |
p03733 | u417014669 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['# N,T=map(int,input().split())\n# s=list(map(int, input().split()))\nN=9\nT=10\nt=[0,3,5,7,100,110,200,300,311]\nans=0\nt_diff=[t[i+1]-t[i] for i in range(N-1)]\nprint(t_diff)\nfor i in t_diff:\n if i>T:\n ans+=T\n else:\n ans+=i\n\nprint(ans+T)\n\n\n', 'N,T=map(int,input().split())\ns=list(map(in... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s040231635', 's683909633', 's042297984'] | [2940.0, 25200.0, 26836.0] | [17.0, 69.0, 121.0] | [371, 359, 312] |
p03733 | u419963262 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N,T=map(int,input().split())\na=list(map(int,input().split()))\nkeep=0\nans=0\n\nfor i in range(N):\n if keep<=a[i]:\n ans+=T\n keep+=a[i]+T\nprint(ans)\n \n \n ', 'n,t=map(int,input().split())\na=list(map(int,input().split()))\nkeep=0\nans=0\nfor i in range(n):\n if keep<=a[i]:\n ans+=t\n ... | ['Wrong Answer', 'Accepted'] | ['s914852840', 's224251257'] | [26708.0, 26832.0] | [91.0, 155.0] | [198, 227] |
p03733 | u463655976 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N, T = input().split()\n\nf = None\np = None\nans = 0\nfor t in map(int, input().split())\n if f is None:\n f = t\n p = t - f\n\n ans += T\n rest = p + T - (t - f)\n if rest > 0:\n ans -= rest\n\n p = t - f\n\nprint(ans)', 'N, T = map(int, input().split())\n\nf = None\np = None\nans = 0\nfor t in map(in... | ['Runtime Error', 'Accepted'] | ['s347321327', 's280378233'] | [2940.0, 19220.0] | [18.0, 169.0] | [217, 228] |
p03733 | u513434790 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nans = 0\nfor i in range(1,N):\n ans += min(T, t[i] - t[i-1])\n\nprint(ans)', 'N, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nans = T\nfor i in range(1,N):\n ans += min(T, t[i] - t[i-1])\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s890786285', 's931414999'] | [25196.0, 26832.0] | [163.0, 147.0] | [141, 141] |
p03733 | u593567568 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N,T = map(int,input().split())\nA = list(map(int,input().split()))\nLST = []\n\nans = 0\nnxt = -1\nfor a in A:\n if nxt < a:\n nxt = a + T\n ans += T\n \nprint(ans)\n\n', 'N,T = map(int,input().split())\nA = list(map(int,input().split()))\nLST = []\n\nfor a in A:\n LST.append((a,1))\n LST.append((a+T,-1))\n... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s131449504', 's235826919', 's281341158', 's186085676'] | [30840.0, 55104.0, 55108.0, 30824.0] | [85.0, 204.0, 266.0, 130.0] | [163, 331, 333, 143] |
p03733 | u616489782 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N,T = map(int,input().split());\nt = [int(x) for x in input().split()];\n\nend = 0;\nans = 0;\nfor i in range(N) :\n if end > t[i] :\n ans += t[i] + T - end;\n else :\n ans += T;\n end += t[i] + T;\n #print(ans,end);\n\nprint(ans); ', 'N,T = map(int,input().split());\nt = [int(x) for x i... | ['Runtime Error', 'Accepted'] | ['s272269616', 's948292656'] | [8992.0, 30840.0] | [28.0, 135.0] | [249, 244] |
p03733 | u623687794 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['n,t=map(int,input().split())\noyu=list(map(int,input.split()))\ninl=[]\nans=n*t\nfor i in range(n-1):\n inl.append(oyu[i+1]-oyu[i])\nfor i in range(n-1):\n if inl[i]<t:\n ans-=t-inl[i]\nprint(ans)', 'n,t=map(int,input().split())\noyu=list(map(int,input().split()))\ninl=[]\nans=n*t\nfor i in range(n-1):\n inl.ap... | ['Runtime Error', 'Accepted'] | ['s556286943', 's685104009'] | [3060.0, 26708.0] | [18.0, 165.0] | [192, 195] |
p03733 | u669696235 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N,T=map(int,input().split())\nt=list(map(int,input().split()))\n\nfor i in range(0,len(t)-1):\n ans+=min(t[i+1]-t[i],T)\nans+=T\nprint(ans)', 'N,T=map(int,input().split())\nt=list(map(int,input().split()))\n\nans=0\nfor i in range(0,len(t)-1):\n ans+=min(t[i+1]-t[i],T)\nans+=T\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s409724160', 's867231206'] | [26832.0, 26708.0] | [68.0, 151.0] | [140, 146] |
p03733 | u674588203 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N,T=map(int,input().split())\na=list(input().split())\nts=[]\nfor _ in range (len(a)):\n ts.append(int(a[_]))\n\nYU=T\n\nfor i in range(1,N):\n if ts[i]-ts[i-1]<T:\n YU+=T-ts[i]-ts[i-1]\n else:\n YU+=T\nprint (YU)', 'N,T=map(int,input().split())\na=list(input().split())\nts=[]\nfor _ in range (... | ['Wrong Answer', 'Accepted'] | ['s062855441', 's712946422'] | [26860.0, 26864.0] | [196.0, 205.0] | [223, 229] |
p03733 | u760961723 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N, T = map(int,input().split())\nt = list(map(int,input().split()))\nt.append(T)\n\nans = 0\nfor n in range(N):\n ans += min(t[n+1]-t[n],T)\nprint(ans)', 'N, T = map(int,input().split())\nt = list(map(int,input().split()))\nt.append(t[-1]+T)\n\n\nans = 0\nfor n in range(N):\n ans = ans + min(t[n+1]-t[n],T)\n \npri... | ['Wrong Answer', 'Accepted'] | ['s664076294', 's439838023'] | [30720.0, 30784.0] | [138.0, 129.0] | [145, 160] |
p03733 | u782654209 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ["N,T=map(int,input().split(' '))\ntimes=[int(input()) for i in range(N)]\nprint(sum([min(T, times[i+1]-times[i] for i in range(N-1))])+times[-1])", "N,T=map(int,input().split(' '))\ntimes=list(map(int,input().split(' ')))\nprint(sum([min(T, times[i+1]-times[i]) for i in range(N-1)])+T)\n"] | ['Runtime Error', 'Accepted'] | ['s979383972', 's341288634'] | [2940.0, 26832.0] | [17.0, 131.0] | [142, 136] |
p03733 | u798260206 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['n,T = map(int,input().split())\nt = list(map(int,input().split())\nA = [0]*n\n\nfor i in range(n):\n if t[i]>T:\n A[i+1] = A[i] + T\n else:\n A[i+1] = A[i]+ t[i]\nprint(A[n])', 'N, T =map(int, input().split())\nt = list(map(int, input().split()))\nans = T\nfor i in range(1, N):\n if t[i] - t[i-... | ['Runtime Error', 'Accepted'] | ['s836966455', 's568639431'] | [2940.0, 26836.0] | [17.0, 146.0] | [185, 191] |
p03733 | u810735437 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport array\nfrom bisect import *\nfrom collections import *\nimport fractions\nimport heapq\nfrom itertools import *\nimport math\nimport random\nimport re\nimport string\nimport sys\n\nN, T = map(int, input().split())\n\nprev = None\nans = 0\nfor t in map(int, inp... | ['Wrong Answer', 'Accepted'] | ['s969776231', 's468633122'] | [22864.0, 21748.0] | [360.0, 160.0] | [472, 460] |
p03733 | u814986259 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N,T = map(int, input().split())\nprev = 0\nans = 0\nfor i in range(N):\n t = int(input())\n if prev+T <= t:\n ans += T\n else:\n ans += (t - prev)\n prev = t\n\nprint(ans + T)\n ', 'N, T = map(int, input().split())\nt = list(map(int, input().split()))\n\nans = 0\nend = -1\nstart = -1\nfor x in t:\n ... | ['Runtime Error', 'Accepted'] | ['s959373133', 's813704576'] | [6964.0, 30796.0] | [29.0, 89.0] | [181, 257] |
p03733 | u858670323 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['N,T = map(int,input().split())\nt = list(map(int,input().split()))\ncnt=0\nter=-1\nfor x in t:\n if(x>=ter):\n cnt+=1\n ter=x+T\nprint(cnt*T)\n', 'N,T = map(int,input().split())\nt = list(map(int,input().split()))\ncnt=0\nter=0\nfor x in t:\n if(x<=ter):\n cnt+=1\n ter=x+T\nprint(cnt*T)', 'N,T = map(int... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s313568123', 's960421679', 's126796353'] | [26708.0, 25200.0, 25200.0] | [115.0, 109.0, 131.0] | [141, 139, 165] |
p03733 | u859897687 | 2,000 | 262,144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | ['n,t=map(int,input().split())\nk=1000000000\nfor i in map(int,input().split()):\n ans+=min(t,max(i-k,0))\n k=i\nans+=t\nprint(ans)', 'n,t=map(int,input().split())\nans=0\nk=1000000000\nfor i in map(int,input().split()):\n ans+=min(t,max(i-k,0))\n k=i\nans+=t\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s410942717', 's186946726'] | [20856.0, 19220.0] | [35.0, 172.0] | [125, 131] |
p03734 | u077291787 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['# ARC073D - Simple Knapsack (ABC060D)\nfrom itertools import accumulate\n\n\ndef main():\n N, W, *A = map(int, open(0).read().split())\n V, x = [[] for _ in range(4)], A[0] \n for i in range(0, 2 * N, 2):\n w, v = A[i : i + 2]\n V[w - x] += [v]\n for i in range(4):\n V[i] = tuple(acc... | ['Wrong Answer', 'Accepted'] | ['s530354869', 's926975047'] | [3188.0, 3064.0] | [143.0, 143.0] | [847, 831] |
p03734 | u091051505 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['n, w = map(int, input().split())\na = []\nfor _ in range(n):\n w_in, v_in = map(int, input().split())\n a.append([w_in, v_in])\n\ndp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]\nfor j in range(w + 1):\n for i in range(n):\n w_in, v_in = a[i]\n if j + w_in <= w:\n dp[i + 1][j ... | ['Runtime Error', 'Accepted'] | ['s235843105', 's602685968'] | [528792.0, 3188.0] | [2123.0, 188.0] | [557, 745] |
p03734 | u106778233 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['n,w=map(int,input().split())\nWV=[]\nfor i in range(n):\n w,v=map(int,input().split())\n WV.append((w,v))\n\ndp=[0]*(w*2)\nfor w,v in WV:\n for i in range(w+1):\n try: dp[i]=max(dp[i],dp[i-w]+v)\n except:\n dp[i]=dp[i]\n\n\nprint(max(dp[:w+1]))', 'n,w=map(int,input().split())\nfrom h... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s369085461', 's875440971', 's908252969', 's865888595'] | [316916.0, 3064.0, 3064.0, 3944.0] | [2117.0, 19.0, 18.0, 63.0] | [264, 459, 406, 442] |
p03734 | u196697332 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['from itertools import accumulate\nN, W = map(int, input().split())\nw_0, v_0 = map(int, input().split())\nv_list = [[] for _ in range(4)]\nv_list[0].append(v_0)\n\nfor _ in range(n - 1):\n w_in, v_in = map(int, input().split())\n v_list[w_in - w_0].append(v_in)\nv_list = [[0] + list(accumulate(sorted(v, reverse... | ['Runtime Error', 'Accepted'] | ['s564421661', 's528391461'] | [3188.0, 3064.0] | [19.0, 189.0] | [755, 755] |
p03734 | u346812984 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['import sys\nfrom collections import defaultdict\nimport numpy as np\n\nsys.setrecursionlimit(10 ** 6)\nINF = float("inf")\nMOD = 10 ** 9 + 7\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n N, W = map(int, input().split())\n d = defaultdict(list)\n w, v = map(int, input().split()... | ['Runtime Error', 'Accepted'] | ['s755059152', 's325862283'] | [12508.0, 14528.0] | [152.0, 379.0] | [1514, 1513] |
p03734 | u367130284 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['N,W=map(int,input().split())\nfrom collections import*\nd=defaultdict(int)\nd[0]=0\nfor i in range(N):\n w,v=map(int,input().split())\n for k,b in d.copy().items():\n if k+w<=W:\n d[k+w]=max(b,d[k]+v)\nprint(max(d.values()))\n', "from collections import*\nimport functools\nimport sys\ninput=sy... | ['Wrong Answer', 'Accepted'] | ['s785354270', 's024463813'] | [4016.0, 4116.0] | [81.0, 69.0] | [240, 440] |
p03734 | u458617779 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['ints = input().split(" ")\nN = int(ints[0])\nmaxW = int(ints[1])\nints = input().split(" ")\na = int(ints[0])\nb = int(ints[1])\nweight = [a, a+1, a+2, a+3] \nva = [[0,b],[0],[0],[0]]\nfor i in range(1, N):\n\tins = input().split(" ")\n\tw = int(ins[0])\n\tv = int(ins[1])\n\tfor j in range(0, 4):\n\t\tif w == weight[... | ['Wrong Answer', 'Accepted'] | ['s864034470', 's724635535'] | [3188.0, 3188.0] | [306.0, 322.0] | [770, 851] |
p03734 | u540761833 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['from itertools import accumulate\nN,W = map(int,input().split())\nw = [[] for i in range(4)]\nw1,v1 = map(int,input().split())\nw[0].append(v1)\nfor i in range(N-1):\n wi,vi = map(int,input().split())\n w[wi-w1].append(vi)\nnum = []\nfor i in range(4):\n w[i].sort(reverse= 1)\n w[i] = [0]+list(accumulate(... | ['Runtime Error', 'Accepted'] | ['s460025334', 's984435564'] | [3064.0, 3064.0] | [240.0, 302.0] | [674, 675] |
p03734 | u543954314 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['n, w = map(int, input().split())\ndi = dict()\nm = 0\nfor _ in range(n):\n x,y = map(int, input().split())\n if x not in di:\n di[x] = []\n di[x].append(y)\nfor i in di:\n di[i].sort(reverse=True)\na,b,c,d = di.keys()\nfor i in range(len(di[a])):\n for j in range(len(di[b])):\n for k in range(len(di[c])):\... | ['Runtime Error', 'Accepted'] | ['s084565987', 's077467784'] | [3064.0, 3064.0] | [454.0, 466.0] | [467, 535] |
p03734 | u545368057 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['N,W = map(int, input().split())\nws = []\nvs = []\nfor i in range(N):\n w,v = map(int, input().split())\n ws.append(w)\n vs.append(v)\nws_m = [w-ws[0] for w in ws]\n\n\ndp = [[[-1]*(3*N+1) for i in range(N+1)] for j in range(N+1)]\ndp[0][0][0] = 0\nfor i,(w,v) in enumerate(zip(ws_m,vs)):\n for n in range... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s330883483', 's458167801', 's638408595', 's152948879'] | [52836.0, 27764.0, 29812.0, 31720.0] | [1201.0, 89.0, 614.0, 549.0] | [1114, 931, 916, 832] |
p03734 | u561083515 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['N,W = map(int, input().split())\nWV = [[int(i) for i in input().split()] for _ in range(N)]\n\nMINW = WV[0][0]\n\nW0,W1,W2,W3 = [],[],[],[]\nfor w,v in WV:\n if w == MINW: W0.append(v)\n elif w == MINW + 1: W1.append(v)\n elif w == MINW + 2: W2.append(v)\n elif w == MINW + 3: W3.append(v)\n\nW0.sort(rever... | ['Wrong Answer', 'Accepted'] | ['s754993084', 's028055314'] | [3188.0, 3188.0] | [371.0, 379.0] | [1113, 1113] |
p03734 | u645250356 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ["from collections import Counter,defaultdict,deque\nfrom heapq import heappop,heappush\nfrom bisect import bisect_left,bisect_right \nimport sys,math,itertools,fractions,pprint\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\nINF = float('inf')\ndef inp(): return int(sys.stdin.readline())\ndef inpl(): return list(map(int... | ['Wrong Answer', 'Accepted'] | ['s496909592', 's693691282'] | [10424.0, 10460.0] | [568.0, 559.0] | [966, 985] |
p03734 | u803848678 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['n,w = map(int, input().split())\nw4 = [[] for i in range(4)]\nw1 = None\nfor i in range(n):\n ws, vs = map(int,input().split())\n if i == 0:\n w1 = ws\n ws -= w1\n w4[ws].append(vs)\n\nfor i in range(4):\n w4[i].sort(reverse=True)\n tmp = [0]\n for j in w4[i]:\n tmp.append(tmp[-1]+j... | ['Wrong Answer', 'Accepted'] | ['s539724490', 's043185881'] | [5308.0, 3064.0] | [642.0, 296.0] | [637, 602] |
p03734 | u814986259 | 2,000 | 262,144 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | ['import collections\nN, W = map(int, input().split())\nwv = collections.defaultdict(list)\nw = 0\nfor i in range(N):\n a, b = map(int, input().split())\n wv[a].append(b)\n if i == 0:\n w = a\ns = [[0]*(len(wv[w+i])+1) for i in range(4)]\n\nfor i in range(4):\n wv[w + i].sort(reverse=True)\n for j... | ['Runtime Error', 'Accepted'] | ['s513017333', 's067539803'] | [3316.0, 3316.0] | [34.0, 35.0] | [939, 941] |
p03735 | u033407970 | 2,000 | 262,144 | There are N bags, each containing two white balls. The i-th box contains two balls with integers x_i and y_i written on them, respectively. For each of these bags, you will paint one of the balls red, and paint the other blue. Afterwards, the 2N balls will be classified according to color. Then, we will define the f... | ["n = int(input())\nx = []\ny = []\nxy = []\nmaxlist = []\nminlist = []\namax = 0\namin = 10**10\ncase1 = 0\ncase2 = 0\nfor i in range(n):\n store = [int(j) for j in input().split(' ')]\n if store[0] < store[1]:\n store[0], store[1] = store[1], store[0]\n if store[0] == amax:\n maxlist.append(i)\... | ['Wrong Answer', 'Accepted'] | ['s491169721', 's152212476'] | [51440.0, 48184.0] | [1763.0, 1277.0] | [1153, 1219] |
p03735 | u327466606 | 2,000 | 262,144 | There are N bags, each containing two white balls. The i-th box contains two balls with integers x_i and y_i written on them, respectively. For each of these bags, you will paint one of the balls red, and paint the other blue. Afterwards, the 2N balls will be classified according to color. Then, we will define the f... | ["N = int(input())\nballs = sorted(tuple(sorted(map(int,input().split()))) for i in range(N))\n\n# Rmin=MIN, Bmax=MAX\nmaxmin = balls[-1][0]\nminmin = balls[0][0]\nmaxmax = max(b[1] for b in balls)\nminmax = min(b[1] for b in balls)\n\nv1 = (maxmin-minmin)*(maxmax-minmax)\n\n# Rmin=MIN, Rmax=MAX\nbest = float('inf')\nc... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s501342017', 's714699459', 's991255121', 's937348769'] | [30944.0, 32168.0, 32620.0, 30956.0] | [1208.0, 1152.0, 1193.0, 1136.0] | [446, 476, 476, 514] |
p03735 | u667024514 | 2,000 | 262,144 | There are N bags, each containing two white balls. The i-th box contains two balls with integers x_i and y_i written on them, respectively. For each of these bags, you will paint one of the balls red, and paint the other blue. Afterwards, the 2N balls will be classified according to color. Then, we will define the f... | ['n = int(input())\nlis = []\nli = []\nMAX = []\nMIN = []\nans = []\nfor i in range(n):\n a,b = map(int,input().split())\n MAX.append(max(a,b))\n MIN.append(min(a,b))\n\nans.append((max(MAX)-min(MAX)) * (max(MIN)-min(MIN)))\n\n # print(MAX,MIN)\n\nlis.append(MAX[MAX.index(max(MAX))])\nli.append(MIN[MAX.index(max(MA... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s479225353', 's560877093', 's648968705', 's460237371'] | [18996.0, 20948.0, 18980.0, 18968.0] | [984.0, 974.0, 708.0, 962.0] | [917, 1081, 219, 1141] |
p03735 | u902500155 | 2,000 | 262,144 | There are N bags, each containing two white balls. The i-th box contains two balls with integers x_i and y_i written on them, respectively. For each of these bags, you will paint one of the balls red, and paint the other blue. Afterwards, the 2N balls will be classified according to color. Then, we will define the f... | ['# coding: utf-8\n\n\n\nimport heapq\nN = int(input())\n\nRmax = 0\nRmin = 1000000001\nBmax = 0\nBmin = 1000000001\n\ndata = sorted([sorted(list(map(int, input().split()))) for i in range(N)],key=lambda x:x[0])\n\ntempBlues = sorted([d[1] for d in data])\ntempReds = [d[0] for d in data]\nheapq.heapify(tempReds)\nprint... | ['Wrong Answer', 'Accepted'] | ['s143186583', 's354211478'] | [62788.0, 57128.0] | [1474.0, 1287.0] | [876, 860] |
p03735 | u923270446 | 2,000 | 262,144 | There are N bags, each containing two white balls. The i-th box contains two balls with integers x_i and y_i written on them, respectively. For each of these bags, you will paint one of the balls red, and paint the other blue. Afterwards, the 2N balls will be classified according to color. Then, we will define the f... | ['n = int(input())\nxy = [list(map(int, input().split())) for i in range(n)]\namin, amax, bmin, bmax = float("inf"), 0, float("inf"), 0\nfor i, j in xy:\n amin = min(amin, min(i, j))\n amax = max(amax, min(i, j))\n bmin = min(bmin, max(i, j))\n bmax = max(bmax, max(i, j))\nprint((amax - amin) * (bmax - bmin... | ['Wrong Answer', 'Accepted'] | ['s478195848', 's378627377'] | [45436.0, 43044.0] | [687.0, 1100.0] | [312, 526] |
p03745 | u036104576 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nfrom heapq import heappop, heappush\nfrom collections import defaultdict\nfrom collections import Counter\nfrom collections import deque\nfrom itertools import permutations\nsys.setrecursionlimit(10 ** 7)\n \nINF = 10 ** 18\nMOD = 10 ** 9 +... | ['Wrong Answer', 'Accepted'] | ['s845728961', 's059413184'] | [20572.0, 20520.0] | [88.0, 97.0] | [832, 781] |
p03745 | u048176319 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\nl = list(map(int, input().split()))\n\nl1 = list()\nfor i in range(1, n):\n if l[i] > l[i-1]:\n l1.append(1)\n elif l[i] == l[i-1]:\n l1.append(0)\n else:\n l1.append(-1)\n\nprint(l1)\nans = 0\n\nfor i in range(n-1):\n if l1[i] != 0:\n c = l1[i]\n break... | ['Wrong Answer', 'Accepted'] | ['s395028276', 's984983864'] | [14480.0, 14252.0] | [112.0, 101.0] | [464, 270] |
p03745 | u062189367 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\n\nA = [int(_) for _ in input().split()]\n\n\nfor i in range(0, N):\n if A[0]>A[i]:\n flag = -1\n break\n\n if A[0]<A[i]:\n flag=1\n break\n\n\ncount=1\nfor j in range(0,N-1):\n if A[j]>A[j+1] and flag==1:\n count+=1\n flag=0\n\n if A[j]>A[j+1] an... | ['Wrong Answer', 'Accepted'] | ['s371785526', 's598376076'] | [14480.0, 14224.0] | [130.0, 84.0] | [494, 359] |
p03745 | u072717685 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ["import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nfrom collections import deque\ndef main():\n n, *a = map(int, read().split())\n a = deque(a)\n r = 1\n flag = False\n muki = 0\n char1 = a.popleft()\n while a:\n char = a.popleft()\n if flag:\n if muki ==... | ['Wrong Answer', 'Accepted'] | ['s693600008', 's314736135'] | [20636.0, 20592.0] | [61.0, 60.0] | [675, 809] |
p03745 | u075304271 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['def solve():\n n = int(input())\n a = list(map(int, input().split()))\n state, cut = -1, 0\n for i in range(n-1):\n #print(i, cut, state)\n if a[i] < a[i+1]:\n if state != 1:\n cut += 1\n state = 1\n else:\n if state != 0:\n cut += 1\n state = 0\n return 0\n \nif __name... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s636555816', 's831779498', 's774860765'] | [14224.0, 14252.0, 14252.0] | [55.0, 65.0, 64.0] | [330, 311, 311] |
p03745 | u077337864 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\nalist = list(map(int, input().split()))\n\npreva = None\nmode = 0 \nc = 0\nfor a in alist:\n print(mode, preva)\n if preva is None:\n preva = a\n elif mode == 0:\n if preva == a:\n continue\n if preva > a:\n mode = 2\n else:\n mode = 1\n preva = a\n elif mode == 1 ... | ['Wrong Answer', 'Accepted'] | ['s348727782', 's854750310'] | [14228.0, 14252.0] | [185.0, 70.0] | [500, 480] |
p03745 | u084411645 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['p = -1\nxp = -1\nans = 0\ninput()\nfor i in range(input().split(" ")):\n i = int(i)\n if i == p: continue\n if p != -1:\n x = p < i\n if xp != -1\n ans += x != xp\n xp = x\n p = i', 'p = -1\nxp = -1\nans = 1\ninput()\nfor i in input().split(" "):\n i = int(i)\n if i == p: continue\n if p != -1:\n... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s269304935', 's597432737', 's399870084'] | [8980.0, 16688.0, 16868.0] | [24.0, 106.0, 84.0] | [185, 259, 246] |
p03745 | u105302073 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = [int(i) for i in input().split()]\nret = 1\nup, down = False, False\nfor i in range(N - 1):\n if A[i] < A[i + 1]:\n up = True\n elif A[i] > A[i + 1]:\n down = True\n print(i, A[i], A[i + 1], up, down)\n if up and down:\n ret += 1\n up, false = False, False... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s118433909', 's899098573', 's886348801'] | [14252.0, 14252.0, 14224.0] | [370.0, 82.0, 84.0] | [318, 277, 285] |
p03745 | u130900604 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\na=list(map(int,input().split()))\n\nd=False\nu=False\n\ncnt=0\n\nfor i in range(0,n-1):\n l=a[i];r=a[i+1]\n if l<r:u=True\n elif l>r:d=True\n else:pass \n print((u,d))\n if u and d:\n cnt+=1\n u=False;d=False\nprint(cnt+1)\n ', 'n=int(input())\na=list(map(int,input().split()))\n\nd=False... | ['Wrong Answer', 'Accepted'] | ['s296477166', 's327683456'] | [14224.0, 14252.0] | [177.0, 82.0] | [263, 239] |
p03745 | u131881594 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n=int(input())\na=list(map(int,input().split()))\ni,ans=0,0\nwhile i<n-1:\n if a[i]<=a[i+1]:\n while i<n-1 and a[i]<=a[i+1]: i+=1\n ans+=1\n elif a[i]>=a[i+1]:\n while i<n-1 and a[i]>=a[i+1]: i+=1\n ans+=1\n i+=1\n if i==n-1: ans+=1\nprint(ans)', 'n=int(input())\na=list(map(int... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s470822470', 's562366356', 's911988424', 's919640079', 's474803053'] | [20128.0, 20080.0, 20048.0, 19944.0, 20316.0] | [84.0, 100.0, 81.0, 84.0, 92.0] | [272, 351, 315, 292, 328] |
p03745 | u143509139 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int,input().split()))\nans1 = 1\nm = False\nfor i in range(n - 1):\n if a[i] == a[i + 1]:\n pass\n elif a[i] > a[i + 1] ^ m:\n ans1 += 1\n m ^= True\nans2 = 1\nm = True\nfor i in range(n - 1):\n if a[i] == a[i + 1]:\n pass\n elif a[i] < a[i + 1] ^ m:\n ans2 += 1\n ... | ['Wrong Answer', 'Accepted'] | ['s419415040', 's903240314'] | [14252.0, 14224.0] | [128.0, 119.0] | [333, 276] |
p03745 | u156815136 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['#from statistics import median\nimport collections\n\n#from fractions import gcd\n#from itertools import combinations # (string,3) 3回\n#from collections import deque\n#from collections import deque,defaultdict\n\n#\n# d = m - k[i] - k[j]\n\n#\n#\n#\n\n#\n#\n\nimport sys\nsys.setrecursionlimit(10000000)\nmod = 10**... | ['Runtime Error', 'Accepted'] | ['s468741714', 's396347089'] | [3060.0, 14636.0] | [17.0, 102.0] | [1166, 1166] |
p03745 | u166340293 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N=int(input())\ncount=1\nsize=1\np=list(map(int,input().split()))\nq=[p[0]]\n\nj=0\nwhile True:\n if j>=N-2:\n break\n while (q[j]-q[j+1])*(q[j+1]-q[j+2])>=0:\n j+=1\n count+=1\n j+=2\nprint(count)', 'N=int(input())\ncount=1\nsize=1\np=list(map(int,input().split()))\nq=[p[0]]\nfor i in range (1,N):\n if p[... | ['Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s218464300', 's885405217', 's381894980'] | [14252.0, 14252.0, 14252.0] | [45.0, 2104.0, 140.0] | [193, 303, 316] |
p03745 | u173575445 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['import numpy as np\nN = int(input())\nA = list(map(int,input().split()))\ntmp = A[0]\nstate = 0\nM = 1\nfor i in range(N):\n if state == 0:\n if A[i] >= tmp :\n state = 1\n else:\n state = 2\n elif state == 1:\n if A[i] < tmp :\n state = 0\n M += ... | ['Wrong Answer', 'Accepted'] | ['s368730608', 's779137502'] | [23136.0, 23096.0] | [1616.0, 1722.0] | [405, 415] |
p03745 | u177040005 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['N = int(input())\nA = list(map(int,input().split()))\n\nans = 1\npm = 1\n\ni = 0\n\nwhile i < N:\n\n if i == 0:\n if A[i] <= A[i+1]:\n pm = 1\n else:\n pm = -1\n\n i += 1\n else:\n if pm*(A[i] - A[i-1]) >= 0:\n i += 1\n else:\n i += ... | ['Runtime Error', 'Accepted'] | ['s610738976', 's089598151'] | [14252.0, 14480.0] | [99.0, 104.0] | [500, 753] |
p03745 | u190079347 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int,input().split()))\nstate = 1\ncount = 1\ntmp = a[0]\nfor i in a:\n if i == tmp:\n tmp = i\n elif i > tmp:\n state = 1\n break\n else:\n state = 0\n break\ntmp = a[0]\nfor i in a:\n if i == tmp:\n pass\n elif i > tmp:\n if state == 1:\n pass\n else:\... | ['Wrong Answer', 'Accepted'] | ['s395765893', 's244964436'] | [14224.0, 14252.0] | [67.0, 69.0] | [433, 391] |
p03745 | u191423660 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['def solve(): \n\n N = int(input())\n A = list(map(int, input().split()))\n\n i = 0\n result = 0\n\n while i < n:\n while i+1 < n and A[i] == A[i+1]:\n i += 1\n if i+1 < n and A[i] < A[i+1]:\n while i+1 < n and A[i] <= A[i+1]:\n i += 1\n elif i+1... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s285558888', 's633106503', 's963521255'] | [20288.0, 20344.0, 20316.0] | [48.0, 48.0, 75.0] | [504, 504, 504] |
p03745 | u197300260 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['# _*_ coding:utf-8 _*_\n\n\n\ndef solveProblem(allNumber,aSequence):\n\tflag="Flat"\n\tcount = 1\n\tfor i in range(allNumber-1):\n\t\tdiff = aSequence[i+1]-aSequence[i]\n\t\tif flag == "Plus":\n\t\t\tif diff < 0:\n\t\t\t\tflag=="Flat"\n\t\t\t\tcount=count+1\n\t\telif flag == "Minus":\n\t\t\tif diff > 0:\n\t\t\t\tflag... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s108444685', 's436201220', 's551243376', 's617083683', 's987756333', 's282438822'] | [14252.0, 14252.0, 14224.0, 14252.0, 14252.0, 14228.0] | [59.0, 59.0, 59.0, 61.0, 63.0, 63.0] | [653, 679, 662, 697, 654, 661] |
p03745 | u203898698 | 2,000 | 262,144 | You are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays do you need to divide A into? | ['n = int(input())\na = list(map(int, input().split()))\ncnt = 1\ni = -1\nflg = True\nwhile True:\n i += 1\n if i >= n-1:\n break\n if a[i] < a[i+1]:\n flg = True\n elif a[i] > a[i+1]:\n flg = False\n else:\n continue\n for k in range(i, n-1):\n if (flg and a[k] > a[k+1]) or ((not flg) and a[k] < a... | ['Wrong Answer', 'Accepted'] | ['s776655396', 's884758366'] | [14252.0, 14224.0] | [2104.0, 74.0] | [348, 301] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.