답안 #1044659

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1044659 2024-08-05T12:05:33 Z Nickpapadak Game (eJOI20_game) C++14
20 / 100
0 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
const unsigned int MAXN = 2e+1 + 5;
int grid[MAXN][MAXN];
int N, M;
int cnt;
int main(){
    scanf("%d%d", &N, &M);
    char ps[M];
    scanf("%s", ps);
    for(int i = 1; i<=N; ++i){
        char s[M];
        scanf("%s", s);
        for(int j = 1; j <=M;++j)
            grid[i][j] = (ps[j-1]-'0') + (s[j-1]-'0');
        for(int j = 0; j<M;++j){
            ps[j] = s[j];
        }
    }
    for(int i = 1; i<=N; ++i){
        char s[M+1];
        scanf("%s", s);
        for(int j = 1; j<=M; ++j){
            grid[i][j] += (s[j] -'0') + (s[j-1] - '0');
            if(grid[i][j] == 4) cnt++;
        }
    }
    printf("%d", -1*((N*M) - cnt));
    // for(int i = 1; i<=N;++i){
    //     for(int j = 1; j <=M;++j){
    //         printf("%d ", grid[i][j]);
    //     }
    //     printf("\n");
    // }
    return 0;
}

Compilation message

game.cpp: In function 'int main()':
game.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d%d", &N, &M);
      |     ~~~~~^~~~~~~~~~~~~~~~
game.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%s", ps);
      |     ~~~~~^~~~~~~~~~
game.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%s", s);
      |         ~~~~~^~~~~~~~~
game.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         scanf("%s", s);
      |         ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Incorrect 0 ms 348 KB Output isn't correct
14 Halted 0 ms 0 KB -