Submission #170319

# Submission time Handle Problem Language Result Execution time Memory
170319 2019-12-24T19:57:20 Z ngmh Baza (COCI17_baza) C++11
50 / 50
409 ms 12900 KB
#include <bits/stdc++.h>
using namespace std;

long long n, m, q, t, l[1001], a[1001][1001];
bool good;
int main(){
	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 >> l[j];
		t = 0;
		for(int j = 0; j < n; j++){
			good = true;
			for(int k = 0; k < m; k++){
				if(l[k] != -1 && l[k] != a[j][k]){
					good = false; break;
				}
			}
			if(good) t++;
		}
		cout << t << endl;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 130 ms 3832 KB Output is correct
2 Correct 99 ms 3832 KB Output is correct
3 Correct 262 ms 10880 KB Output is correct
4 Correct 66 ms 3320 KB Output is correct
5 Correct 215 ms 5980 KB Output is correct
6 Correct 302 ms 9572 KB Output is correct
7 Correct 409 ms 12900 KB Output is correct
8 Correct 253 ms 7800 KB Output is correct
9 Correct 157 ms 7884 KB Output is correct
10 Correct 387 ms 10688 KB Output is correct