Submission #490102

#TimeUsernameProblemLanguageResultExecution timeMemory
490102FronPawBaza (COCI17_baza)C++14
50 / 50
247 ms8940 KiB
#include <iostream> #include <vector> #include <map> using namespace std; int n, m, q; int a[1001][1001]; int v[1001]; int main () { cin >> n >> m; for (int i = 1;i<=n;++i) for(int j = 1;j<=m;++j) { int nr; cin >> nr; a[i][j] = nr; } cin >> q; for (int test = 1;test <= q;++test) { for (int i = 1;i<=m;++i) cin >> v[i]; bool rasp[1001]; int ans = 0; for (int i = 1;i<=n;++i) rasp[i] = 1; for (int i = 1;i<=m;++i) { if (v[i] == -1) continue; for (int j = 1;j<=n;++j) if (a[j][i] != v[i]) rasp[j] = 0; } for (int i = 1;i<=n;++i) if (rasp[i] == 1) ans++; cout << ans << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...