x,y=map(int,input().split())
L=[]
for i in range(x):
L+=[list(map(int,input().split()))]
q=int(input())
for i in range(q):
M=list(map(int,input().split()))
b=0
for j in range(x):
t=1
for c in range(y):
if M[c]==L[j][c] or M[c]==-1:
continue
else:
t=0
break
if t: b+=1
print(b)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
194 ms |
14128 KB |
Output is correct |
2 |
Correct |
143 ms |
10288 KB |
Output is correct |
3 |
Correct |
441 ms |
24496 KB |
Output is correct |
4 |
Correct |
127 ms |
8368 KB |
Output is correct |
5 |
Correct |
293 ms |
19880 KB |
Output is correct |
6 |
Correct |
503 ms |
28208 KB |
Output is correct |
7 |
Correct |
625 ms |
36272 KB |
Output is correct |
8 |
Correct |
370 ms |
24420 KB |
Output is correct |
9 |
Correct |
268 ms |
16308 KB |
Output is correct |
10 |
Correct |
594 ms |
35248 KB |
Output is correct |