제출 #249485

#제출 시각아이디문제언어결과실행 시간메모리
249485VEGAnnBaza (COCI17_baza)C++14
50 / 50
115 ms4216 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int a[N][N], n, m, b[N];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

#ifdef _LOCAL
    freopen("in.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];

    int qq; cin >> qq;

    for (; qq; qq--){
        for (int i = 0; i < m; i++)
            cin >> b[i];

        int ans = 0;

        for (int i = 0; i < n; i++){
            bool ok = 1;

            for (int j = 0; j < m && ok; j++)
                if (b[j] > 0 && b[j] != a[i][j])
                    ok = 0;

            ans += ok;
        }

        cout << ans << '\n';
    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...