Submission #1044659

#TimeUsernameProblemLanguageResultExecution timeMemory
1044659NickpapadakGame (eJOI20_game)C++14
20 / 100
0 ms348 KiB
#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 (stderr)

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);
      |         ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...