Submission #117299

# Submission time Handle Problem Language Result Execution time Memory
117299 2019-06-15T13:08:03 Z MatesV13 Baza (COCI17_baza) C++11
50 / 50
98 ms 9052 KB
#include <bits/stdc++.h>
using namespace std;
int it[1005][1005];
int ok[1005]; 
int m,n,q, d;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m;
for (int i=0;i<n;i++){
	for (int j=0;j<m;j++){
		cin >> it[i][j];
	}
}
cin >> q;
for (int nj=0;nj<q;nj++){
	for (int i=0;i<n;i++) ok[i]=1;
	for (int i=0;i<m;i++){
		cin >> d;
		if (d==-1) continue;
		for (int j=0;j<n;j++){
			if (it[j][i]!=d) ok[j]=0;
		}
	}
	int ans=0;
	for (int i=0;i<n;i++) ans+=ok[i];
	cout << ans << endl;
}
return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 26 ms 2944 KB Output is correct
2 Correct 20 ms 2660 KB Output is correct
3 Correct 69 ms 7220 KB Output is correct
4 Correct 16 ms 2432 KB Output is correct
5 Correct 44 ms 4344 KB Output is correct
6 Correct 71 ms 6648 KB Output is correct
7 Correct 98 ms 9052 KB Output is correct
8 Correct 56 ms 5628 KB Output is correct
9 Correct 68 ms 5596 KB Output is correct
10 Correct 90 ms 7928 KB Output is correct