Submission #89413

#TimeUsernameProblemLanguageResultExecution timeMemory
89413AntonioDakiBaza (COCI17_baza)C++14
50 / 50
87 ms33504 KiB
#include<bits/stdc++.h>

using namespace std;

long a[1002][1002], b[1002][1002];

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
    int n, m, q, x = 0, ok = 1;
    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 >> b[i][j];
    for(int Q = 0; Q < q; ++Q){
        for(int i = 0; i < n; ++i){
        	for(int j = 0; j < m; ++j) if(b[Q][j] != -1 and a[i][j] != b[Q][j]){
			    ok = 0;
			    break;
			}
        	if(ok) ++x;
        	ok = 1;
        }
        cout << x << endl;
        x = 0;
    }

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...