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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03805 | u765590009 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def dfs(place,number,checkedList,path):\n checkedList[place] = 1\n if sum(checked) == number:\n return 1\n pathNumber = 0\n for i in path[place]:\n if checkedList[i] == 1:\n continue\n pathNumber += dfs(i,number,checkedList,path)\n checkedList[i] = 0\n return pathNumber \n\nn, m = map(int, inpu... | ['Wrong Answer', 'Accepted'] | ['s342424573', 's628744245'] | [9124.0, 9076.0] | [33.0, 33.0] | [516, 517] |
p03805 | u769852547 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n, m = map(int, input().split())\nab = [ list(map(int, input().split())) for _ in range(m) ]\n\ngraph = [ [False] * 8 for _ in range(8) ]\nvisited = [False] * n\n\ndef dfs(a, N, visited):\n finish = True\n for i in range(N):\n if not visited[i]:\n finish = False\n if finish:\n return... | ['Runtime Error', 'Accepted'] | ['s288863898', 's452739037'] | [3064.0, 3064.0] | [18.0, 34.0] | [632, 647] |
p03805 | u780962115 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\nuselist=[]\nfor _ in range(m):\n ad=list(map(int,input().split()))\n uselist.append(ad)\ncnt=0\nfor i in itertools.permutations(range(1,n+1)):\n if i[0]==1:\n flag=True\n for j in range(n-1):\n if [i[j],i[j+1]] not in uselist and [i[j+1], i[j]] not in u... | ['Runtime Error', 'Accepted'] | ['s601057728', 's699231124'] | [3064.0, 8052.0] | [18.0, 76.0] | [517, 522] |
p03805 | u785578220 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\n\nn,m=map(int,input().split())\npath=set()\nfor _ in range(m):\n u,v=map(int,input().split())\n path|={(u-1,v-1),(v-1,u-1)}\ns = 0\nfor i in permutations(range(n)):\n s+=(all((h,j) in path for h,j in zip(i[1:],i))) if i[0] ==0\nprint(s)', '\n#########\n#thiking Face\nfrom ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s328568564', 's339701210', 's403240898', 's399706532'] | [2940.0, 3060.0, 3060.0, 3064.0] | [17.0, 18.0, 18.0, 31.0] | [271, 292, 296, 283] |
p03805 | u787059958 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from collections import defaultdict, deque\nN, M = map(int, input().split())\n\nd = defaultdict(list)\nfor _ in range(M):\n a, b = map(int, input().split())\n d[a].append(b)\n d[b].append(a)\n\nprint(d)\n\n\ndef dfs(n, check):\n check[n - 1] = True\n for i in range(len(d[n])):\n if not check[d[n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s049497912', 's746411143', 's677782453'] | [9408.0, 3572.0, 9436.0] | [28.0, 30.0, 43.0] | [576, 440, 466] |
p03805 | u787449825 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\n\nn, m = map(int, input().split())\nans = 0\n\npath = [[False]*n for i in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n path[a][b] = True\n path[b][a] = True\n\nfor i in permutations(range(n), n):\n if i[0] == 0:\n for... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s244942967', 's568000202', 's581598895', 's201599976'] | [3064.0, 2940.0, 2940.0, 3064.0] | [25.0, 18.0, 17.0, 32.0] | [463, 476, 481, 464] |
p03805 | u809457879 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from collections import deque\nN,M=map(int,input().split())\nl=[[] for _ in range(N)]\nfor _ in range(M):\n x,y=map(int,input().split())\n l[x-1].append(y-1)\n l[y-1].append(x-1)\n\ndef dfs(N,l):\n stack=deque()\n check=[] \n ans=0\n s=0\n t=0\n for i in l[0]:\n stack.append(i)\n check.append(0)\n while... | ['Wrong Answer', 'Accepted'] | ['s997401439', 's545350027'] | [3316.0, 3064.0] | [21.0, 60.0] | [582, 406] |
p03805 | u813450984 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n, m = map(int, input().split())\nl = []\ncombo = []\nfor i in range(max(n, m) + 1):\n l.append([])\ndef dfs(path, now):\n if len(set(path)) == n and not path in combo:\n combo.append(path)\n return\n\n for i in l[now]:\n if not i in path:\n temp = path[:]\n temp.append(i)\n dfs(temp, i)\n\... | ['Runtime Error', 'Accepted'] | ['s102264496', 's137829404'] | [3064.0, 3832.0] | [17.0, 433.0] | [1050, 526] |
p03805 | u814781830 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def dfs(v, N, visited, ret, route):\n if sum(visited) == N:\n return 1\n \n visitable = []\n for pair in route:\n if v in pair:\n if visited[pair[0]] == 0:\n visitable.append(pair[0])\n elif visited[pair[1]] == 0:\n visitable.append(pair[1]... | ['Wrong Answer', 'Accepted'] | ['s351114008', 's611678975'] | [3064.0, 3064.0] | [43.0, 44.0] | [674, 680] |
p03805 | u814986259 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['\nN,M=map(int,input().split())\nab=[[0]*M]*M\na=[0]*M\nb=[0]*M\n\nreached=[0]*M\n\nfor i in range(M):\n a[i],b[i]=map(int,input().split())\n ab[a[i]][b[i]]=1\n ab[b[i]][a[i]]=1\n \ndef rootCount(pos,N,reached):\n count=0\n prev=0\n for i in range(N):\n if ab[pos][i]==0:\n continue\n if reached[i]=... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s585595695', 's822907973', 's021340002'] | [3064.0, 3064.0, 3064.0] | [34.0, 18.0, 29.0] | [457, 428, 515] |
p03805 | u820351940 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n, m = map(int, input().split())\nab = [list(map(int, input().split())) for x in range(m)]\n\nabmap = {}\nfor a, b in ab:\n atarget = abmap.get(a)\n if atarget == None:\n abmap[a] = []\n abmap[a].append(b)\n\n btarget = abmap.get(b)\n if btarget == None:\n abmap[b] = []\n abmap[b].appe... | ['Runtime Error', 'Accepted'] | ['s899036268', 's793118935'] | [5236.0, 5236.0] | [42.0, 45.0] | [653, 659] |
p03805 | u822961851 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\ndef resolve():\n n, m = map(int, input().split())\n S = [[0]*m for i in range(m)]\n\n for i in range(m):\n a, b = map(int, input().split())\n S[a-1][b-1] = 1\n S[b-1][a-1] = 1\n\n ans = 0\n for p in itertools.permutations(range(n)):\n if p[0] != 0:\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s135877112', 's723143389', 's732895070', 's980777426'] | [3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 18.0, 19.0, 24.0] | [465, 492, 463, 473] |
p03805 | u823458368 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import numpy as np\nnmax = 8\ngraph = np.array([[False]*nmax]*nmax)\n\nn, m = map(int, input().split())\nfor i in range(m):\n a, b = map(int, input().split())\n graph[a-1][b-1] = graph[b-1][a-1] = True\n \nvisited = [False]*nmax\nvisited[0] = True\n\ndef dfs(v, n, visited): \n all_visited = True\n for ... | ['Wrong Answer', 'Accepted'] | ['s625782351', 's592328222'] | [12520.0, 12504.0] | [382.0, 388.0] | [932, 942] |
p03805 | u830054172 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N, M = list(map(int, input().split()))\n\nans = 0\n\ndef dfs(n, visited):\n global ans\n visited.append(n)\n if len(visited) == N:\n ans += 1\n else:\n for i in l[n-1]:\n print("i=", i)\n if i not in visited:\n dfs(i, visited)\n visited.remove(n)\n\nl ... | ['Wrong Answer', 'Accepted'] | ['s408715409', 's290826704'] | [3956.0, 3064.0] | [78.0, 28.0] | [457, 421] |
p03805 | u839537730 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N, M = list(map(int, input().split(" ")))\n\ngraph = [list() for i in range(N+1)]\n\nfor i in range(M):\n a, b = list(map(int, input().split(" ")))\n graph[a].append(b)\n graph[b].append(a)\n \ndef DFS(node, prev, visited):\n visited.append(node)\n if len(visited) == N:\n return 1\n \n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s082044547', 's148833629', 's646123245', 's145033161'] | [3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 28.0] | [523, 523, 523, 526] |
p03805 | u840310460 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M = map(int, input().split())\nL = [list(map(int,input().split())) for _ in range(M)]\ngraph = [[False] * (N + 1) for _ in range(N + 1)]\n#%%\n\nfor i in L:\n graph[i[0]][i[1]] = True\n graph[i[1]][i[0]] = True\n\ngraph[0][1] = True\ngraph[1][0] = True\n#%%\nans = 0\nfor i in permutations(range(1, N + 1)):\n ... | ['Runtime Error', 'Accepted'] | ['s515633621', 's495203706'] | [3064.0, 8052.0] | [18.0, 38.0] | [459, 534] |
p03805 | u840974625 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nimport copy\n\nn, m = map(int, input().split())\nList = [list(map(int, input().split())) for i in range(m)]\ncheck = [0 for _ in range(n)]\nres = 0\n\ndef all_1(res_list):\n leng = len(res_list)\n for i in range(leng):\n if res_list[i] == 0:\n return False\n return True\n\... | ['Wrong Answer', 'Accepted'] | ['s342888814', 's263847882'] | [3440.0, 3568.0] | [24.0, 855.0] | [616, 715] |
p03805 | u841111730 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['\n\n\nN,M = map(int,input().split())\n\ngraph = [ ]\nfor _ in range(N+1):\n graph.append([])\n\nfor _ in range(M):\n a,b = map(int,input().split())\n graph[a].append(b)\n graph[b].append(a)\n\nvisited = []\nfor _ in range(N+1):\n visited.append(False)\n\n\ndef dfs(dep,cur):\n global N,visited,graph\... | ['Runtime Error', 'Accepted'] | ['s483219666', 's696591698'] | [9076.0, 9208.0] | [24.0, 29.0] | [599, 571] |
p03805 | u841623074 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["def bit_DP(N.Adj):\n dp=[[0]*N for i in range(1<<N)]\n dp[1][0]=1\n for S in range(1<<N):\n for v in range(N):\n if (S&(1<<v))==0:\n continue\n sub=S^(1<<v)\n \n for u in range(N):\n if (sub&(1<<u)) and (Adj[u][v]):\n ... | ['Runtime Error', 'Accepted'] | ['s448684158', 's569813610'] | [2940.0, 3064.0] | [17.0, 20.0] | [660, 660] |
p03805 | u845620905 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nn, m = map(int, input().split())\nd = [[0 for i in range(n)] for j in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n a-=1\n b-=1\n d[a][b] = 1\n d[b][a] = 1\nans = 0\n\nnums = [i for i in range(n)]\nfor num in itertools.permutations(nums):\n if(num[0] != 0):\n ... | ['Wrong Answer', 'Accepted'] | ['s899611132', 's097490413'] | [3064.0, 3188.0] | [24.0, 31.0] | [448, 486] |
p03805 | u845650912 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M = map(int,input().split())\n\nA = [list(map(int, input().split())) for i in range(M)]\n\ngraph_data = [[0] * N for i in range(N)]\n\nfor i in range(M):\n if A[i][0] > A[i][1]: A[i][0], A[i][1] = A[i][1], A[i][0]\n graph_data[A[i][0]-1][A[i][1]-1] = graph_data[A[i][1]-1][A[i][0]-1] = 1\n \nvisited = [Fal... | ['Runtime Error', 'Accepted'] | ['s720303112', 's301161629'] | [3192.0, 3064.0] | [18.0, 36.0] | [638, 639] |
p03805 | u858523893 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\n\nn, m = map(int, input().split())\npaths = set()\n\nfor i in range(n) :\n _a, _b = map(int, input().split())\n paths.add((_a, _b))\n paths.add((_b, _a))\n \n# print(sum(all(s in paths for s in zip((1,) + p, p)) for p in permutations(range(2, n + 1))))\n\n', 'from itert... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s672372895', 's708581512', 's754752454', 's087150706'] | [3060.0, 3060.0, 3060.0, 3064.0] | [17.0, 18.0, 17.0, 35.0] | [292, 164, 296, 942] |
p03805 | u863442865 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["res = 0\ndef main():\n import sys\n #input = sys.stdin.readline\n sys.setrecursionlimit(10000000)\n from collections import Counter, deque\n #from collections import defaultdict\n from itertools import combinations\n #from itertools import accumulate, product, permutations\n from math import f... | ['Runtime Error', 'Accepted'] | ['s503713212', 's801780613'] | [3060.0, 3316.0] | [18.0, 27.0] | [884, 886] |
p03805 | u872887731 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['def dfs(v,N,visit_list):\n\n all_visit = True\n\n for i in range(N):\n if visit_list[i] == False:\n all_visit = False\n \n if all_visit:\n return 1\n\n ret = 0\n\n for k in range(N):\n if Graph[v][k] == False:\n continue\n if visit_list[k] :\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s191065026', 's283573263', 's584845732'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 37.0] | [527, 735, 733] |
p03805 | u879302598 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\n\ndef f(n, m, uu, vv):\n a = [[0] * n for _ in range(n)]\n for u, v in zip(uu, vv):\n a[u][v] = 1\n a[v][u] = 1\n res = 0\n for p in permutations(range(n)):\n if p[0] != 0:\n break\n ok = True\n for i in range(n-1):。\n ... | ['Runtime Error', 'Accepted'] | ['s380031187', 's480640257'] | [3064.0, 3064.0] | [18.0, 24.0] | [622, 637] |
p03805 | u879870653 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N,M = map(int,input().split())\n\nL = [[] 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 \n L[a].append(b)\n L[b].append(a)\n\nP = permutations([0] + [i for i in range(1,N)])\n\nans = 0\n\nfor perm in P :\n visited = [0 for i in range(N)]\n visit... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s048574096', 's476909995', 's101407806'] | [3064.0, 3064.0, 3572.0] | [17.0, 18.0, 28.0] | [556, 553, 448] |
p03805 | u880128069 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\nn,m = map(int,input().split())\n\npath = [[False] * n 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 path[a][b] = True\n path[b][a] = True\n \nans = 0\n\n\nfor i in itertools.permutations(range(n),n):\n \n if i[0] == 0:\n \n for j in ran... | ['Runtime Error', 'Accepted'] | ['s374202184', 's919411007'] | [3064.0, 3064.0] | [18.0, 35.0] | [665, 672] |
p03805 | u884323674 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N, M = map(int, input().split())\nab = [[int(i) for i in input().split()] for j in range(M)]\n\nG = [[] for i in range(N)]\nfor i in range(M):\n a, b = ab[i]\n G[a-1].append(b-1)\n G[b-1].append(a-1)\n\ndef rec(v, memo):\n memo[v] = 1\n\n if -1 not in memo:\n memo[v] -1\n return 1\n\n ... | ['Wrong Answer', 'Accepted'] | ['s848375037', 's602298193'] | [3064.0, 3064.0] | [17.0, 29.0] | [491, 470] |
p03805 | u886655280 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ["\n\nimport copy\n\n\nN, M = map(int, input().split())\n\n\n\nGraph_list = [[] for i in range(N)]\n\n\nfor i in range(M):\n a, b = map(int, input().split())\n a += -1\n b += -1\n\n \n Graph_list[a].append(b)\n Graph_list[b].append(a)\n\nans_count = 0\nthrowgh_point_list = [-1 for i in range(N)]\n\nde... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s317121352', 's417975798', 's589220149', 's009495814'] | [3700.0, 3444.0, 3572.0, 3444.0] | [2104.0, 22.0, 2104.0, 29.0] | [1487, 1125, 1409, 1128] |
p03805 | u905582793 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\nn,m=map(int,input().split())\nside=[[] for _ in range(n+1)]\nfor i in range(m):\n a,b=map(int,input().split())\n side[a].append(b)\n side[b].append(a)\nroute=[i for i in range(2,n+1)]\nans=0\nfor x in permutations(route):\n x=(1)+x\n for i in range(n-1):\n if x[i+1] not in ... | ['Runtime Error', 'Accepted'] | ['s586032548', 's118473191'] | [3064.0, 3064.0] | [18.0, 31.0] | [359, 377] |
p03805 | u912862653 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\ndef is_edge_exists(node1, node2, edges):\n\tfor edge in edges:\n\t\tif node1 in edge and node2 in edge:\n\t\t\treturn True\n\treturn False\n\ndef route_count(route, edges):\n\tif route[0]==1:\n\t\treturn 0\n\tfor i in range(len(route)-1):\n\t\tif not is_edge_exists(route[i], route[i+1], edges):\n\... | ['Wrong Answer', 'Accepted'] | ['s906275437', 's952388313'] | [10100.0, 8052.0] | [301.0, 78.0] | [558, 558] |
p03805 | u934868410 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from collections import defaultdict\nimport itertools\n\nn,m = map(int,input().split())\ne = [[False]*n for _ in range(n)]\n\nfor _ in range(m):\n a,b = map(int,input().split())\n e[a-1][b-1] = True\n e[b-1][a-1] = True\n\nans = 0\nl = [i for i in range(1,n)]\nfor p in itertools.permutations(l):\n p = [0] + p\n ... | ['Runtime Error', 'Accepted'] | ['s732895564', 's840028488'] | [3316.0, 3064.0] | [22.0, 29.0] | [418, 386] |
p03805 | u936985471 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\nnexts=[None for i in range(n)]\nfor i in range(n):\n a,b=map(int,input().split())\n a,b=a-1,b-1\n if nexts[a]==None:\n nexts[a]=[b]\n else:\n nexts[a].append(b)\n\nans=0\nstack=[]\nstack.append([0,set()])\nwhile stack:\n node=stack.pop()\n v=node[0]\n seen=node[1]\n seen.ad... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s045993711', 's191965530', 's351491827', 's124077703'] | [3188.0, 3064.0, 3064.0, 9100.0] | [19.0, 17.0, 17.0, 36.0] | [461, 538, 533, 503] |
p03805 | u941753895 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n# def LF(): return [float(x)... | ['Wrong Answer', 'Accepted'] | ['s662500815', 's826862484'] | [10668.0, 10720.0] | [54.0, 52.0] | [1010, 1012] |
p03805 | u944643608 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['\nN, M = map(int,input().split())\ngraph = [[] for j in range(N)]\nfor i in range(M):\n a, b = map(int,input().split())\n graph[a-1].append(b-1)\n graph[b-1].append(a-1)\njudge = [False]*N\n\ndef dfs(v,judge):\n if all(judge):\n return 1\n res = 0\n for nv in graph(v):\n if judge[nv] == True:\n conti... | ['Runtime Error', 'Accepted'] | ['s148110614', 's825774012'] | [3064.0, 3064.0] | [18.0, 23.0] | [525, 534] |
p03805 | u945181840 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['from itertools import permutations\nimport sys\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\n\nver = [[] for _ in range(N)]\n\nprint(ver)\n\nfor i in range(M):\n a, b = map(int, input().split())\n a, b = a - 1, b - 1\n ver[a].append(b)\n ver[b].append(a)\n\nans = 0\n\nfor i in permutati... | ['Wrong Answer', 'Accepted'] | ['s771574927', 's847967728'] | [3064.0, 3064.0] | [25.0, 25.0] | [502, 491] |
p03805 | u946386741 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['N, M = map(int, input().split())\n\nl = []\n\nfor i in range(N):\n l.append(list(map(int, input().split())))\n\nlis = [[] for i in range(N)]\n\nfor i in range(N):\n lis[l[i][0] - 1].append(l[i][1])\n lis[l[i][1] - 1].append(l[i][0])\n\nprint(lis)\n\n\n# list = [[0 for c in range(M)] for r in range(N)]\n#\n\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s527979494', 's784866310', 's892525531'] | [3064.0, 3064.0, 5236.0] | [18.0, 17.0, 46.0] | [1200, 1201, 1190] |
p03805 | u957872856 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\nN, M = map(int,input().split())\nedges = {tuple(sorted(map(int,input().split()))) for i in range(M)}\nprint(edges)\nans = 0\nnum = 0\nfor i in itertools.permutations(range(2,N+1)):\n #print(i)\n l = [1] + list(i)\n for edge in zip(l,l[1:]):\n #print(edge)\n if tuple(sorted(edge)) in edges... | ['Wrong Answer', 'Accepted'] | ['s556037695', 's676863984'] | [3064.0, 3064.0] | [45.0, 43.0] | [583, 408] |
p03805 | u958958520 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import sys\nn,m = map(int,input().split())\ngraph = [list(input().split(" ")) for i in range(n)]\n\nresult=0\n\ndef dfs(a, list, graph, result):\n print(list)\n if len(list) == n:\n result = result + 1\n\n for g in graph:\n if g[0] == a and g[1] not in list:\n list.append(g[1])\n result = dfs(g[1]... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s507506682', 's876791595', 's181140998'] | [9224.0, 9220.0, 9136.0] | [30.0, 27.0, 32.0] | [573, 573, 544] |
p03805 | u968846084 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n,m=map(int,input().split())\nA=[["."]*n for i in range(n)]\nB=[["."]*m for i in range(m)]\nfor i in range(n):\n A[i]=list(input())\nfor i in range(m):\n B[i]=list(input())\nfor i in range(n-m+1):\n for j in range(n-m+1):\n a=0\n for x in range(m):\n for y in range(m):\n if A[i+x][j+y]!=B[x][y]:\... | ['Runtime Error', 'Accepted'] | ['s950695826', 's200454856'] | [3064.0, 3064.0] | [18.0, 40.0] | [392, 381] |
p03805 | u981206782 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\n\nn,m=map(int,input().split())\ng=[list(map(int,input().split())) for _ in range(m)]\nv=list(itertools.permutations(range(1,n+1)))\nprint(v)\n\nans=0\n\nfor x in v:\n tf=True\n if x[0]!=1:\n tf=False\n else:\n for i in range(n-1):\n if not ([x[i],x[i+1]] in g or [x[... | ['Wrong Answer', 'Accepted'] | ['s436727899', 's820140777'] | [11120.0, 8052.0] | [98.0, 70.0] | [404, 395] |
p03805 | u981931040 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['n , m = map(int , input().split())\nedge = [[] for _ in range(m) ]\n#print(edge)\nfor _ in range(m):\n a , b = map(int , input().split())\n a -= 1 ; b -= 1\n edge[a].append(b)\n edge[b].append(a)\nprint(edge)\n\ndef DFS(s):\n global visited\n #ret=1 if all(visited) else 0\n if all(visited):\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s118451669', 's813933110', 's314246895'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 28.0] | [581, 583, 603] |
p03805 | u999893056 | 2,000 | 262,144 | You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges. Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M). How many different paths start from vertex ... | ['import itertools\nimport collections\n\nn, m = map(int, input().split())\n\na = [list(sorted(map(int, input().split()))) for i in range(m)]\na.sort()\n\ncnt = 0\n\nfor i in itertools.permutations(range(2, n + 1), (n - 1)):\n li = [1] + list(i)\n for edge in zip(li, li[1:]):\n print(edge)\n if sum(list... | ['Wrong Answer', 'Accepted'] | ['s694053182', 's499473869'] | [3772.0, 3316.0] | [102.0, 61.0] | [391, 339] |
p03806 | u010110540 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ["def solve():\n \n INF = float('inf')\n \n N, Ma, Mb = map(int, input().split())\n \n l = []\n for _ in range(N):\n a,b,c = map(int, input().split())\n l.append((a,b,c))\n \n #dp table: dp[i][ca][cb] \n dp = [[[INF] * 401 for _ in range(401)] for _ in range(N+1)]\n dp... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s274137086', 's291411882', 's540633730', 's105361541'] | [59428.0, 3064.0, 57844.0, 59504.0] | [1775.0, 17.0, 2107.0, 1892.0] | [1040, 1020, 846, 939] |
p03806 | u074220993 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['N, Ma, Mb = map(int, input().split())\nMed = [tuple(map(int, input().split())) for _ in range(N)]\nN *= 100\nimport numpy as np\ndp = np.full((N+1,N+1),np.inf) \ndp[0,0] = 0\nfrom itertools import product\nR = lambda x:reversed(range(x,N+1))\nfor a,b,c in Med:\n for i,j in product(R(a),R(b)):\n dp[i,j] = mi... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s084313856', 's093206971', 's272785038', 's608808775', 's641199614', 's704777884', 's301861222'] | [152180.0, 719968.0, 9228.0, 590648.0, 9480.0, 9236.0, 12640.0] | [2206.0, 2222.0, 31.0, 2221.0, 25.0, 26.0, 221.0] | [524, 887, 1059, 887, 581, 527, 550] |
p03806 | u116002573 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ["def main():\n\n N, Ma, Mb = map(int, input().split())\n drug = []\n for _ in range(N):\n a, b, c = map(int, input().split())\n drug.append([a, b, c])\n\n cur = dict()\n cur[(0, 0)] = 0\n for i in range(N):\n temp = cur.copy()\n for p in cur:\n a, b = p[0]+drug[... | ['Wrong Answer', 'Accepted'] | ['s112986635', 's714759393'] | [3064.0, 8332.0] | [17.0, 253.0] | [746, 791] |
p03806 | u119226758 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['import math\n\nN, Ma, Mb = map(int,input().split())\nrate = Ma / Mb\na = [0] * N\nb = [0] * N\nc = [0] * N\nMA = 0\nMB = 0\nfor i in range(N):\n a[i], b[i], c[i] = map(int, input().split())\n MA += a[i]\n MB += b[i]\n\ndp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]\ndp[0][0... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s074730363', 's105563733', 's197478403', 's337982297', 's717474414'] | [3064.0, 3188.0, 3184.0, 23156.0, 26216.0] | [18.0, 18.0, 18.0, 1580.0, 1717.0] | [1156, 1155, 1013, 944, 1066] |
p03806 | u190405389 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ["n,ma,mb = map(int, input().split())\nabc = [list(map(int, input().split())) for i in range(n)]\n\ninf = float('inf')\n\ndp = [[inf for i in range(n*10)] for i in range(n*10)]\n\nfor i in range(n):\n for j in range(i*10,-1):\n for k in range(i*10,-1):\n if dp[j][k]!=inf:\n dp[j + ab... | ['Wrong Answer', 'Accepted'] | ['s154908085', 's526947617'] | [4340.0, 4852.0] | [58.0, 533.0] | [631, 640] |
p03806 | u210440747 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['import numpy as np\n\nif __name__=="__main__":\n inputs_number = lambda : [int(x) for x in input().split()]\n N, Ma, Mb = inputs_number()\n drugs = np.array([inputs_number() for i in range(N)])\n\n inf = 100*N + 1\n dp = np.ones((N,N*10,N*10)) * inf\n dp[0,0,0] = 0\n for i in range(0, N-1):\n\tf... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s020458576', 's050673175', 's085790355', 's124397585', 's156283877', 's171553571', 's260993299', 's357180083', 's497589518', 's716577233', 's725643527', 's732445415', 's771197177', 's832428553', 's872417417', 's884944992', 's987462084', 's064221665'] | [3064.0, 3192.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 28336.0, 3064.0, 299932.0, 3192.0, 3064.0, 3064.0, 3064.0, 115464.0, 3064.0, 12556.0, 27776.0] | [23.0, 23.0, 23.0, 23.0, 22.0, 22.0, 24.0, 1240.0, 24.0, 2126.0, 22.0, 22.0, 22.0, 22.0, 299.0, 23.0, 162.0, 1233.0] | [812, 807, 891, 793, 807, 815, 908, 1040, 906, 929, 786, 823, 604, 790, 272, 903, 213, 1010] |
p03806 | u263830634 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['N, Ma, Mb = map(int, input().split())\n\nINF = 10 ** 8\n\nlst = [[INF] * 401 for i in range(401)]\nlst[0][0] = 0\n\nfor _ in range(N):\n a, b, c = map(int, input().split())\n for i in range(a, 401):\n for j in range(b, 401):\n if lst[i][j] == INF:\n pass\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s414435858', 's640792040'] | [4340.0, 18632.0] | [793.0, 264.0] | [518, 641] |
p03806 | u347640436 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ["INF = float('inf')\nn, ma, mb = map(int, input().split())\ncmax = n * 10\nt = [[INF] * (cmax + 1) for _ in range(cmax + 1)]\nfor _ in range(n):\n a, b, c = map(int, input().split())\n for aa in range(cmax, 0, -1):\n for bb in range(cmax, 0, -1):\n if t[aa][bb] == INF:\n continue\n t[a + aa][b + ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s074672768', 's295008937', 's569011927', 's644642385', 's898568349', 's984055683'] | [4848.0, 4844.0, 4340.0, 478068.0, 4340.0, 4848.0] | [1180.0, 1047.0, 918.0, 2135.0, 1042.0, 1084.0] | [553, 563, 559, 472, 561, 604] |
p03806 | u375616706 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['N, Ma, Mb = (list)(map(int, input().split()))\nN_max = 40\nabmax = 10\nl = []\ninf = 10**6\ndp = [[[inf]*401 for _ in range(401)] for _ in range(40)]\n\n\nfor _ in range(N):\n l.append((list)(map(int, input().split())))\n\ndp[0][0][0] = 0\n\nfor i in range(N):\n for ca in range(401):\n for cb in range(40... | ['Runtime Error', 'Accepted'] | ['s824751378', 's207231848'] | [59244.0, 59476.0] | [1453.0, 1715.0] | [751, 735] |
p03806 | u393512980 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ["INF = float('inf')\nN, Ma, Mb = map(int, input().split())\na, b, c = [None] * N, [None] * N, [None] * N\nfor i in range(N):\n a[i], b[i], c[i] = map(int, input().split())\ndp = [[[INF] * (10*N+1) for j in range(10*N+1)] for i in range(N+1)]\ndp[0][0][0] = 0\nfor i in range(N):\n for j in range(10*N+1):\n ... | ['Wrong Answer', 'Accepted'] | ['s930558170', 's197712276'] | [57844.0, 10836.0] | [2107.0, 270.0] | [642, 455] |
p03806 | u425351967 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['import copy\n\nN, Ma, Mb = [int(n) for n in input().split()]\npd = {(0,0):0}\nfor i in range(N):\n a, b, c = [int(n) for n in input().split()]\n pdcopy = copy.deepcopy(pd)\n for k, v in pdcopy.items():\n nk = (k[0]+a, k[1]+b)\n if nk in pd:\n if pd[nk] > c :\n pd[nk] =... | ['Wrong Answer', 'Accepted'] | ['s813364412', 's833260285'] | [7884.0, 8844.0] | [1361.0, 1356.0] | [503, 515] |
p03806 | u533885955 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['\nNM=40\nABM=10\nMM=400\n\nN,M1,M2=map(int,input().split())\nA=[]\nB=[]\nC=[]\nfor i in range(N):\n a,b,c=map(int,input().split())\n A.append(a)\n B.append(b)\n C.append(c)\ncmax=max(C)\nCM=N*max(C)+1\ndp=[[[CM for broop in range(401)] for aroop in range(401)] for nroop in range(NM+1)]\ndp[0][0][0]=0\nfor... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s437141374', 's687826951', 's286166820'] | [59564.0, 59120.0, 60040.0] | [1950.0, 1863.0, 1849.0] | [840, 838, 839] |
p03806 | u550943777 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['n, ma, mb = map(int,input().split())\nINF = 10000\nmaxa = 0\nmaxb = 0\nmaxc = 0\nmedi = []\nfor i in range(n):\n a, b, c = map(int,input().split())\n maxa = max(maxa, a)\n maxb = max(maxb, b)\n maxc = max(maxc, c)\n medi.append([a, b, c])\ndp = [[[INF for k in range(maxb+1)] for j in range(maxa+1)] for... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s325765727', 's591041564', 's425458242'] | [3188.0, 2940.0, 60016.0] | [21.0, 17.0, 1120.0] | [937, 9, 898] |
p03806 | u595289165 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['import numpy as np\nn, ma, mb = map(int, input().split())\nr = 10 * n + 6\ninf = 10**5\ndp = np.full((n+1, r, r), inf)\ndp[0][0][0] = 0\nfor i in range(n):\n a, b, c = map(int, input().split())\n for j in range(r):\n for k in range(r):\n if j + a < r and k + b < r:\n dp[i+1][j+a... | ['Wrong Answer', 'Accepted'] | ['s240895605', 's529871897'] | [67304.0, 69756.0] | [2109.0, 241.0] | [701, 513] |
p03806 | u603253967 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ["from collections import defaultdict\n\nMAX = 40001\n\n\ndef main():\n N, Ma, Mb = [int(a) for a in input().split()]\n\n abc = [\n [int(a) for a in input().split()]\n for _ in range(N)\n ]\n\n dp = [\n [\n [MAX for b in range(10 * N + 1)]\n for a in range(10 * N +... | ['Wrong Answer', 'Accepted'] | ['s496461499', 's722695264'] | [56532.0, 182224.0] | [2107.0, 1828.0] | [1251, 1348] |
p03806 | u658993896 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['print(-1)', 'N,Ma,Mb=list(map(int,input().split()))\n\nmix=set([(0,0)])\nans=10**9\ncost={(0,0):0}\nfor i in range(N):\n a,b,c=list(map(int,input().split()))\n tmp=mix.copy()\n for x in tmp:\n d=x[0]+a\n e=x[1]+b\n f=min(cost.get((d,e),10**9),cost[x]+c)\n cost[(d,e)]=f\n mi... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s520155711', 's581353161', 's013236009'] | [2940.0, 10060.0, 14232.0] | [18.0, 407.0, 428.0] | [9, 416, 445] |
p03806 | u682985065 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ["n, ma, mb = map(int, f.readline().split())\na, b, c = [], [], []\nfor _ in range(n):\n at, bt, ct = map(int, f.readline().split())\n a.append(at)\n b.append(bt)\n c.append(ct)\n \ndp = [[float('inf') for _ in range(n*mb + 1)] for _ in range(n*ma + 1)]\ndp[0][0] = 0\nused = [[0, 0]]\n\nfor i in range(n)... | ['Runtime Error', 'Accepted'] | ['s892366979', 's946646073'] | [3064.0, 9308.0] | [17.0, 1845.0] | [692, 725] |
p03806 | u683134447 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['global N\nglobal Nlist\nglobal Ma\nglobal Mb\nglobal minicost\nminicost = 10000000\nN, Ma, Mb = map(int,input().split()) \nNlist = []\nfor i in range(N):\n a,b,c = map(int,input().split())\n Nlist.append([a,b,c])\ndef dvector(Masum,Mbsum,cost,vector):\n print(vector)\n global Ma\n global Mb\n global... | ['Wrong Answer', 'Accepted'] | ['s590162628', 's246196926'] | [37492.0, 3064.0] | [1598.0, 249.0] | [848, 799] |
p03806 | u683479402 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['# ABC54 D\nn,ma,mb = map(int, input().split())\na = []\nb = []\nc = []\nfor i in range(N):\n ai,bi,ci = map(int, input().split())\n a.append(ai)\n b.append(bi)\n c.append(ci)\n \nmax_sum = n * 10\nmax_cost = 100000000\ndp = [[[max_cost for k in range(n+1)] for j in range(max_sum+1)] for i in range(max_... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s793797912', 's924860777', 's944875373', 's690541993'] | [3444.0, 3064.0, 3192.0, 60780.0] | [25.0, 17.0, 17.0, 1773.0] | [844, 848, 844, 848] |
p03806 | u729707098 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['n,ma,mb = (int(i) for i in input().split())\nx = [[int(i) for i in input().split()] for i in range(n)]\ndp = [[float("inf") for i in range(10*n+1)] for i in range(10*n+1)]\ndp[0][0],ans = 0,float("inf")\nfor i in range(n):\n\tfor j in range(10*(i-1)+1):\n\t\tfor k in range(10*(i-1)+1):\n\t\t\tif dp[j][k]!=float("inf"... | ['Wrong Answer', 'Accepted'] | ['s073237409', 's513358291'] | [11876.0, 60020.0] | [1983.0, 1153.0] | [509, 587] |
p03806 | u780475861 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ["n, ma, mb = [int(i) for i in input().split()]\nlst = [[int(i) for i in input().split()] for _ in range(n)]\nlst.sort(key=lambda x: x[2])\n\ndef push(k,v):\n if k in dic:\n dic[k] = min(dic[k],v)\n else:\n dic[k] = v\n\n\nfor i in lst:\n k, v = i[0] * mb - i[1] * ma, i[2]\n l = [[j, dic[j]] f... | ['Runtime Error', 'Accepted'] | ['s431241027', 's935184754'] | [3064.0, 3572.0] | [17.0, 41.0] | [427, 435] |
p03806 | u785989355 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['N,A,B = list(map(int,input().split()))\n\nitem=[]\nfor i in range(N):\n a,b,c = list(map(int,input().split()))\n item.append([a,b,c])\n\nD = [[10**27 for i in range(401)] for j in range(401)]\nD[0][0] = 0\nfor i in range(N):\n for j in range(401):\n for k in range(401):\n if D[j][k]<10**27:... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s484633278', 's855371918', 's922906438', 's929101467', 's775805195'] | [4340.0, 3064.0, 60016.0, 56436.0, 61168.0] | [45.0, 18.0, 1925.0, 361.0, 1928.0] | [563, 635, 663, 657, 666] |
p03806 | u826438738 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['N,Ma,Mb=map(int,input().split())\n\ndp = [[10**18 for _ in range(401)] for _ in range(401)]\n\ndp[0][0]=0\nfor i in range(N):\n a,b,c=map(int,input().split())\n for ca in range(361, -1, -1):\n for cb in range(361, -1, -1):\n dp[ca+a][cb+b] = min(dp[ca+a][cb+b],dp[ca][cb]+c)\n ', 'N,Ma,M... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s087651252', 's218788137', 's965309213'] | [4496.0, 58356.0, 4852.0] | [2104.0, 2107.0, 1526.0] | [298, 725, 541] |
p03806 | u844789719 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['N, Ma, Mb = [int(_) for _ in input().split()]\nABC = [[int(_) for _ in input().split()] for _ in range(N)]\ndp = {}\ndp[0] = {}\ndp[0][ABC[0][0] + 1000 * ABC[0][1]] = ABC[0][2]\nans = 5000\nfor i in range(N - 1):\n for ab in dp[i].keys():\n a = ab % 1000\n b = ab // 1000\n if a * Mb == b * Ma:... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s601525214', 's866380497', 's062343526'] | [3064.0, 12284.0, 9932.0] | [19.0, 459.0, 457.0] | [754, 720, 724] |
p03806 | u942033906 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['N,Ma,Mb = map(int,input().split())\nfirst_half = []\nlast_half = []\nfor i in range(N):\n\ta,b,c = map(int,input().split())\n\tif i < N // 2:\n\t\tfirst_half.append((a,b,c))\n\telse:\n\t\tlast_half.append((a,b,c))\n\nfirst_half_combination = {}\nlast_half_combination = {}\ndef make_all_combination(i,a,b,c,d_list,flag... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s024333021', 's280902982', 's676295028', 's768543337'] | [3964.0, 285788.0, 3188.0, 3188.0] | [80.0, 2122.0, 1739.0, 1801.0] | [1399, 1229, 1327, 1327] |
p03806 | u985443069 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['\nn, ma, mb = map(int, input().split())\na = [0] * n\nb = [0] * n\nc = [0] * n\nfor i in range(n):\n a[i], b[i], c[i] = map(int, input().split())\n\nM = 401\nINF = 10 ** 15\nmin_cost = dict()\nmin_cost[0, 0] = 0\n\nfor k in range(n):\n keys = min_cost.keys()\n for i, j in reversed(sorted(keys)):\n if ... | ['Runtime Error', 'Accepted'] | ['s661714904', 's140047936'] | [3064.0, 8504.0] | [17.0, 460.0] | [673, 763] |
p03806 | u995062424 | 2,000 | 262,144 | Dolphin is planning to generate a small amount of a certain chemical substance C. In order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b. He does not have any stock of chemicals, however, so he will purchase some chemicals at a local pha... | ['def main():\n N, Ma, Mb = map(int, input().split())\n yakuhin = []\n sa = 0\n sb = 0\n for i in range(N):\n yakuhin.append(list(map(int, input().split())))\n sa += yakuhin[i][0]\n sb += yakuhin[i][1]\n \n INF = 10**15\n DP = [[[INF for _ in range(sb+1)] for _ in range(sa+1... | ['Wrong Answer', 'Accepted'] | ['s114853435', 's807931149'] | [23156.0, 60016.0] | [2105.0, 1779.0] | [994, 865] |
p03807 | u001687078 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['import sys\nsys.stdin.readline()\ncount = 0\na_list = list(map(int, sys.stdin.readline().split()))\nfor a in x_list:\n count += a%2\n\nprint("YES") if count%2==0 else print("NO")', 'import sys\ninput_ = sys.stdin.readline\ninput_()\nx_list = list(map(int, input_().split()))\nfor x in x_list:\n if x%2==0:\n a += ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s013588731', 's165841384', 's152566113'] | [14048.0, 14052.0, 14108.0] | [41.0, 42.0, 57.0] | [172, 177, 146] |
p03807 | u005569385 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['N = int(input())\na = list(map(int,input().split()))\ns = 0\nfor i in a:\n if i % 2 == 1:\n s += 1\nif s % 2 == 0:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\na = list(map(int,input().split()))\ns = 0\nfor i in a:\n if i % 2 == 1:\n s += 1\nif s % 2 == 0:\n print("YES")\nelse... | ['Wrong Answer', 'Accepted'] | ['s455923111', 's251191451'] | [20096.0, 20128.0] | [62.0, 60.0] | [157, 157] |
p03807 | u042802884 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["N=int(input())\nA=list(map(int,input().split()))\nB=[x for x in A if x%2==1]\nprint('Yes' if len(B)%2==0 else 'No')", "N=int(input())\nA=list(map(int,input().split()))\nB=[x for x in A if x%2==1]\nprint('YES' if len(B)%2==0 else 'NO')"] | ['Wrong Answer', 'Accepted'] | ['s829508431', 's133587755'] | [14112.0, 14108.0] | [51.0, 52.0] | [112, 112] |
p03807 | u064408584 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["n=int(input())\na=list(map(int, input().split()))\na=[i%2 for i in a]\nb=a.count(1)\nan=a.count(0)+b//2\nif an%2+b%2==1:print('YES')\nelse:print('NO')", "n=int(input())\na=list(map(int, input().split()))\na=[i%2 for i in a]\nb=a.count(1)\nanb,b=a.count(0)+b//2,b+b//2\nif an%2+b%2==1:print('YES')\nelse:print('NO')", "... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s155122003', 's253040347', 's531189086', 's517573548'] | [14108.0, 14108.0, 14112.0, 14108.0] | [51.0, 51.0, 52.0, 51.0] | [144, 154, 154, 120] |
p03807 | u075012704 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['N = int(input())\nA = list(map(int, input().split()))\nodd = len(list(filter(lambda x: x % 2 == 1, A)))\nif odd % 2 == 0:\n print("Yes")\nelse:\n print("No")\n ', 'N = input()\nA = list(map(int, input().split()))\n\n\n\n\n\nodd = len(list(filter(lambda x: x % 2 == 1, A)))\nprint("YES" if odd % 2 == 0 else "N... | ['Wrong Answer', 'Accepted'] | ['s692391360', 's669876314'] | [14108.0, 14112.0] | [56.0, 57.0] | [162, 339] |
p03807 | u095902316 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["numInput = int(input())\n\namount = numInput\nnumOdd = int(numInput / 2) + (numInput % 2)\nnumEven = int(numInput / 2)\n\nwhile True:\n\n if amount >= 3:\n if numOdd >= 2:\n numOdd -= 2\n numEven += 1\n amount -= 1\n else:\n numEven -= 1\n amount... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s671067635', 's719446520', 's082866413'] | [3192.0, 3064.0, 14112.0] | [2102.0, 22.0, 77.0] | [491, 389, 243] |
p03807 | u107915058 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['N = int(input())\nA = list(map(int,input().split()))\nprint("Yes" if sum(A)%2==0 else "No")', 'N = int(input())\nA = list(map(int,input().split()))\nprint("YES" if sum(A)%2==0 else "NO")'] | ['Wrong Answer', 'Accepted'] | ['s794099510', 's381073530'] | [20008.0, 20132.0] | [52.0, 53.0] | [89, 89] |
p03807 | u117193815 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['n = int(input())\na = list(map(int, input().split()))\ne=0\no=0\nfor i in range(n):\n if a[i]%2==0:\n e+=1\n else:\n o+=1\nif o>e:\n if o%2!=0:\n print("No")\n else:\n print("Yes")\nelse:\n print("Yes")', 'n = int(input())\na = list(map(int, input().split()))\ne=0\no=0\nfor ... | ['Wrong Answer', 'Accepted'] | ['s281577965', 's378287590'] | [14104.0, 14108.0] | [64.0, 62.0] | [230, 235] |
p03807 | u125205981 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["def even(num):\n if num & 1:\n return('uneven')\n else:\n return('even')\n\nN = int(input())\nA = list(map(int, input().split()))\n\nn = 0\nfor a in A:\n if even(a) == 'uneven':\n n += 1\n\nif even(n) =a= 'even':\n print('YES')\nelse:\n print('NO')\n", "def even(num):\n if num &... | ['Runtime Error', 'Accepted'] | ['s378857792', 's341728544'] | [3192.0, 14364.0] | [22.0, 78.0] | [268, 267] |
p03807 | u126844573 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['a, b, c = sorted(list(map(int, input().split())))\n\ncount = (b - a) // 2\ncount += 2 if (a + count * 2) != b else 0\ncount += c - b\nprint(count)\n', 'input()\n\nprint("NO" if sum(map(int, input().split())) % 2 else "YES")\n'] | ['Runtime Error', 'Accepted'] | ['s571789569', 's693535190'] | [2940.0, 11104.0] | [18.0, 40.0] | [143, 70] |
p03807 | u128914900 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['n=int(input())\ns=input().split()\ni=0\ncount=0\nwhile i<0:\n if s[i]%2!=0:\n count+=1\nif count%2==0:\n print("Yes")\nelse:\n print("No")', 's=input().split()\ni=0\ncount=0\nwhile i<n:\n if int(s[i])%2!=0:\n count+=1\n i+=1\nif count%2==0:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\ns=input()... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s081385351', 's175320437', 's348528404', 's813005149'] | [11104.0, 3060.0, 11104.0, 11108.0] | [26.0, 17.0, 72.0, 72.0] | [134, 131, 146, 146] |
p03807 | u136395536 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['N = int(input())\nA = [int(i) for i in input().split()]\n\nodd = 0 \neven = 0 \n\nfor i in range(N):\n if A[i]%2 == 0:\n even += 1\n else:\n odd += 1\n\nif abs(odd - even)%2 == 0:\n print("YES")\nelif odd > even:\n print("NO")\nelse:\n print("YES")', 'N = int(input())\nA = [int(i) for i i... | ['Wrong Answer', 'Accepted'] | ['s742899099', 's803541243'] | [14108.0, 14104.0] | [68.0, 62.0] | [274, 178] |
p03807 | u143492911 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['n=int(input())\na=list(map(int,input().split()))\neven_cnt=0\nodd_cnt=0\nfor i in a:\n if i%2==0:\n even_cnt+=1\n else:\n odd_cnt+=1\nif 1<=odd_cnt:\n even_cnt+=odd_cnt//2\u3000\n odd_cnt=odd_cnt%2 \n even_cnt=even_cnt%2\n if even_cnt==1 and odd_cnt==1:\n print("NO")\n else:\... | ['Runtime Error', 'Accepted'] | ['s019522387', 's722373551'] | [3064.0, 14104.0] | [17.0, 59.0] | [479, 170] |
p03807 | u162612857 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["n = int(input())\nnums = list(map(int, input().split()))\n\nprint('NO' if (sum(map(lambda x:x%2, nums)))%2 else 'YESs')\n", "n = int(input())\nnums = list(map(int, input().split()))\n\nprint('NO' if (sum(map(lambda x:x%2, nums)))%2 else 'YES')\n"] | ['Wrong Answer', 'Accepted'] | ['s711877288', 's250742644'] | [14112.0, 14112.0] | [54.0, 55.0] | [117, 116] |
p03807 | u163320134 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["n=int(input())\narr=list(map(int,input().split()))\ncount=0\nfor i in range(n):\n if arr[0]%2==1:\n count+=1\nif count%2==1:\n print('NO')\nelse:\n print('YES')", "n=int(input())\narr=list(map(int,input().split()))\ncount=0\nfor i in range(n):\n if arr[i]%2==1:\n count+=1\nif count%2==1:\n print('NO')\nels... | ['Wrong Answer', 'Accepted'] | ['s593353321', 's054127821'] | [14108.0, 14108.0] | [61.0, 62.0] | [157, 157] |
p03807 | u178079174 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["A = list(map(int,input().split()))\nAA = sum([i%2 for i in A])\nif N == 1:\n print('YES')\n exit()\nif AA % 2 == 1:\n print('NO')\n exit()\nprint('YES') \n", "N = int(input())\nA = list(map(int,input().split()))\nAA = sum([i%2 for i in A])\nif N == 1:\n print('YES')\n exit()\nif AA % 2 == 1:\n pr... | ['Runtime Error', 'Accepted'] | ['s312604107', 's512045357'] | [2940.0, 14108.0] | [17.0, 50.0] | [158, 175] |
p03807 | u185405877 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['n=int(input())\ni = list(map(int, input().split()))\ns=0\nfor j in range(len(i)):\n if i[j]%2==1:\n s+=1\nif s%2==0:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\ni = list(map(int, input().split()))\ns=0\nfor j in range(n):\n if i[j]%2==1:\n s+=1\nif s%2==0:\n print("YES")\nelse:\n print("NO")'] | ['Wrong Answer', 'Accepted'] | ['s443001947', 's597764121'] | [14112.0, 14108.0] | [60.0, 60.0] | [149, 144] |
p03807 | u187109555 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['_ = input()\nAs = [int(x) for x in input().split()]\neven_pair_count = 0\nodd_pair_count = 0\neven_pair = []\nodd_pair = []\nfor a in As:\n if a%2 == 0:\n even_pair.append(1) \n if len(even_pair) == 2:\n even_pair = []\n even_pair_count += 1\n else:\n odd_pair.appen... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s313397763', 's887935066', 's923566176'] | [3060.0, 14108.0, 14108.0] | [18.0, 81.0, 48.0] | [667, 557, 108] |
p03807 | u216962796 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["print(sum([1 if i % 2 == 1 else 0 for i in list(map(int, input().split(' ')))]))", "print(['NO', 'YES'][sum([1 if i % 2 == 1 else 0 for i in [int(input()) % 1] + list(map(int, input().split(' ')))]) % 2])", "print(sum([1 if i % 2 == 1 else 0 for i in [int(input()) % 1] + list(map(int, input().split(' ')))]))", "[prin... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s138261530', 's265052673', 's355254605', 's109843704'] | [3188.0, 14108.0, 14112.0, 12132.0] | [19.0, 53.0, 51.0, 54.0] | [80, 120, 101, 103] |
p03807 | u223646582 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["N = int(input())\nA = [int(i) for i in input().split()]\n\nc = 0\nfor a in A:\n if a % 2 = 1:\n c += 1\nif c % 2 == 0:\n print('YES')\nelse:\n print('NO')\n", "N = int(input())\nA = [int(i) for i in input().split()]\n\nc = 0\nfor a in A:\n if a % 2 == 1:\n c += 1\nif c % 2 == 0:\n print('... | ['Runtime Error', 'Accepted'] | ['s432386761', 's793161816'] | [2940.0, 14108.0] | [17.0, 60.0] | [161, 162] |
p03807 | u240793404 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['n = int(input())\nl = list(map(int,input().split()))\nm = [i%2 for i in l]\nprint("YNeos"[l.count(1)%2==0::2])', 'n = int(input())\nl = list(map(int,input().split()))\nm = [i%2 for i in l]\nprint("YNEOS"[m.count(1)%2==1::2])'] | ['Wrong Answer', 'Accepted'] | ['s776420190', 's637557219'] | [14108.0, 14108.0] | [52.0, 60.0] | [107, 107] |
p03807 | u242031676 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['n,*a=map(int,open(0).read().split());print("YNeos"[sum(map(lambda x:x%2, a))%2::2])', 'n,*a=map(int,open(0).read().split());print("YNEOS"[sum(map(lambda x:x%2, a))%2::2])'] | ['Wrong Answer', 'Accepted'] | ['s983943871', 's098802452'] | [14060.0, 14188.0] | [56.0, 53.0] | [83, 83] |
p03807 | u252828980 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['n = int(input())\nL = list(map(int,input().split()))\ncnt = 0\nfor i in range(n):\n if L[i]%2 == 1:\n cnt += 1\nif cnt%2 == 1:\n print("YES")\nelse:\n print("NO")', 'n = int(input())\nL = list(map(int,input().split()))\ncnt = 0\nfor i in range(n):\n if L[i]%2 == 1:\n cnt += 1\nif cnt%2 == 1:\n print("NO")\... | ['Wrong Answer', 'Accepted'] | ['s489964951', 's878037909'] | [14108.0, 14112.0] | [60.0, 61.0] | [159, 159] |
p03807 | u271456715 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["n = int(input().strip())\na = [int(x) for x in input().strip().split()]\nflg = [-1 for i in range(n)]\nb = []\nl = [[] for i in range(n)]\nfor i in range(n - 1):\n b.append([int(x) - 1 for x in input().strip().split()])\nfor x in b:\n l[x[0]].append(x[1])\n l[x[1]].append(x[0])\n \nwhile True:\n minimum = a[0]\n ... | ['Runtime Error', 'Accepted'] | ['s210159326', 's224251881'] | [14884.0, 11104.0] | [69.0, 51.0] | [1079, 112] |
p03807 | u315485238 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["N = int(input())\nA = list(map(int, input().split()))\nodd = [a for a in A if a%2]\n\nif odd%2:\n print('NO')\nelse:\n print('YES')", "N = int(input())\nA = list(map(int, input().split()))\nodd = [a for a in A if a%2]\n\nif len(odd)%2:\n print('NO')\nelse:\n print('YES')"] | ['Runtime Error', 'Accepted'] | ['s740493431', 's386522638'] | [14108.0, 14108.0] | [50.0, 49.0] | [126, 131] |
p03807 | u319737087 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["n = int(input())\narg_list = int(input())\n\nk = 0\nfor item in arg_list:\n if item % 2 == 1 :\n k +=1\nif k == 1:\n print('YES')\nelse:\n print('NO')\n ", 'n = int(input())\na = map(int, input().split())\ncount = 0\nfor i in a:\n if i % 2 == 1:\n count += 1\nprint("YES" if count % 2 ... | ['Runtime Error', 'Accepted'] | ['s738014195', 's392056127'] | [5032.0, 11108.0] | [32.0, 73.0] | [165, 148] |
p03807 | u328207927 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ["n=int(input())\na=[int(i) for i in input().split()]\ng=[]\nk=[]\nfor i in a:\n if i%2==0:\n g+=[i]\n g=[sum(g)]\n else:\n k+=[i]\n if len(k)%2==0:\n g+=[sum(k)]\n k=[]\n print(g,k)\nprint('YES'if g==[] or k==[] else 'NO')", "n=int(input())\na=[int(i) for i in... | ['Wrong Answer', 'Accepted'] | ['s722893128', 's526140694'] | [14108.0, 14108.0] | [308.0, 106.0] | [266, 252] |
p03807 | u328510800 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['input()\na = list(map(int, input().split()))\nl = len(filter(lambda x : x & 1, a))\nif l & 1:\n print("NO")\nelse:\n print("YES")', 'input()\na = list(map(int, input().split()))\nl = len(list(filter(lambda x : x & 1, a)))\nif l & 1:\n print("NO")\nelse:\n print("YES")'] | ['Runtime Error', 'Accepted'] | ['s465141546', 's701026469'] | [14112.0, 14104.0] | [43.0, 54.0] | [125, 131] |
p03807 | u329400445 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['import numpy as np\n\nN = int(input())\na = input().split(" ")\nA = [int(i) for i in a]\n\nk = [1 if A[i]%2==1 else 0 for i in range(N)]\n\nif sum(k)%2 == 0:\n print("Yes")\nelse:\n print("No")', 'import numpy as np\n\nN = int(input())\na = input().split(" ")\nA = [int(i) for i in a]\nprint(A)\nk = [1 if A[i]%2... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s342591268', 's522744177', 's220055123'] | [23852.0, 27176.0, 23852.0] | [192.0, 203.0, 194.0] | [188, 196, 188] |
p03807 | u339199690 | 2,000 | 262,144 | There are N integers written on a blackboard. The i-th integer is A_i. Takahashi will repeatedly perform the following operation on these numbers: * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them. * Then, write a new integer on the blackbo... | ['N = int(input())\nA = list(map(int, input().split()))\n\neven_count = 0\nodd_count = 0\nfor a in A:\n if a % 2 == 0:\n even_count += 1\n else:\n odd_count += 1\n\nif odd_count % 2 == 1:\n print("No")\nelse:\n print("Yes")\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nodd_coun... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s562204809', 's680624692', 's834026302', 's037097727'] | [14108.0, 14112.0, 14112.0, 14112.0] | [58.0, 54.0, 58.0, 56.0] | [234, 185, 312, 168] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.