#include<bits/stdc++.h>
#define ll long long
using namespace std;
int mat[1009][1009],q,n,m,a[1009];
int main()
{
cin>>n>>m;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)cin>>mat[i][j];
}
cin>>q;
while(q--)
{
for(int i=0;i<m;i++)cin>>a[i];
int ans=0;
for(int i=0;i<n;i++)
{
int o=1;
for(int j=0;j<m;j++)
{
if(a[j]==-1)continue;
if(mat[i][j]!=a[j]){o=0;break;}
}
ans+=o;
}
cout<<ans<<"\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
130 ms |
3044 KB |
Output is correct |
2 |
Correct |
85 ms |
2680 KB |
Output is correct |
3 |
Correct |
260 ms |
7320 KB |
Output is correct |
4 |
Correct |
67 ms |
2424 KB |
Output is correct |
5 |
Correct |
200 ms |
4344 KB |
Output is correct |
6 |
Correct |
301 ms |
6812 KB |
Output is correct |
7 |
Correct |
409 ms |
9100 KB |
Output is correct |
8 |
Correct |
295 ms |
5692 KB |
Output is correct |
9 |
Correct |
157 ms |
5580 KB |
Output is correct |
10 |
Correct |
391 ms |
8000 KB |
Output is correct |