#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, a, b) for(int i=a; i<b; i++)
#define ffi For(i, 0, N)
#define ffj For(j, 0, M)
#define ffa ffi ffj
#define s <<" "<<
#define c <<" : "<<
#define w cout
#define e endl // "/n"
#define pb push_back
#define mp make_pair
#define a first
#define b second
#define int ll
//500,000,000 operations
const int MAXN = 3000, INF = 100000000000000;
//Global Variables
int N, M, out;
bool used[MAXN][MAXN];
string grid[MAXN];
main() {
//ifstream cin("test.in");
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> N >> M;
ffa cin >> grid[i][j];
For (i, 0, max(N, M)) {
if (i < N) {
/// check the ith row
For (j, 0, M-2) if (!used[i][j] && !used[i][j+1] && !used[i][j+2] && grid[i][j] == 'R' && grid[i][j+1] == 'G' && grid[i][j+2] == 'W') {
used[i][j] = used[i][j+1] = used[i][j+2] = true;
out++;
}
}
if (i < M) {
/// check the ith col
For (j, 0, N-2) if (!used[j][i] && !used[j+1][i] && !used[j+2][i] && grid[j][i] == 'R' && grid[j+1][i] == 'G' && grid[j+2][i] == 'W') {
used[j][i] = used[j+1][i] = used[j+2][i] = true;
out++;
}
}
}
w<< out<<e;
}
Compilation message
dango_maker.cpp:24:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main() {
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
620 KB |
Output is correct |
3 |
Correct |
2 ms |
620 KB |
Output is correct |
4 |
Correct |
2 ms |
620 KB |
Output is correct |
5 |
Correct |
2 ms |
644 KB |
Output is correct |
6 |
Correct |
2 ms |
652 KB |
Output is correct |
7 |
Correct |
2 ms |
652 KB |
Output is correct |
8 |
Correct |
2 ms |
652 KB |
Output is correct |
9 |
Correct |
2 ms |
720 KB |
Output is correct |
10 |
Correct |
3 ms |
720 KB |
Output is correct |
11 |
Correct |
2 ms |
756 KB |
Output is correct |
12 |
Correct |
2 ms |
756 KB |
Output is correct |
13 |
Correct |
3 ms |
756 KB |
Output is correct |
14 |
Correct |
2 ms |
756 KB |
Output is correct |
15 |
Correct |
2 ms |
756 KB |
Output is correct |
16 |
Correct |
3 ms |
756 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
620 KB |
Output is correct |
3 |
Correct |
2 ms |
620 KB |
Output is correct |
4 |
Correct |
2 ms |
620 KB |
Output is correct |
5 |
Correct |
2 ms |
644 KB |
Output is correct |
6 |
Correct |
2 ms |
652 KB |
Output is correct |
7 |
Correct |
2 ms |
652 KB |
Output is correct |
8 |
Correct |
2 ms |
652 KB |
Output is correct |
9 |
Correct |
2 ms |
720 KB |
Output is correct |
10 |
Correct |
3 ms |
720 KB |
Output is correct |
11 |
Correct |
2 ms |
756 KB |
Output is correct |
12 |
Correct |
2 ms |
756 KB |
Output is correct |
13 |
Correct |
3 ms |
756 KB |
Output is correct |
14 |
Correct |
2 ms |
756 KB |
Output is correct |
15 |
Correct |
2 ms |
756 KB |
Output is correct |
16 |
Correct |
3 ms |
756 KB |
Output is correct |
17 |
Correct |
2 ms |
756 KB |
Output is correct |
18 |
Correct |
2 ms |
756 KB |
Output is correct |
19 |
Incorrect |
2 ms |
816 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
620 KB |
Output is correct |
3 |
Correct |
2 ms |
620 KB |
Output is correct |
4 |
Correct |
2 ms |
620 KB |
Output is correct |
5 |
Correct |
2 ms |
644 KB |
Output is correct |
6 |
Correct |
2 ms |
652 KB |
Output is correct |
7 |
Correct |
2 ms |
652 KB |
Output is correct |
8 |
Correct |
2 ms |
652 KB |
Output is correct |
9 |
Correct |
2 ms |
720 KB |
Output is correct |
10 |
Correct |
3 ms |
720 KB |
Output is correct |
11 |
Correct |
2 ms |
756 KB |
Output is correct |
12 |
Correct |
2 ms |
756 KB |
Output is correct |
13 |
Correct |
3 ms |
756 KB |
Output is correct |
14 |
Correct |
2 ms |
756 KB |
Output is correct |
15 |
Correct |
2 ms |
756 KB |
Output is correct |
16 |
Correct |
3 ms |
756 KB |
Output is correct |
17 |
Correct |
2 ms |
756 KB |
Output is correct |
18 |
Correct |
2 ms |
756 KB |
Output is correct |
19 |
Incorrect |
2 ms |
816 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |