#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int a[N][N], n, m, b[N];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n >> m;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
cin >> a[i][j];
int qq; cin >> qq;
for (; qq; qq--){
for (int i = 0; i < m; i++)
cin >> b[i];
int ans = 0;
for (int i = 0; i < n; i++){
bool ok = 1;
for (int j = 0; j < m && ok; j++)
if (b[j] > 0 && b[j] != a[i][j])
ok = 0;
ans += ok;
}
cout << ans << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
1408 KB |
Output is correct |
2 |
Correct |
18 ms |
1664 KB |
Output is correct |
3 |
Correct |
54 ms |
4088 KB |
Output is correct |
4 |
Correct |
14 ms |
1664 KB |
Output is correct |
5 |
Correct |
41 ms |
1920 KB |
Output is correct |
6 |
Correct |
61 ms |
3192 KB |
Output is correct |
7 |
Correct |
85 ms |
4216 KB |
Output is correct |
8 |
Correct |
52 ms |
2552 KB |
Output is correct |
9 |
Correct |
32 ms |
3704 KB |
Output is correct |
10 |
Correct |
115 ms |
3192 KB |
Output is correct |