#include <bits/stdc++.h>
using namespace std;
int n;
int m;
int main()
{
ios_base::sync_with_stdio(false);
cin >> n >> m;
vector<vector<int>> a(n, vector<int>(m));
for(int i = 0; i < n; i ++){
for(int j = 0; j < m; j ++){
cin >> a[i][j];
}
}
int q;
cin >> q;
while(q --){
vector<int> t(m);
for(auto &x: t) cin >> x;
int res = 0;
for(int i = 0; i < n; i ++){
int good = 1;
for(int j = 0; j < m; j ++){
if(t[j] == -1) continue;
good &= (t[j] == a[i][j]);
}
res += good;
}
cout << res << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
2680 KB |
Output is correct |
2 |
Correct |
28 ms |
1920 KB |
Output is correct |
3 |
Correct |
141 ms |
5368 KB |
Output is correct |
4 |
Correct |
23 ms |
1596 KB |
Output is correct |
5 |
Correct |
69 ms |
4088 KB |
Output is correct |
6 |
Correct |
156 ms |
6008 KB |
Output is correct |
7 |
Correct |
233 ms |
7988 KB |
Output is correct |
8 |
Correct |
110 ms |
5240 KB |
Output is correct |
9 |
Correct |
61 ms |
3192 KB |
Output is correct |
10 |
Correct |
186 ms |
7676 KB |
Output is correct |