Submission #249025

#TimeUsernameProblemLanguageResultExecution timeMemory
249025Vladikus004Baza (COCI17_baza)C++14
50 / 50
137 ms9080 KiB
#include <bits/stdc++.h> #define inf 2e9 #define all(v) v.begin(), v.end() using namespace std; typedef long long ll; typedef long double ld; typedef pair <int, int> pii; const int N = 1000 + 3; int n, m, a[N][N], q, b[N]; int can(int ind){ int ans = 1; for (int i = 0; i < m; i++){ if (b[i] != -1 && a[ind][i] != b[i]) ans = 0; } return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif // LOCAL cin >> n >> m; for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++){ cin >> a[i][j]; } } cin >> q; while (q--){ for (int i = 0; i < m; i++) cin >> b[i]; int ans = 0; for (int i = 0; i < n; i++) ans += can(i); cout << ans << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...