# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1057621 | manhlinh1501 | Dango Maker (JOI18_dango_maker) | C++17 | 1 ms | 10844 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int MAXN = 3e3 + 5;
int N, M;
char a[MAXN][MAXN];
bool vis[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];
}
memset(vis, true, sizeof vis);
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' and vis[i][j] and vis[i + 1][j] and vis[i + 2][j]) {
ans++;
vis[i][j] = vis[i + 1][j] = vis[i + 2][j] = false;
} else if(a[i][j + 1] == 'G' and a[i][j + 2] == 'W' and vis[i][j] and vis[i][j + 1] and vis[i][j + 2]) {
ans++;
vis[i][j] = vis[i][j + 1] = vis[i][j + 2] = false;
}
}
}
}
cout << ans;
return (0 ^ 0);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |