Submission #512353

# Submission time Handle Problem Language Result Execution time Memory
512353 2022-01-16T09:55:18 Z Jean7 Baza (COCI17_baza) C++14
50 / 50
65 ms 10688 KB
#include <bits/stdc++.h>
#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long

using namespace std ;

int32_t main ()
{
    fio
    int n , m ;
    cin >> n >> m ;
    int a[n][m] ;
    for ( int i = 0 ; i < n ; i++ ) for ( int k = 0 ; k < m ; k++ ) cin >> a[i][k] ;
    int q ;
    cin >> q ;
    int b[q][m] ;
    for ( int i = 0 ; i < q ; i++ ) for ( int k = 0 ; k < m ; k++ ) cin >> b[i][k] ;
    for ( int j = 0 ; j < q ; j++ )
    {
        int ans = 0 ;
        for ( int i = 0 ; i < n ; i++ )
        {
            bool jean = 1 ;
            for ( int k = 0 ; k < m ; k++ )
            {
                if ( a[i][k] == b[j][k] || b[j][k] == -1 ) continue ;
                else
                {
                    jean = 0 ;
                    break ;
                }
            }
            if ( jean ) ans++ ;
        }
        cout << ans << "\n" ;
    }
    return 0 ;
}
# Verdict Execution time Memory Grader output
1 Correct 18 ms 3528 KB Output is correct
2 Correct 13 ms 2408 KB Output is correct
3 Correct 37 ms 6936 KB Output is correct
4 Correct 10 ms 1864 KB Output is correct
5 Correct 32 ms 5440 KB Output is correct
6 Correct 49 ms 7996 KB Output is correct
7 Correct 62 ms 10688 KB Output is correct
8 Correct 37 ms 6856 KB Output is correct
9 Correct 23 ms 4292 KB Output is correct
10 Correct 65 ms 10440 KB Output is correct