#include <stdio.h>
#include <algorithm>
int read(int x = 0, int f = 0, char ch = getchar())
{
while ('0' > ch or ch > '9')
f = ch == '-', ch = getchar();
while ('0' <= ch and ch <= '9')
x = x * 10 + (ch ^ 48), ch = getchar();
return f ? -x : x;
}
const int N = 1e3 + 5;
int n, m;
int a[N][N], b[N];
int main()
{
n = read(), m = read();
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
a[i][j] = read();
for (int q = read(); q--;)
{
for (int i = 1; i <= m; i++)
b[i] = read();
int res = 0;
for (int i = 1; i <= n; i++)
{
bool flag = true;
for (int j = 1; j <= m; j++)
if (b[j] ^ -1)
flag &= b[j] == a[i][j];
res += flag;
}
printf("%d\n", res);
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
2924 KB |
Output is correct |
2 |
Correct |
11 ms |
2668 KB |
Output is correct |
3 |
Correct |
53 ms |
7148 KB |
Output is correct |
4 |
Correct |
9 ms |
2412 KB |
Output is correct |
5 |
Correct |
26 ms |
4332 KB |
Output is correct |
6 |
Correct |
56 ms |
6764 KB |
Output is correct |
7 |
Correct |
88 ms |
9196 KB |
Output is correct |
8 |
Correct |
44 ms |
5612 KB |
Output is correct |
9 |
Correct |
24 ms |
5484 KB |
Output is correct |
10 |
Correct |
68 ms |
7916 KB |
Output is correct |