Submission #77946

#TimeUsernameProblemLanguageResultExecution timeMemory
77946aquablitz11Dango Maker (JOI18_dango_maker)C++14
13 / 100
2 ms784 KiB
#include <bits/stdc++.h>
using namespace std;

const int N = 3010;

char S[N][N];

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++i)
        scanf(" %s", S[i]);
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (S[i][j] == 'R' && S[i][j+1] == 'G' && S[i][j+2] == 'W') {
                ++cnt;
                S[i][j] = S[i][j+1] = S[i][j+2] = '\0';
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (S[i][j] == 'R' && S[i+1][j] == 'G' && S[i+2][j] == 'W') {
                ++cnt;
                S[i][j] = S[i+1][j] = S[i+2][j] = '\0';
            }
        }
    }
    printf("%d\n", cnt);

    return 0;
}

Compilation message (stderr)

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
dango_maker.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %s", S[i]);
         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...