Submission #912667

# Submission time Handle Problem Language Result Execution time Memory
912667 2024-01-19T17:37:05 Z andro Baza (COCI17_baza) C++14
50 / 50
134 ms 10724 KB
#include <bits/stdc++.h>

#define int long long

#define double long double

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n + 1,vector<int>(m + 1));
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            cin >> a[i][j];
        }
    }
    int q;
    cin >> q;
    while(q--) {
        vector<int> b(m + 1);
        for(int i = 1; i <= m; i++) {
            cin >> b[i];
        }
        int ans = 0;
        for(int i = 1; i <= n; i++) {
            int ok = 1;
            for(int j = 1; j <= m; j++) {
                if(b[j] == - 1) {
                    continue;
                }
                if(a[i][j] != b[j]) {
                    ok = 0;
                }
            }
            ans += ok;
        }
        cout << ans << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 28 ms 3684 KB Output is correct
2 Correct 17 ms 2396 KB Output is correct
3 Correct 79 ms 7028 KB Output is correct
4 Correct 13 ms 1924 KB Output is correct
5 Correct 42 ms 5320 KB Output is correct
6 Correct 86 ms 7952 KB Output is correct
7 Correct 134 ms 10724 KB Output is correct
8 Correct 65 ms 6740 KB Output is correct
9 Correct 34 ms 4188 KB Output is correct
10 Correct 110 ms 10488 KB Output is correct