#include <bits/stdc++.h>
using namespace std;
long long n, m, q, t, l[1001], a[1001][1001];
bool good;
int main(){
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 >> l[j];
t = 0;
for(int j = 0; j < n; j++){
good = true;
for(int k = 0; k < m; k++){
if(l[k] != -1 && l[k] != a[j][k]){
good = false; break;
}
}
if(good) t++;
}
cout << t << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
130 ms |
3832 KB |
Output is correct |
2 |
Correct |
99 ms |
3832 KB |
Output is correct |
3 |
Correct |
262 ms |
10880 KB |
Output is correct |
4 |
Correct |
66 ms |
3320 KB |
Output is correct |
5 |
Correct |
215 ms |
5980 KB |
Output is correct |
6 |
Correct |
302 ms |
9572 KB |
Output is correct |
7 |
Correct |
409 ms |
12900 KB |
Output is correct |
8 |
Correct |
253 ms |
7800 KB |
Output is correct |
9 |
Correct |
157 ms |
7884 KB |
Output is correct |
10 |
Correct |
387 ms |
10688 KB |
Output is correct |