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
p03030
u941645670
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['n = int(input())\nsp = [input().split() for _ in range(n)]\nsp_s = sorted(sp, key=lambda x:(x[0], -int(x[1])))\nfor i in sp:\n print(sp_s.index(i)+1)', 'n = int(input())\nsp = [input().split() for _ in range(n)]\nsp_s = sorted(sp, key=lambda x:(x[0], -int(x[1])))\nfor i in sp_s:\n print(sp.index(i)+1)']
['Wrong Answer', 'Accepted']
['s609198930', 's371534036']
[3060.0, 3060.0]
[18.0, 18.0]
[148, 148]
p03030
u942033906
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['N = int(input())\nlst = []\nfor i in range(N):\n s,p = input().split()\n p=int(p)\n lst.append((s,-p,i+1))\nfor e in lst:\n print(e[2])', 'N = int(input())\nlst = []\nfor i in range(N):\n s,p = input().split()\n p=int(p)\n lst.append((s,-p,i+1))\nlst.sort()\nfor e in lst:\n print(e[2])\n']
['Wrong Answer', 'Accepted']
['s137486834', 's121790528']
[3060.0, 3060.0]
[18.0, 18.0]
[132, 144]
p03030
u947327691
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['n=int(input())\nd=0\n\nfor i in range(n):\n s,p=input().split()\n d.append(s,int(100-p),i)\n\nd.sort()\nfor i in range(n):\n print(d[i][2])', 'n=int(input())\nd=[]\n\nfor i in range(n):\n s,p=input().split()\n d.append((s,100-int(p),i+1))\n\nd.sort()\nfor i in range(n):\n print(d[i][2])\n']
['Runtime Error', 'Accepted']
['s089813706', 's299473705']
[2940.0, 3060.0]
[17.0, 17.0]
[139, 145]
p03030
u950708010
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['def solve():\n n = int(input())\n query = []\n for i in range(n):\n s,p = input().split()\n query.append((s+str(1010-int(p)),i+1))\n query.sort()\n for i in range(n):\n print(query[i][1])\nsolve()', 'def solve():\n n = int(input())\n query = []\n for i in range(n):\n s,p = input().split()\n que...
['Wrong Answer', 'Accepted']
['s376322316', 's308290072']
[2940.0, 3060.0]
[19.0, 17.0]
[201, 200]
p03030
u952081880
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['N=int(input())\nlistA=[]\nfor i in range(N):\n lis=input().split()\n listA.append([lis[0],int(lis[1]),i])\nsort=sorted(listA,key=lambda x:(x[0],-x[1]))\nfor i in range(N):\n sort[i].append(i+1)\nsort=sorted(sort,key=lambda x:x[2])\nfor disp in sort:\n print(disp[3])', 'N=int(input())\nlistA=[]\nfor i in r...
['Wrong Answer', 'Accepted']
['s509879045', 's308895726']
[3064.0, 3060.0]
[17.0, 19.0]
[268, 234]
p03030
u952406466
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['n = int(input())\n\nsp = []\n\nfor i in range(n):\n s,p = map(str,input().split())\n sp.append([s,int(p),i+1])\n\n\nsp.sort(key = lambda x:x[1],reverse = True)\nsp.sort(key = lambda x:x[0],reverse = True)\n\nfor i in sp:\n print(i[2])', 'n = int(input())\n\nsp = []\n\nfor i in range(n):\n s,p = map(str,input().sp...
['Wrong Answer', 'Accepted']
['s074656839', 's793192520']
[3064.0, 3060.0]
[18.0, 17.0]
[224, 210]
p03030
u958506960
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['n = int(input())\nl = []\nfor i in range(n):\n sp = input().split()\n l.append((sp[0], int(sp[1]), i+1))\n\na = sorted(l, key=lambda i: (i[0], -l[1]))\n\nfor i in range(n):\n print(a[i][2])', 'n = int(input())\nl = []\nfor i in range(n):\n sp = input().split()\n l.append([sp[0], int(sp[1]), i+1])\n\ns ...
['Runtime Error', 'Accepted']
['s943038164', 's104415418']
[9184.0, 9144.0]
[21.0, 26.0]
[189, 189]
p03030
u960653324
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
[' N = int(input())\n SP = [list(map(str, input().split())) for _ in range(N)]\n\n for i in range(N):\n SP[i].append(i+1)\n SP[i][1] = int(SP[i][1])*(-1)\n\n ans = sorted(SP, key=lambda x:(x[0],x[1]))\n\n for i in range(N):\n print(ans[i][2])\n', 'N = int(input())\nSP = [list(map(str, input().split())) for _ in r...
['Runtime Error', 'Accepted']
['s444354005', 's523599379']
[2940.0, 3060.0]
[17.0, 18.0]
[237, 229]
p03030
u964763428
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
["from operator import itemgetter, attrgetter\n\nclass data:\n def __init__(self, i, c, n):\n self.ind = i\n self.city = c\n self.num = -int(n)\n\nN = int(input())\nd = []\nfor i in range(N):\n s, p = input().split()\n d.append(data(i, s, p))\n\nd.sort(key=attrgetter('city', 'num'))\n\nfor...
['Wrong Answer', 'Accepted']
['s434862809', 's529678299']
[3064.0, 3064.0]
[18.0, 19.0]
[360, 339]
p03030
u965937045
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['n = int(input())\nsp = []\nfor i in range(n):\n s,p = map(str, input().split())\n sp.append((s,int(p),i+1))\n\n\nsp=sorted(sp,key=lambda x: (x[0],-x[1]))\nprint(sp)\n\nfor i in range(n):\n print(sp[i][2])', 'n = int(input())\nsp = []\nfor i in range(n):\n s,p = map(str, input().split())\n sp.append((s,...
['Wrong Answer', 'Accepted']
['s223947244', 's310275925']
[9124.0, 9120.0]
[28.0, 27.0]
[202, 192]
p03030
u977193988
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['n=int(input())\nres=[]\ncity=[]\nfor i in range(n):\n s,p=map(str,input().split())\n p=int(p)\n res.append([s,p,i+1])\nR=sorted(res,key=lambda x : x[1],reverse=True)\nRes=sorted(R,key=lambda x : x[0])\nprint(Res)\nfor j in Res:\n print(j[2])', 'n=int(input())\nres=[]\ncity=[]\nfor i in range(n):\n s,p=...
['Wrong Answer', 'Accepted']
['s387179181', 's451088895']
[3064.0, 3064.0]
[17.0, 17.0]
[242, 232]
p03030
u978962055
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['N = int(input())\nmydict = []\nfor i in range(N):\n a, b=input().split()\n mydict.append([str(a), int(b), i])\nmydict.sort()\nfor a,b,c in mydict:\n print(c)', 'N = int(input())\nmydict = []\nfor i in range(N):\n a, b=input().split()\n mydict.append([str(a), int(b)])\nmydict.sort()\nfot i in range(N):\n print(m...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s366498869', 's633434401', 's843603862', 's878703110', 's967028391']
[3060.0, 2940.0, 2940.0, 3056.0, 3060.0]
[17.0, 21.0, 17.0, 18.0, 18.0]
[153, 159, 146, 192, 243]
p03030
u982591663
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['# ABC-128-B\n\nr_list = []\nans_list = []\nN = int(input())\nfor i in range(1, N+1):\n Si, Pi = input().split()\n r_list.append((Si, int(Pi), i))\n \nname_sorted_list = sorted(r_list, key=lambda x:x[0])\nwhile len(name_sorted_list) > 0:\n test_list = []\n list_index = [i for i, x in enumerate(name_sort...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s641157872', 's974388733', 's634681588']
[3064.0, 3064.0, 3064.0]
[18.0, 18.0, 18.0]
[656, 602, 648]
p03030
u983181637
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['# B - Guidebook\nimport numpy as np\nimport pandas as pd \n\nN = int(input())\nA, B = [[], []]\n\nfor _ in range(N):\n a, b = [i for i in input().split()]\n A.append(a)\n B.append(int(b))\n\n\nA = np.array(A)[:, np.newaxis]\nB = np.array(B)[:, np.newaxis]\nC = np.concatenate([A, B], axis=1)\n\nprint(C)\ndf = pd.Da...
['Runtime Error', 'Runtime Error', 'Accepted']
['s112011304', 's567016723', 's134412554']
[12500.0, 12416.0, 18680.0]
[152.0, 150.0, 280.0]
[400, 391, 545]
p03030
u987170100
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
["N = int(input())\nlst = []\nfor _ in range(N):\n s, p = input().split()\n s = '{:0<10}'.format(s)\n p = '{:0>3}'.format(str(100 - int(p)))\n lst.append(s + p)\n\nm = {}\nfor idx, s in enumerate(sorted(lst), 1):\n m[s] = idx\n\nfor s in lst:\n print(m[s])", 'N = int(input())\nlst = []\nfor _ in range...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s007586075', 's475704365', 's483651657']
[3060.0, 3060.0, 3060.0]
[17.0, 19.0, 18.0]
[259, 239, 161]
p03030
u989061966
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['a = int(input())\nc = [list(map(str, input().split())) for b in range(a)]\nl = list()\nfor d in c:\n for i, e in enumerate(d):\n if (i % 2 == 1):\n l.append((int(e)))\nf = sorted(l)\n\nfor d in c:\n for i, e in enumerate(d):\n if (i % 2 == 1):\n print(f.index(int(e))+1)', 'a = int(input())\nc = [lis...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s045506421', 's126485287', 's734462991', 's094457442']
[3064.0, 3064.0, 3060.0, 3064.0]
[18.0, 18.0, 18.0, 18.0]
[276, 290, 274, 287]
p03030
u992910889
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['N=int(input())\nS=[list(map(str,input().split())) for i in range(N)]\n\nA=sorted(S,key=lambda x: int(x[1]), reverse=True)\nA=sorted(A,key=lambda x: x[0])\n\n\nfor i in range(N):\n ans=A.index(S[i])+1\n print(ans)\n', '# coding: utf-8\n# Your code here!\nN=int(input())\nS=[list(map(str,input().split())) for i in...
['Wrong Answer', 'Accepted']
['s248896877', 's945264924']
[3060.0, 3060.0]
[18.0, 17.0]
[210, 250]
p03030
u993435350
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['N = int(input())\nL = []\n\nfor l in range(0,N):\n\tL.append(input().split())\n\tL[l][1] = (int(L[l][1])-10 ** 10,l+1)\n\nL = sorted(L)\nfor i in range(N):\n\tprint(L[i][1][1])\n\n', 'N = int(input())\nL = []\n\nfor l in range(0,N):\n\tL.append(input().split())\n\tL[l][1] = (abs(int(L[l][1])-10**10),l+1)\n\nL = sorte...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s380376019', 's492799012', 's707676592']
[3060.0, 3060.0, 3064.0]
[17.0, 18.0, 17.0]
[166, 169, 172]
p03030
u995062424
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['N = int(input())\nlst = [[] for _ in range(N)]\n\nfor i in range(N):\n S, P = input().split()\n lst[i].append(S)\n lst[i].append(P)\n lst[i].append(i+1)\n \nlst_a = sorted(lst, key=lambda x:x[0])\nlst_a = sorted(lst_a, key=lambda x:x[1], reverse=True)\n\nfor i in range(N):\n print(lst_a[i][2])', 'N ...
['Wrong Answer', 'Accepted']
['s735733133', 's105346955']
[3064.0, 3064.0]
[17.0, 17.0]
[299, 257]
p03030
u995102075
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['N = int(input())\nSP = [(i + 1, input().split()) for i in range(N)]\nP = [[0, 0, 0] for _ in range(N)]\nfor i in range(N):\n P[i][0] = SP[i][0]\n P[i][1] = SP[i][1][0]\n P[i][2] = int(SP[i][1][1])\nP.sort(key=lambda x: x[1][1], reverse=True)\nP.sort(key=lambda x: x[1][0])\n\nfor p in P:\n print(p[0])\n', ...
['Runtime Error', 'Accepted']
['s057135739', 's508287373']
[3064.0, 3064.0]
[18.0, 18.0]
[303, 297]
p03030
u997113115
2,000
1,048,576
You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i. No two restaurants have the same score. You want to in...
['N = int(input())\nlist = []\nfor i in range(N):\n S, P = input().split()\n list.append([S, int(P), i+1])\n\nlist = sorted(list, key=lambda x:(x[0],-x[1]))\nprint(list)\n', 'N = int(input())\nlist = []\nfor i in range(N):\n S, P = input().split()\n list.append([S, int(P), i+1])\n\nlist = sorted(list, key=l...
['Wrong Answer', 'Accepted']
['s841906191', 's176676312']
[2940.0, 3060.0]
[24.0, 17.0]
[167, 196]
p03031
u007263493
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['import intertools\n\nn , m = map(int,input().split())\nsw = [[] for _ in range(m)]\nfor i in range(m):\n sw[i] = list(map(int,input().split()[1::]))\n\nans = 0\n\nfor tpl in intertools.product([0,1],repeat = n):\n bl = True\n for i in range(m):\n s = sum(tpl[s-1] for s in sw[i])\n if (s-p[i])%2...
['Runtime Error', 'Accepted']
['s076621089', 's767382323']
[3064.0, 3188.0]
[17.0, 26.0]
[390, 424]
p03031
u016901717
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
[', M = [int(x) for x in input().split()]\nK = [[0]*N]*M\nfor i in range(M):\n K[i] = [int(x) for x in input().split()]\nP = [int(x) for x in input().split()]\ntotal = 0\nfor i in range(2 ** N):\n lamp = [0] * N\n for j in range(N):\n if ((i >> j) & 1):\n lamp[j] = 1\n flag = True\n for x...
['Runtime Error', 'Accepted']
['s598684879', 's234815036']
[2940.0, 3064.0]
[17.0, 39.0]
[518, 519]
p03031
u026155812
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['from itertools import product\nN, M = map(int, input().split())\ndenkyu = []\nfor i in range(M):\n denkyu.append([int(j) for j in input().split()])\np = [int(i) for i in input().split()]\nls = [0, 1]\nans = 0\nfor x in product(ls, repeat=N):\n num = 0\n for denkyu_, j in enumerate(denkyu):\n judge_lig...
['Runtime Error', 'Accepted']
['s994714655', 's134928833']
[3064.0, 3064.0]
[18.0, 43.0]
[546, 528]
p03031
u026402121
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N,M = map(int, input().split())\n \ns = [list(map(int, input().split()))[1:] for _ in range(M)]\np = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(2 ** N):\n flag = True\n for j in range(M):\n if not([(i >> k-1) for k in s[j]].count(1) % 2 == p[j] & 1):\n flag = False\n if fl...
['Wrong Answer', 'Accepted']
['s774518367', 's980223080']
[3064.0, 3064.0]
[32.0, 37.0]
[338, 339]
p03031
u028014940
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['\n\n\n\nN,M = map(int,input().split())\nsw = [[] for _ in range(M)]\n# print(sw) # [[], [], ..., []]\n\nfor i in range(M):\n sw[i] = list(map(int,input().split()[1:]))\n\n\nimport itertools\n\nanswer = 0\nfor tpl in itertools.product([0,1],repeat=N):\n bl = True\n for i in range(M):\n \n s = sum([tpl[s-1] ...
['Runtime Error', 'Accepted']
['s783648634', 's462454917']
[3064.0, 3064.0]
[19.0, 26.0]
[523, 562]
p03031
u042113240
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N, M = input().split()\nK = []\nP = []\nadjacent = [[0] for i in range(M)]\nfor i in range(M):\n A = list(input())\n K[i] = A[0]\n adjacent[i] = A[1:]\nP = list(input())\nX = 0\na = [[0] for i in range(M)]\nfor i in range(2**N):\n b = []\n for j in range(N):\n if i%2 == 1:\n b.append(j)\n i = i//2\n ...
['Runtime Error', 'Accepted']
['s771122698', 's317906348']
[3064.0, 3188.0]
[18.0, 41.0]
[424, 491]
p03031
u047393579
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["N, M = map(int, input().split())\nk = []\nlis = []\nP = []\nfor _ in range(M):\n x = list(map(int, input().split()))\n k.append(x[0])\n lis.append(x[1:])\nfor p in map(int, input().split()):\n P.append(p)\ncount = 0\nfor i in range(2**N):\n flag = True\n string = str(bin(i)[2:])[::-1]\n for index...
['Wrong Answer', 'Accepted']
['s702493367', 's762451129']
[3064.0, 3064.0]
[32.0, 31.0]
[590, 591]
p03031
u049979154
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n, m = map(int, input().split())\n\n\nk = []\ns = []\nans = 0\n\nfor i in range(m):\n k_temp, *s_temp = list(map(int, input().split()))\n k.append(k_temp)\n s.append(s_temp)\n\np = list(map(int, input().split()))\n\nfor bit in range(1 << n):\n light_on = 0\n for i in range(m):\n switch_on = 0\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s615948704', 's910511398', 's256294611']
[3064.0, 3064.0, 3192.0]
[49.0, 35.0, 55.0]
[510, 686, 516]
p03031
u051393148
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["N, M = map(int, input().split())\nbi_N = [i+1 for i in range(2**N-1)]\nans = 0\nl = []\nfor i in range(M):\n l.append(list(map(int, input().split())))\np = list(map(int, input().split()))\nfor i in bi_N[::-1]:\n a = format(i,'b')\n a = str(format(a, '0>10'))\n bi_a = [a[i] for i in range(10)]\n for z, (j, k) in ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s455176258', 's637164414', 's857737180', 's405933914']
[3824.0, 3188.0, 3064.0, 3064.0]
[76.0, 18.0, 33.0, 29.0]
[504, 106, 477, 301]
p03031
u062459048
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N, M = map(int, input().split())\nKS = []*M\nfor i in range(M):\n KS[i]= list(map(int, input().split()))\nP = list(map(int, input().split()))\n\nans = 0\nfor i in range(N**2):\n sl = []\n for j in range(N):\n if (i>>j)&1:\n sl.append(j+1)\n for j in range(M):\n if len(set(KS[j][1:])&set(sl))%2 ==P[j]:\...
['Runtime Error', 'Accepted']
['s029645940', 's246927484']
[3064.0, 3064.0]
[19.0, 29.0]
[383, 397]
p03031
u065079240
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['import numpy as np\nN, M = map(int, input().split())\nlamplist = []\nfor i in range(M):\n A = list(map(int, input().split()))\n lamplist.append(A)\noddeven_ans = list(map(int, input().split()))\nprint("{}".format(oddeven_ans))\nprint("{}".format(lamplist))\nswitch = np.zeros(N)\nans = 0\nfor j in range(N * N):\...
['Wrong Answer', 'Accepted']
['s810254458', 's055256785']
[14452.0, 14448.0]
[206.0, 263.0]
[718, 717]
p03031
u067694718
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n, m = [int(i) for i in input().split()]\nk = []\ns = []\nfor i in range(m):\n tmp = [int(i) for i in input().split()]\n k.append(tmp[0])\n s += [tmp[1:]]\np = [int(i) for i in input().split()]\ncnt = 0\n\nfor b in range(1 << n):\n sw = [0] * n\n for i in range(n):\n if b & (1 << i): sw[i] = 1\n...
['Wrong Answer', 'Accepted']
['s316301424', 's208848859']
[3188.0, 3188.0]
[29.0, 36.0]
[462, 516]
p03031
u077003677
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['import sys\nimport os\nfrom itertools import combinations\n\ndef file_input():\n f = open(\'ABC128/input.txt\', \'r\')\n sys.stdin = f\n\ndef main():\n #file_input()\n # int(input())\n N,M=map(int, input().split()) #N:switch M:light\n s=[[] for i in range(M)]\n k=[]\n for i in range(M):\n ...
['Wrong Answer', 'Accepted']
['s034284003', 's883263922']
[3188.0, 3064.0]
[68.0, 67.0]
[982, 984]
p03031
u085035133
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['# -*- coding: utf-8 -*-\n\nn, m = map(int, input().split())\n\nlamps = [list(map(lambda x: int(x)-1, input().split()))[1:] for _ in range(n)]\np = map(int, input().split())\n\nans = 0\n\nfor i in range(1 << n):\n for r in range(m):\n on_sum=0\n for j in range(n):\n if i >> j & 1 and j in l...
['Runtime Error', 'Accepted']
['s656471845', 's483956082']
[9128.0, 9164.0]
[25.0, 44.0]
[432, 438]
p03031
u087187808
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n, m = map(int, input().split())\na = [[] for i in range(m)]\nfor i in range(m):\n t = list(map(int, input().split()))\n a[i] = t[1:]\n\np = list(map(int, input().split()))\nans = 0\nfor i in range(1<<n):\n p_ = p[:]\n for j in range(n):\n if not (i & (1<<j)):\n continue\n for k i...
['Runtime Error', 'Accepted']
['s185424668', 's369642400']
[3064.0, 3188.0]
[17.0, 37.0]
[411, 410]
p03031
u087731474
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["def add(s,d):\n sum=0\n for i in d[1:]:\n sum+=s[i] \n return sum\n\ndef check(m):\n for i in range(m):\n if add(s, d[i]) % 2 == p[i]:\n pass\n else :\n return -1\n return 1\n \n \nd = []\ns=[]\ninc=0\n\nn, m = (int(x) for x in input().split...
['Runtime Error', 'Runtime Error', 'Accepted']
['s472923969', 's979942482', 's951372057']
[3064.0, 3064.0, 3064.0]
[18.0, 18.0, 28.0]
[585, 602, 596]
p03031
u089925107
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["from itertools import product\nN,M = map(int,input().split())\ncc = []\nfor i in range(M):\n ll = list(map(int,input().split()))\n cc.append(ll)\np = list(map(int,input().split()))\ncount = 0\nfor i in product('01',repeat = N):\n on = 0\n bulb = 0\n for j in range(M):\n for k in range(cc[j][0]):\n if i[c...
['Runtime Error', 'Accepted']
['s806022599', 's706891591']
[9100.0, 9188.0]
[25.0, 50.0]
[438, 437]
p03031
u094191970
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["n,m=map(int,input().split())\nl=[list(map(int,input().split())) for i in range(m)]\np=list(map(int,input().split()))\n\nans=0\nfor i in range(2**n):\n# bit=format(i,'011b')\n# bit=list(reversed(format(i,'b')))\n bit=bin(i)\n print(bit)\n \n num=0\n for j in range(m):\n に接続されている各スイッチ\n cnt=0\n for k in...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s490526445', 's524869890', 's789449983']
[3608.0, 3064.0, 3064.0]
[70.0, 17.0, 44.0]
[597, 405, 406]
p03031
u102731033
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['import numpy as np\nn,m = map(int,input().split())\nk_and_s = list(list(map(int,input().split()))for i in range(m))\np = list(map(int,input().split()))\nk = []\ns = []\np1 = np.array(p)\nprint("p1 = ",p1,"\\n")\nfor i in range(m):\n k.append(k_and_s[i][0:1][0])\n s.append(k_and_s[i][1:])\nswitch = np.array([[0 ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s045134583', 's118199240', 's769213250']
[12856.0, 2940.0, 3064.0]
[1367.0, 17.0, 20.0]
[809, 331, 872]
p03031
u103902792
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m = map(int,input().split())\nss = []\nfor _ in range(m):\n s = list(map(int,input().split()))[1:]\n ss.append()\nps = list(map(int,input().split()))\n\ndef get_bit(i,n):\n res = []\n for i in range(n):\n res.append(i%2)\n i = int(i/2)\n return res[::-1]\n\nans = 0\nfor i in range(2**n):\n flags = get_b...
['Runtime Error', 'Accepted']
['s937012817', 's144316348']
[3188.0, 3064.0]
[22.0, 31.0]
[485, 488]
p03031
u105608888
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N, M = map(int, input().split())\nA = []\nfor _ in range(M):\n A.append(tuple(map(int, input().split())))\nP = tuple(map(int, input().split()))\nimport itertools\ndef hantei(A, RETU, P):\n for i in range(len(A)):\n count = 0\n for k in RETU:\n if k in A[i][1:]:\n count +=...
['Runtime Error', 'Accepted']
['s600003848', 's370271391']
[9120.0, 9232.0]
[29.0, 35.0]
[568, 570]
p03031
u106778233
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N,M=map(int,input().split())\nks=[list(map(int,input().split())) for _ in range(M)]\np=list(map(int,input().split()))\nans=0\nfor s in range(1<<N):\n for j in range(M):\n cnt=0\n for h in ks[j][1:]:\n h-=1\n if (s>>h)&1:\n cnt+=1\n cnt%=2\n i...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s113392148', 's384976786', 's886888174', 's373742012']
[3064.0, 3064.0, 3064.0, 3064.0]
[21.0, 17.0, 20.0, 33.0]
[376, 368, 377, 373]
p03031
u107915058
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['ans = 0\nfor i in range(1<<n): \n sw = [False]*m \n for j in range(m): \n cnt = 0\n for k in range(1,len(s[j])): \n if i>>s[j][k]&1:\n cnt += 1\n if cnt%2==p[j]:\n sw[j]=True\n if all(sw):\n ans+=1\nprint...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s294440818', 's347889005', 's356407834', 's677569429', 's869485931', 's872394026', 's965033448', 's810223367']
[9076.0, 9160.0, 9140.0, 9220.0, 9052.0, 9060.0, 8932.0, 9116.0]
[25.0, 52.0, 26.0, 23.0, 26.0, 28.0, 25.0, 58.0]
[442, 570, 516, 515, 459, 387, 569, 515]
p03031
u111365362
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m = map(int,input().split())\nls = []\nfor _ in range(m):\n tmp = list(map(int,input().split()))[1:]\n lls = []\n for i in range(1,n+1):\n lls += [int(i in tmp)]\n ls += [lls]\np = list(map(int,input().split()))\ncount = 0\nyyy = [0]*n\nwhile True:\n if yyy[-1] == 2:\n break\n for mi in range(m):\n d...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s034210102', 's576487663', 's598708478']
[3188.0, 3064.0, 3064.0]
[88.0, 18.0, 35.0]
[556, 348, 613]
p03031
u113971909
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N,M=map(int,input().split())\nmod = 10**9+7\nfram = [1]\nfor i in range(1,N+1):\n fram.append(fram[-1]*i%mod)\n\n#def framod(n, mod, a=1):\n\n\n# return a\n\ndef power(n, r, mod):\n if r == 0: return 1\n if r%2 == 0:\n return power(n*n % mod, r//2, mod) % mod\n if r%2 == 1:\n return n * pow...
['Runtime Error', 'Accepted']
['s789780489', 's149247441']
[3064.0, 3188.0]
[17.0, 31.0]
[741, 482]
p03031
u116233709
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m=map(int,input().split())\ns=[list(map(int,input().split()))[1:] for i in range(m)]\np=list(map(int,input().split()))\ncnt=0\n\nfor i in range(2**n):\n pattern=format(i,"b").zfill(n)\n point=0\n \n for j in range(m):\n swi=0\n for k in s[j]:\n if pattern[k-1]=="1":\n ...
['Runtime Error', 'Accepted']
['s339742314', 's162258714']
[3188.0, 3064.0]
[19.0, 35.0]
[408, 409]
p03031
u117980998
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['s = []\nkmask = []\nn,m = map(int,input().split())\n\nfor i in range(m):\n s.append( list(map(int,input().split())) )\np = list(map(int,input().split()))\n\nfor i in s:\n mask = 0\n for j in i[1:]:\n mask |= 1<<(j-1) \n kmask.append(mask)\n\nresult = 0\nfor i in range(0<<n):\n ok = True\n...
['Wrong Answer', 'Accepted']
['s404650087', 's905809069']
[3064.0, 3064.0]
[18.0, 21.0]
[476, 527]
p03031
u131881594
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m=map(int,input().split())\nsw=[[]*m]\nfor _ in range(m):\n temp=list(map(int,input().split()))\n sw[_]=temp[1:]\np=list(map(int,input().split()))\nans=0\nfor i in range(2**n):\n temp=[0]*n\n for j in range(n):\n if i&1: temp[j]=1\n i>>=1\n flag=1\n for l,s in enumerate(sw):\n ...
['Runtime Error', 'Accepted']
['s244176269', 's816519911']
[9228.0, 9168.0]
[27.0, 37.0]
[458, 474]
p03031
u133936772
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['f=lambda:[*map(int,input().split())]\nn,m=f()\nS=[f()[1:] for _ in [0]*m]\np=f()\nprint(sum(all(sum(i>>-~k for k in S[j])%2==p[j] for j in range(m)) for i in range(2**n)))', 'f=lambda:[*map(int,input().split())]\nn,m=f()\nS=[f()[1:] for _ in [0]*m]\np=f()\nprint(sum(all(sum(i>>~-k for k in S[j])%2==p[j] for j in rang...
['Wrong Answer', 'Accepted']
['s127234784', 's684119974']
[9120.0, 9088.0]
[37.0, 36.0]
[167, 167]
p03031
u143509139
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N, M = map(int, input().split())\ns = [list(map(int, input().split()))[1:] for _ in range(M)]\np = list(map(int, input().split()))\nli = [[] for _ in range(N)]\nfor i in range(M):\n for ma in s[i]:\n li[ma - 1].append(i)\nans = 0\nprint(li)\nfor i in range(2 ** N):\n l = [0] * M\n for j in range(N):\n...
['Wrong Answer', 'Accepted']
['s149910212', 's932853535']
[3064.0, 3064.0]
[26.0, 39.0]
[427, 335]
p03031
u152891327
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N,M = map(int, input().split())\nsbit = [0] * M\nfor i in range(M):\n l = list(map(int, input().split()))\n bit = 0\n for j in range(1, l[0]):\n bit += 1 << l[j + 1]\n sbit[i] = bit\np = list(map(int, input().split()))\n\ntotal = 0\nfor tbit in range(2 ** N):\n flg = True\n for i in range(M):\n bit = sbi...
['Wrong Answer', 'Accepted']
['s804882324', 's079557281']
[3064.0, 3064.0]
[23.0, 31.0]
[497, 503]
p03031
u156815136
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["#from statistics import median\n#import collections\n#aa = collections.Counter(a) # list to list\n#from itertools import combinations # (string,3) 3回\n#\n#\n\n#\n#\n\nmod = 10**9 + 7\n\ndef readInts():\n return list(map(int,input().split()))\ndef main():\n n,m = readInts()\n \n \n A = []\n for i in ra...
['Wrong Answer', 'Accepted']
['s221340158', 's976485482']
[3952.0, 3064.0]
[93.0, 31.0]
[1039, 1040]
p03031
u173178698
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["from scipy.special import comb\nn,m = map(int,(input().split()))\nbulb = [0]*m\np = [0]*m\nj = 1\nodd = 0\neven = 0\nfor i in range(m):\n bulb[i] = list(map(int,input().split()))\np = list(map(int,input().split()))\n\nfor i in range(m):\n print('bulb='+str(bulb[i][0]))\n if not bulb[i][0]%2==p[i]:\n p...
['Runtime Error', 'Accepted']
['s720954002', 's769821275']
[14456.0, 3064.0]
[194.0, 56.0]
[737, 439]
p03031
u173374079
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['#!/usr/bin/python\n# coding: UTF-8\n\nn,m = map(int,input().split())\n\ns = []\nfor i in range(m):\n s += [tuple(map(int,input().split())),]\n\np = list(map(int,input().split()),)\n\nret = 0\nall = [(str(bin(i)))[2:].zfill(m) for i in range(2 ** n),]\nall = [[int(i) for i in case] for case in all,]\nfor case in al...
['Runtime Error', 'Accepted']
['s501635644', 's823869418']
[2940.0, 3316.0]
[17.0, 44.0]
[942, 616]
p03031
u175590965
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m = map(int,input().split())\ns = [list(map(int,input().split()))[1:]for i in range(m)]\np = list(map(int,input().split()))\nform = "0"+str(n)+"b"\nans = 0\nfor i in range(2**n):\n ptn = format(i,form)\n light = True\n for j in range(m):\n s = sum(int(ptn[k-1])for k in s[j])\n if s%2 != p[j]:...
['Runtime Error', 'Runtime Error', 'Accepted']
['s737507157', 's814177077', 's152803766']
[3064.0, 3064.0, 3064.0]
[17.0, 45.0, 49.0]
[384, 438, 385]
p03031
u181195295
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N,M = map(int,input().split())\nswis = [list(map(int,input().split()))[1:] for _ in range(M)]\nneed = list(map(int,input().split()))\n\nans = 0\nfor i in range(1<<N):\n for j in range(M):\n rel=0\n for k in swis[j]:\n if i & (1<<(k-1)) != 0:\n rel+=1\n \n if rel%2 != need[j]:\n b...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s470436466', 's847489380', 's866895797']
[3064.0, 3064.0, 3064.0]
[27.0, 26.0, 29.0]
[416, 413, 414]
p03031
u193598069
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n, m = map(int, input().split())\nlst = [list(map(int, input().split())) for i in range(m)]\np = list(map(int, input().split()))\nans = 0\n\nfor i in range(2**n):\n bulb = [0] * m\n for j in range(n):\n if i>>j & 1:\n for k in range(m):\n if j+1 in lst[k][1:]:\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s009458467', 's096772423', 's194569433', 's218756234', 's523985463', 's935836821', 's120924008']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3188.0, 3064.0]
[18.0, 17.0, 18.0, 17.0, 18.0, 18.0, 43.0]
[404, 500, 499, 463, 383, 463, 500]
p03031
u194894739
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N, M = map(int, input().split())\nlightList = []\nfor _ in range(M):\n lightList.append(list(map(int, input().split())))\nP = list(map(int, input().split()))\n\nans = 0\nfor i in range(2**N):\n flag = True\n for a in range(M):\n cnt = 0\n for b in lightList[a][1:]:\n if not (i & (1<<...
['Wrong Answer', 'Accepted']
['s799886558', 's564077430']
[3064.0, 3064.0]
[40.0, 44.0]
[430, 430]
p03031
u195054737
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n, m = map(int ,input().split())\ns = [list(map(int, input().split())) for _ in range(m)]\np = [int(i) for i in input().split()]\n\nans = 0\nfor i in range(1 << n):\n check = []\n for j in range(n):\n if i >> j & 1:\n check.append(j)\n\n check = set(check)\n\n flag = True\n for j in r...
['Wrong Answer', 'Accepted']
['s049096911', 's574627646']
[3064.0, 3064.0]
[27.0, 33.0]
[550, 454]
p03031
u200527996
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['from numpy import*\nn, m = map(int, input().split())\nl = []\nfor i in range(m):\n *a,=map(int,input().split())\n l.append(a[1:])\n*p,=map(int,input().split())\nans = 0\nfor t in range(2**n):\n for s in range(n):\n tmp = array([t >> s & 1])\n for i in l:\n if p == sum(tmp[array(i)-1])%2:\n ...
['Runtime Error', 'Accepted']
['s027205990', 's493541789']
[12484.0, 12448.0]
[151.0, 342.0]
[334, 303]
p03031
u222668979
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['from itertools import product\n\nn, m = map(int, input().split())\nks = [list(map(int, input().split())) for _ in range(m)]\np = list(map(int, input().split()))\n\ncnt = 0\nfor pat in product([0, 1], repeat=n):\n for ksi, pi in zip(ks, pi):\n tmp = sum(pat[ksij - 1] for ksij in ksi[1:])\n if tmp % 2...
['Runtime Error', 'Accepted']
['s097149618', 's509037215']
[9188.0, 9092.0]
[27.0, 36.0]
[372, 369]
p03031
u223904637
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m=map(int,input().split())\ns=[]\nfor i in range(m):\n s.append(list(map(int,input().split())))\np=list(map(int,input().split()))\n\nonoff=[["0"],["1"]]\n\nfor i in range(n):\n tmp=[]\n for j in onoff:\n tmp.append(j+["0"])\n tmp.append(j+["1"])\n onoff=tmp\n\nans=0\nfor i in onoff:\n f...
['Wrong Answer', 'Accepted']
['s606850448', 's335787141']
[3444.0, 3188.0]
[75.0, 45.0]
[506, 508]
p03031
u237656255
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n, k = [int(a) for a in input().split()]\nv = [int(a) for a in input().split()]\n\n\ncap = min(n, k)\nmax_val = 0\nfor left in range(k):\n for right in range(cap - left):\n rest = k - (left + right)\n l_popped = v[:left]\n r_popped = v[-right:] if right > 0 else []\n popped = l_popped +...
['Wrong Answer', 'Accepted']
['s014903272', 's735527440']
[3064.0, 3064.0]
[17.0, 37.0]
[640, 434]
p03031
u239342230
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['ans = 0\nn,m = map(int, input().split())\ns_list = []\ns_count_list = []\nfor _ in range(m):\n s = list(map(int,input().split()))\n s_count_list.append(s[0])\n s_list.append(s[1:])\noe = list(map(int,input().split())) \nseq = list(range(1, n+1))\nfor i in range(1, n+1):\n cmb = list(itertools.combinatio...
['Runtime Error', 'Accepted']
['s990828652', 's160154823']
[3064.0, 3064.0]
[17.0, 46.0]
[725, 478]
p03031
u247211039
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m = map(int,input().split())\nq = [list(map(int, input().split())) for i in range(m)]\nans = 0\n\nfor s in range(2**n): \n judge = True\n for i in range(m): \n cnt=0\n for j in range(1,len(q[i])): \n w=q[i][j]\n if s >> (w-1) &1 ==1: \n cnt+=1 \n if cn...
['Runtime Error', 'Accepted']
['s903718769', 's419641939']
[9140.0, 9040.0]
[27.0, 54.0]
[781, 818]
p03031
u248670337
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['#ABC128 C\nN, M = (int(_) for _ in input().split())\nA = [list(map(int, input().split()))[1:] for _ in range(M)]\nP = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n for j, S in enumerate(A):\n if P[j] ^ sum(i >> k-1 & 1 for k in S) & 1:\n break\n else:\n ans += 1\nprint(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s120391704', 's174931872', 's141133299']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 28.0]
[314, 316, 316]
p03031
u248967559
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N, M = list(map(int, input().split(" ")))\nS = []\nfor i in range(M):\n ks = list(map(int, input().split(" ")))\n S.append(ks[1:])\nP = list(map(int, input().split(" ")))\n\nswitchMap = []\nfor i in range(N):\n switchMap.append([])\nfor i, s in enumerate(S):\n for ss in s:\n switchMap[ss-1].append(...
['Wrong Answer', 'Accepted']
['s589468224', 's857067242']
[9224.0, 9112.0]
[38.0, 39.0]
[740, 742]
p03031
u250554058
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["n, m = map(int, input().split())\nlist_num = list([] for i in range(n))\ntest = [input().split() for i in range(m)]\ncheck = [0] * n\nfor i in test:\n list_num[int(i[0]) - 1].append(i[1])\ncount = 0\ncount_ac = 0\ncount_wa = 0\ncheck = 0\nfor i in list_num:\n for j in range(len(i)):\n if(i[j] =='WA'):\n cou...
['Wrong Answer', 'Accepted']
['s381717788', 's286460187']
[3064.0, 9192.0]
[17.0, 42.0]
[468, 545]
p03031
u259861571
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N, M = map(int, input().split())\nks = [list(map(int, input().split())) for i in range(M)]\np = list(map(int, input().split()))\n\nans = 0\n\nfor bit in range(1 << N):\n flag = True\n for i in range(N):\n count = 0\n for v in ks[i]:\n if bit & (1<<(v-1)):\n cnt += 1\n ...
['Runtime Error', 'Accepted']
['s448829973', 's576269976']
[3064.0, 3064.0]
[17.0, 101.0]
[394, 445]
p03031
u261082314
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N, M = map(int,input().split())\nstate = []\nfor _ in range(M):\n lst = list(map(int, input().split()))\n state.append(lst[1:])\np = list(map(int, input().split()))#numbers switches on %2 == pi \nans = 0\nfor i in rage(2**n):\n total = 0\n for j in range(m):\n cnt = 0\n for s in state[j]:\n s -= 1\n ...
['Runtime Error', 'Accepted']
['s585973870', 's488025628']
[8984.0, 9060.0]
[30.0, 43.0]
[574, 597]
p03031
u262801165
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['import sys\nimport math\nimport collections\nfrom collections import deque\nfrom functools import reduce\nimport heapq\n#m = int(input())\nn, m = map(int, sys.stdin.readline().split())\n#s = input()\n#a = list(map(int, sys.stdin.readline().split()))\n\nl = []\nfor i in range(m):\n l.append(list(map(int, sys.stdin....
['Wrong Answer', 'Accepted']
['s937151917', 's482007849']
[3564.0, 3064.0]
[37.0, 50.0]
[703, 558]
p03031
u278356323
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['import sys\ninput = sys.stdin.readline\n\nn, m = map(int, input().split())\nk = []\nfor _ in range(m):\n k.append(list(map(int, input().split())))\np = list(map(int, input().split()))\n\ndenkyu = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]\nmemo = []\nmemos = []\n\n\ndef erabu(i, n, c, d):\n if (i > len(k[d][1:])):...
['Runtime Error', 'Accepted']
['s265147406', 's398534978']
[3064.0, 3064.0]
[18.0, 28.0]
[630, 735]
p03031
u298945776
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N, M = map(int, input().split(" "))\nbotlist = []\nans = 0\nfor n in range(M):\n bot = list(map(int, input().split(" ")))\n \n botlist.append(bot)\n#botlist\nplist = list(map(int, input().split(" ")))\n\npushlist = [[]for i in range(2**N)]\n\nfor p in range(N):\n M = (2**N)/(p+1)\n for q in range(M):\n...
['Runtime Error', 'Accepted']
['s141007878', 's796346768']
[3064.0, 3188.0]
[18.0, 48.0]
[653, 688]
p03031
u305366205
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N,K = map(int, input().split())\ncnt = 0\nwhile 2**cnt < K:\n cnt += 1\nresult = ((1/2)**cnt)/N\nfor i in range(2,N+1):\n while (2**cnt)+(2**cnt)*(i-1) >= K and cnt >= 0:\n cnt -= 1\n if cnt == -1:\n result += (N-i+1)/N\n break\n cnt += 1\n result += ((1/2)**cnt)/N\nprint(result)\n...
['Wrong Answer', 'Accepted']
['s707396700', 's623667510']
[3060.0, 3064.0]
[17.0, 30.0]
[304, 582]
p03031
u325492232
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["def abc128_c():\n \n N, M = map(int, input().split())\n\n connected_switches = []\n for i in range(M):\n # [k, s1, s2, ...sn][1:]\n tmp = list(map(int, input().split()))[1:]\n connected_switches.append(tmp)\n\n p = list(map(int, input().split()))\n\n ans = 0\n\n \n for i i...
['Wrong Answer', 'Accepted']
['s612641801', 's292791145']
[9068.0, 9104.0]
[43.0, 43.0]
[1386, 1258]
p03031
u327162583
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N,M = (int(i) for i in input().split())\ns = [[int(i) for i in input().split()] for i in range(M)]\np = [int(i) for i in input().split()]\nresult2 = 0\n\nfor i in range(2 ** N):\n hoge = bin(i + 1)\n hoge = str(hoge)\n hoge = hoge[2:]\n hoge = hoge.zfill(len(str(bin((2 ** N)))) - 2)\n result = True\n ...
['Wrong Answer', 'Accepted']
['s196647144', 's279572047']
[3188.0, 3064.0]
[39.0, 37.0]
[575, 535]
p03031
u330692748
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['# -*- coding: utf-8 -*-\n\nN, M = map(int, input().split())\nlights = [map(int, input().split()[1:]) for i in range(M)]\np = map(int, input().split())\n\ncombi = 0\nfor i in range(1<<N):\n flag = True\n for j, switch in enumerate(lights):\n if sum([1 for s in switch if (i>>(s-1)) & 1 == 1])%2 != p[j]:\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s026970781', 's967101725', 's229487002']
[3064.0, 3064.0, 3064.0]
[17.0, 22.0, 29.0]
[394, 400, 406]
p03031
u342869120
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["N, M = map(int, input().split())\nS = [0] * M\nfor i in range(M):\n _, *s, = map(int, input().split())\n for v in s:\n S[i] = S[i] | (2 << v)\n\n*P, = map(int, input().split())\n\nans = 0\nfor p in range(2**N):\n ok = True\n for i in range(M):\n b = format(p & S[i], 'b')\n if b.count(...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s526668592', 's780593449', 's995103178', 's049408972']
[3064.0, 3064.0, 3064.0, 3064.0]
[22.0, 26.0, 22.0, 23.0]
[402, 408, 406, 408]
p03031
u351480677
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m = map(int,input().split())\nks = [list(map(int,input().split())) for _ in range(m)]\np = list(map(int,input().split()))\n\n\nres = 0\nfor i in range(2**n):\n on = [0 for _ in range(n)]\n for j in range(n):\n if((i>>j)&1):\n on[j]=1\n all_on = True \n for j in range(m):\n on_nu...
['Wrong Answer', 'Accepted']
['s806912421', 's211893866']
[3064.0, 3064.0]
[29.0, 30.0]
[465, 519]
p03031
u361381049
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['k = []\n\nn, m = map(int, input().split())\nfor i in range(m):\n k.append(list(map(int, input().split())))\n del k[i][0] \n\np = list(map(int, input().split()))\n\ncnt = 0\nans = 0\nfor i in range(2 ** n):\n lis = [False] * n\n\n for j in range(n):\n if (i >> j) & 1:\n lis[j] = True\n ...
['Wrong Answer', 'Accepted']
['s222059918', 's815417020']
[3064.0, 3064.0]
[51.0, 46.0]
[650, 558]
p03031
u374802266
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N,M=input().strip().split()\nl1=[]\nwhile True:\n try:\n l1.append(list(map(int,input().split())))\n except:\n break;\nl2=l1[-1]\ndel l1[-1]\nn=0\ntate=0\nyoko=1\ncount1=0\ncount2=0\ncount3=0\nwhile True:\n while True: \n sw=str(bin(n))\n del sw[0]\n a=l1[tate][yoko]...
['Runtime Error', 'Accepted']
['s893104320', 's844091375']
[3064.0, 3064.0]
[18.0, 62.0]
[619, 376]
p03031
u375616706
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\n\ndef brute_force():\n N, M = map(int, input().split())\n lamps = [list(map(lambda x:int(x)-1, input().split()))[1:]\n for _ in range(M)]\n p = list(map(int, input().split()))\n ans = 0\n\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s511003467', 's774714772', 's782938254', 's047260969']
[3064.0, 3700.0, 3700.0, 3188.0]
[36.0, 52.0, 45.0, 34.0]
[693, 724, 728, 840]
p03031
u379794022
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['from itertools import product\n\nN, M = map(int, input().split())\nk = [0] * M\ns = [[0] for _ in range(M)]\nfor i in range(M):\n k[i], *s[i] = map(int, input().split())\np = list(map(int, input().split()))\na = list(product([0, 1], repeat=N)) \nprint(a)\n\nans = 0\nfor c in a: \n cnt = 0\n for i in range(...
['Wrong Answer', 'Accepted']
['s122864629', 's006617681']
[3316.0, 3188.0]
[37.0, 35.0]
[837, 839]
p03031
u381574135
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N, M = list(map(int, input().split()))\n\nk_list = []\ns_list = []\nfor i in range(M):\n k_s = list(map(int, input().split()))\n k_list.append(k_s[0])\n s_list.append(k_s[1:])\n\np_list = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(1 << N):\n all_list = True\n for j in range(M):\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s668498932', 's915518810', 's044508907']
[3064.0, 3064.0, 3064.0]
[38.0, 18.0, 49.0]
[484, 427, 508]
p03031
u384476576
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['N = int(N)\nM = int(M)\nline_list = []\nfor i in range(M):\n line = input().split()\n new_list=[]\n for l in line:\n new_list.append(int(l))\n new_list.pop(0)\n line_list.append(new_list)\nold_p_list = input().split()\np_list = []\nfor p in old_p_list:\n p_list.append(int(p))\n\nimport iterto...
['Runtime Error', 'Runtime Error', 'Accepted']
['s538414904', 's909690967', 's561002665']
[3064.0, 3064.0, 3316.0]
[17.0, 17.0, 35.0]
[781, 750, 773]
p03031
u391675400
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['from itertools import product\nn,m = map(int,(input().split()))\nsw =[list(map(int, input().split())) for _ in range(m)]\np = list(map(int, input().split()))\nans = 0\nfor bit in product([0, 1], repeat=n):\n onoff = [1] * n \n ele = True\n for i, j in enumerate(bit):\n if j == 1:\n onoff[i]...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s159939479', 's252348587', 's481824128']
[3064.0, 3064.0, 3064.0]
[27.0, 27.0, 28.0]
[595, 597, 543]
p03031
u396391104
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n, m = map(int,input().split())\nk = [list(map(int,input().split())) for i in range(m)]\np = list(map(int,input().split()))\n\nfor i in range(2**n):\n i_2 = str(bin(i))[2:]\n i_bit = i_2.zfill(n)\n print(i_bit)\n ', 'N, M = map(int,input().split())\nK = [list(map(int,input().split())) for i in range(M)]\nP = list...
['Wrong Answer', 'Accepted']
['s591062186', 's198889355']
[3188.0, 3064.0]
[19.0, 64.0]
[209, 646]
p03031
u397020326
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n, m = map(int, input().split())\nk_s = [list(map(int, input().split())) for i in range(m)]\np = list(map(int, input().split()))\n\nans = 0\n\nfor bit in range(1<<n):\n on = 0\n for i in range(m):\n numon = 0\n k = k_s[i][0]\n s = k_s[i][1:]\n for j in range(k):\n mask = 1<<s[j]\n if mask&bit:...
['Wrong Answer', 'Accepted']
['s723163520', 's824036604']
[9148.0, 9200.0]
[53.0, 56.0]
[403, 407]
p03031
u403660920
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m=map(int,input().split())\nList=[list(map(int,input().split())) for i in range(m)]\nP=list(map(int,input().split()))\n\nk=0\nans=0\nflug=True\n\nfor i in range(n):\n k=bin(i)\n for l in range(m):\n count=0\n for j in range(List[l][0]):\n if ((k>>List[l][j+1])&1)==1:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s719127687', 's887119202', 's587663505']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 49.0]
[421, 421, 417]
p03031
u405256066
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['from sys import stdin\nimport itertools\nN,M=[int(x) for x in stdin.readline().rstrip().split()]\ndata=[]\nfor i in range(M):\n data.append([int(x) for x in stdin.readline().rstrip().split()])\nP=[int(x) for x in stdin.readline().rstrip().split()]\nans=0\nfor n in list(itertools.product([0,1],repeat=N)):\n for ...
['Wrong Answer', 'Accepted']
['s651677317', 's936767979']
[3188.0, 3188.0]
[59.0, 33.0]
[562, 567]
p03031
u416758623
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['from numpy import *\nn,m = map(int, input().split())\n\ns = [[int(j) for j in input().split()][1:] for i in range(m)]\np = [int(i) for i in input().split()]\n\nans = 0\n\nfor i in range(2**n):\n b = array([(i >> j)&1 for j in range(n)])\n if [sum(b[array(k) - 1] % 2 for k in s)] == p:\n ans += 1\nprint(a...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s105043961', 's343382294', 's734837433', 's365998677']
[12500.0, 3064.0, 3064.0, 21044.0]
[272.0, 17.0, 18.0, 486.0]
[309, 276, 286, 307]
p03031
u427469869
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m = (int(x) for x in input().split())\nswi = []\nfor i in range(m):\n l = [int(x) for x in input().split()]\n t = 0\n for i in range(1,len(l)):\n t += 1 << (l[i]-1)\n swi.append(t)\nppp = [int(x) for x in input().split()]\n\nans = 0\nfor i in range(1 << n):\n for s, p in zip(swi,ppp):\n t = i & s\n c ...
['Wrong Answer', 'Accepted']
['s262808071', 's362775468']
[3064.0, 3064.0]
[21.0, 20.0]
[399, 618]
p03031
u430928274
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['\nn, m = map(int, input().split())\nk = [] ; s = []\nans = 0\n\nfor i in range(m) :\n data = list(map(int, input().split()))\n k.append(data[0])\n s.append(data[1:])\np = list(map(int, input().split()))\n\n\nfor i in range(2**n) :\n for r in range(m) :\n on = 0\n for j in range(n) :\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s515736865', 's685770413', 's884057659']
[9192.0, 8876.0, 9120.0]
[42.0, 26.0, 44.0]
[622, 564, 571]
p03031
u433532588
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['give up', '\nimport sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\n##############################\n\nN, M = map(int, input().split())\nKS = []\nfor i in range(M):\n ks = list(map(int, input().split()))\n KS.append(ks)\n\nP = list(map(int,input().split()))\n\ncount = 0\nfor i in range(2 ** N):\n ...
['Runtime Error', 'Accepted']
['s063565304', 's775263885']
[2940.0, 3064.0]
[17.0, 37.0]
[7, 823]
p03031
u436982376
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['n,m=map(int,input().split())\n\nlamp=[]\nswitches=[]\ntemp=[]\n\nfor i in range(m):\n temp=list(map(int,input().split()))\n lamp.append(temp.pop(0))\n switches.append(temp)\n temp=[]\n\nmodul=list(map(int,input().split()))\n\nbit_list=[]\n\nfor i in range(2**(n)):\n bit_list.append(bin(i)[2:].zfill(n))...
['Wrong Answer', 'Accepted']
['s115334529', 's036306505']
[3064.0, 9104.0]
[27.0, 40.0]
[586, 574]
p03031
u440129511
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["n,m=map(int,input().split())\nl=[list(map(int,input().split())) for _ in range(m)]\np=list(map(int,input().split()))\nc=0\nfor i in range(2**n):\n xi=format(i,'b').zfill(n)\n light_count=0\n for j in range(m):\n xl=[i for i, x in enumerate(xi) if x == '1']\n c1=0\n for k in range(1,len(l...
['Wrong Answer', 'Accepted']
['s003822134', 's597626620']
[3188.0, 3188.0]
[58.0, 59.0]
[422, 424]
p03031
u442877951
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
["N,M = map(int,input().split())\nKS = [[int(x) for x in input().split()] for _ in range(M)]\nP = list(map(int, input().split()))\nans = 0\nfor i in range(2**N):\n switch_pattern = bin(i)[2:].zfill(N)\n succes = 1\n for j in range(M):\n for k in KS[j]:\n switch_on = 0\n if switch_pattern[k-1...
['Wrong Answer', 'Accepted']
['s262180628', 's219712592']
[3064.0, 3064.0]
[25.0, 28.0]
[463, 430]
p03031
u446331452
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['import numpy as np\nimport itertools\n#N, M = list(map(int, input().split()))\nN = 2\nM = 2\ntmp = [[int(i) for i in input().split()] for i in range(M)]\np = list(map(int, input().split()))\nans = 0\nfor switch in itertools.product(range(2),repeat=N):\n #print(switch)\n num_clear_light = 0\n for i in range(M...
['Runtime Error', 'Accepted']
['s585461098', 's922756113']
[14088.0, 12408.0]
[153.0, 175.0]
[614, 601]
p03031
u449473917
2,000
1,048,576
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
['# coding: utf-8\n# Your code here!\nn,m=map(int,input().split())\nl=[]\nfor i in range(m):\n a=input().split()\n l.append(a)\np=list(map(int,input().split()))\n\nl2=[0]*10\nans=0\nnum=0\nfor a in range(0,2):\n for b in range(0,2):\n for c in range(0,2):\n for d in range(0,2):\n ...
['Wrong Answer', 'Accepted']
['s157292496', 's055111948']
[3064.0, 3188.0]
[19.0, 30.0]
[1514, 584]