Submission #1057620

#TimeUsernameProblemLanguageResultExecution timeMemory
1057620manhlinh1501Dango Maker (JOI18_dango_maker)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int MAXN = 3e3 + 5;

int N, M;
char a[MAXN][MAXN];

signed main() {
#define TASK "code"

    if (fopen(TASK ".inp", "r")) {
        freopen(TASK ".inp", "r", stdin);
        freopen(TASK ".out", "w", stdout);
    }

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> N >> M;
    for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= M; j++)
            cin >> a[i][j];
    }

    int ans = 0;
    for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= M; j++) {
            if(a[i][j] == 'R') {
                if(a[i + 1][j] == 'G' and a[i + 2][j] == 'W') {
//                    cout << i << " " << j << "\n";
                    ans++;
                }
                else if(a[i][j + 1] == 'G' and a[i][j + 2] == 'W') {
//                    cout << i << " " << j << "\n";
                    ans++;
                }
            }
        }
    }
    cout << ans;

    return (0 ^ 0);
}

Compilation message (stderr)

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen(TASK ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
dango_maker.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen(TASK ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...