#include<bits/stdc++.h>
using namespace std;
long a[1002][1002], b[1002][1002];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n, m, q, x = 0, ok = 1;
cin >> n >> m;
for(int i = 0; i < n; ++i)
for(int j = 0; j < m; ++j) cin >> a[i][j];
cin >> q;
for(int i = 0; i < q; ++i)
for(int j = 0; j < m; ++j) cin >> b[i][j];
for(int Q = 0; Q < q; ++Q){
for(int i = 0; i < n; ++i){
for(int j = 0; j < m; ++j) if(b[Q][j] != -1 and a[i][j] != b[Q][j]){
ok = 0;
break;
}
if(ok) ++x;
ok = 1;
}
cout << x << endl;
x = 0;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
4088 KB |
Output is correct |
2 |
Correct |
21 ms |
5756 KB |
Output is correct |
3 |
Correct |
59 ms |
13848 KB |
Output is correct |
4 |
Correct |
18 ms |
13848 KB |
Output is correct |
5 |
Correct |
44 ms |
13848 KB |
Output is correct |
6 |
Correct |
65 ms |
19092 KB |
Output is correct |
7 |
Correct |
87 ms |
26132 KB |
Output is correct |
8 |
Correct |
55 ms |
26132 KB |
Output is correct |
9 |
Correct |
39 ms |
28628 KB |
Output is correct |
10 |
Correct |
85 ms |
33504 KB |
Output is correct |