N,M=map(int,input().split())
L=[]
for i in range(N):
L+=[list(map(int,input().split()))]
Q=int(input())
R=Q*[0]
for x in range (Q):
Z=list(map(int,input().split()))
for y in range(N):
for z in range(M):
if Z[z]!=-1 and Z[z]!=L[y][z]:
break
if z==M-1:
R[x]+=1
for i in range(Q):
print(R[i])
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
203 ms |
13628 KB |
Output is correct |
2 |
Correct |
146 ms |
10172 KB |
Output is correct |
3 |
Correct |
435 ms |
24652 KB |
Output is correct |
4 |
Correct |
121 ms |
8380 KB |
Output is correct |
5 |
Correct |
300 ms |
19952 KB |
Output is correct |
6 |
Correct |
485 ms |
28424 KB |
Output is correct |
7 |
Correct |
625 ms |
36124 KB |
Output is correct |
8 |
Correct |
386 ms |
24492 KB |
Output is correct |
9 |
Correct |
279 ms |
16160 KB |
Output is correct |
10 |
Correct |
573 ms |
35284 KB |
Output is correct |