제출 #170319

#제출 시각아이디문제언어결과실행 시간메모리
170319ngmhBaza (COCI17_baza)C++11
50 / 50
409 ms12900 KiB
#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 timeMemoryGrader output
Fetching results...