답안 #94922

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94922 2019-01-25T08:03:10 Z MohamedAhmed0 Baza (COCI17_baza) C++14
50 / 50
97 ms 7928 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n , m ;
    scanf("%d %d" , &n , &m);
    int arr[n][m] , arr2[m];
    for(int i = 0 ; i < n ; ++i)
    {
        for(int j = 0 ; j < m ; ++j)
            scanf("%d" , &arr[i][j]);
    }
    int q ;
    scanf("%d" , &q);
    while(q--)
    {
        for(int i = 0 ; i < m ; ++i)
            scanf("%d" , &arr2[i]);
        int ans = 0 ;
        for(int i = 0 ; i < n ; ++i)
        {
            bool t = true ;
            for(int j = 0 ; j < m ; ++j)
            {
                if(!t)
                    break;
                if(arr[i][j] != arr2[j] && arr2[j] != -1)
                    t = false ;
            }
            if(t)
                ans++;
        }
        printf("%d\n" , ans);
    }
    return 0 ;
}

Compilation message

baza.cpp: In function 'int main()':
baza.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d" , &n , &m);
     ~~~~~^~~~~~~~~~~~~~~~~~~
baza.cpp:13:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d" , &arr[i][j]);
             ~~~~~^~~~~~~~~~~~~~~~~~~
baza.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d" , &q);
     ~~~~~^~~~~~~~~~~
baza.cpp:20:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d" , &arr2[i]);
             ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 2936 KB Output is correct
2 Correct 21 ms 1840 KB Output is correct
3 Correct 61 ms 5112 KB Output is correct
4 Correct 16 ms 1528 KB Output is correct
5 Correct 49 ms 4216 KB Output is correct
6 Correct 73 ms 6008 KB Output is correct
7 Correct 97 ms 7928 KB Output is correct
8 Correct 62 ms 5112 KB Output is correct
9 Correct 37 ms 3192 KB Output is correct
10 Correct 92 ms 7736 KB Output is correct