답안 #207728

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
207728 2020-03-08T17:15:11 Z DodgeBallMan Baza (COCI17_baza) C++14
50 / 50
180 ms 9208 KB
#include <bits/stdc++.h>
using namespace std;
 
const int N = 1e3+5;
 
int n, m, q, ret[N], A[N][N];
 
int main() {
    scanf("%d %d", &n, &m);
    for(int i = 1; i <= n; ++i) for(int j = 1; j <= m; ++j) scanf("%d", A[i]+j);
    scanf("%d", &q);
    for(int i = 0; i < q; ++i) {
        for(int j = 1; j <= m; ++j) scanf("%d", ret+j);
        int sum = 0;
        for(int i = 1; i <= n; ++i) {
            bool st = true;
            for(int j = 1; j <= m; ++j) {
                if(ret[j] == -1) continue;
                if(A[i][j] != ret[j]) st = false;
            }
            sum += st;
        }
        printf("%d\n", sum);
    } 
}

Compilation message

baza.cpp: In function 'int main()':
baza.cpp:9: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:10:66: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n; ++i) for(int j = 1; j <= m; ++j) scanf("%d", A[i]+j);
                                                             ~~~~~^~~~~~~~~~~~~~
baza.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &q);
     ~~~~~^~~~~~~~~~
baza.cpp:13:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         for(int j = 1; j <= m; ++j) scanf("%d", ret+j);
                                     ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 2808 KB Output is correct
2 Correct 33 ms 2680 KB Output is correct
3 Correct 111 ms 7160 KB Output is correct
4 Correct 27 ms 2424 KB Output is correct
5 Correct 72 ms 4352 KB Output is correct
6 Correct 125 ms 6652 KB Output is correct
7 Correct 180 ms 9208 KB Output is correct
8 Correct 100 ms 5624 KB Output is correct
9 Correct 65 ms 5496 KB Output is correct
10 Correct 156 ms 7800 KB Output is correct