# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
75116 | 2018-09-08T12:01:03 Z | bogdan10bos | Dango Maker (JOI18_dango_maker) | C++14 | 3 ms | 776 KB |
#include <bits/stdc++.h> using namespace std; //#define FILE_IO int N, M, ans, sol; char a[3005][3005]; int f[3005][3005]; int main() { #ifdef FILE_IO freopen("1.in", "r", stdin); freopen("1.out", "w", stdout); #endif scanf("%d%d\n", &N, &M); for(int i = 1; i <= N; i++) scanf("%s", a[i] + 1); for(int i = 1; i <= N; i++) for(int j = 1; j + 2 <= M; j++) if(a[i][j] == 'R' && a[i][j + 1] == 'G' && a[i][j + 2] == 'W') { ans++; f[i][j] = f[i][j + 1] = f[i][j + 2] = 1; } for(int j = 1; j <= M; j++) for(int i = 1; i + 2 <= N; i++) if(a[i][j] == 'R' && a[i + 1][j] == 'G' && a[i + 2][j] == 'W' && f[i][j] != 1 && f[i + 1][j] != 1 && f[i + 2][j] != 1) { ans++; f[i][j] = f[i + 1][j] = f[i + 2][j] = 1; } for(int j = 1; j <= M; j++) for(int i = 1; i + 2 <= N; i++) if(a[i][j] == 'R' && a[i + 1][j] == 'G' && a[i + 2][j] == 'W') { sol++; f[i][j] = f[i + 1][j] = f[i + 2][j] = 2; } for(int i = 1; i <= N; i++) for(int j = 1; j + 2 <= M; j++) if(a[i][j] == 'R' && a[i][j + 1] == 'G' && a[i][j + 2] == 'W' && f[i][j] != 2 && f[i][j + 1] != 2 && f[i][j + 2] != 2) { sol++; f[i][j] = f[i][j + 1] = f[i][j + 2] = 2; } printf("%d\n", max(ans, sol)); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 396 KB | Output is correct |
3 | Correct | 2 ms | 640 KB | Output is correct |
4 | Correct | 2 ms | 640 KB | Output is correct |
5 | Correct | 2 ms | 708 KB | Output is correct |
6 | Correct | 2 ms | 708 KB | Output is correct |
7 | Correct | 2 ms | 708 KB | Output is correct |
8 | Correct | 3 ms | 752 KB | Output is correct |
9 | Correct | 2 ms | 752 KB | Output is correct |
10 | Correct | 2 ms | 776 KB | Output is correct |
11 | Correct | 2 ms | 776 KB | Output is correct |
12 | Correct | 2 ms | 776 KB | Output is correct |
13 | Correct | 2 ms | 776 KB | Output is correct |
14 | Correct | 2 ms | 776 KB | Output is correct |
15 | Correct | 2 ms | 776 KB | Output is correct |
16 | Correct | 2 ms | 776 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 396 KB | Output is correct |
3 | Correct | 2 ms | 640 KB | Output is correct |
4 | Correct | 2 ms | 640 KB | Output is correct |
5 | Correct | 2 ms | 708 KB | Output is correct |
6 | Correct | 2 ms | 708 KB | Output is correct |
7 | Correct | 2 ms | 708 KB | Output is correct |
8 | Correct | 3 ms | 752 KB | Output is correct |
9 | Correct | 2 ms | 752 KB | Output is correct |
10 | Correct | 2 ms | 776 KB | Output is correct |
11 | Correct | 2 ms | 776 KB | Output is correct |
12 | Correct | 2 ms | 776 KB | Output is correct |
13 | Correct | 2 ms | 776 KB | Output is correct |
14 | Correct | 2 ms | 776 KB | Output is correct |
15 | Correct | 2 ms | 776 KB | Output is correct |
16 | Correct | 2 ms | 776 KB | Output is correct |
17 | Correct | 2 ms | 776 KB | Output is correct |
18 | Correct | 2 ms | 776 KB | Output is correct |
19 | Correct | 2 ms | 776 KB | Output is correct |
20 | Incorrect | 2 ms | 776 KB | Output isn't correct |
21 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 396 KB | Output is correct |
3 | Correct | 2 ms | 640 KB | Output is correct |
4 | Correct | 2 ms | 640 KB | Output is correct |
5 | Correct | 2 ms | 708 KB | Output is correct |
6 | Correct | 2 ms | 708 KB | Output is correct |
7 | Correct | 2 ms | 708 KB | Output is correct |
8 | Correct | 3 ms | 752 KB | Output is correct |
9 | Correct | 2 ms | 752 KB | Output is correct |
10 | Correct | 2 ms | 776 KB | Output is correct |
11 | Correct | 2 ms | 776 KB | Output is correct |
12 | Correct | 2 ms | 776 KB | Output is correct |
13 | Correct | 2 ms | 776 KB | Output is correct |
14 | Correct | 2 ms | 776 KB | Output is correct |
15 | Correct | 2 ms | 776 KB | Output is correct |
16 | Correct | 2 ms | 776 KB | Output is correct |
17 | Correct | 2 ms | 776 KB | Output is correct |
18 | Correct | 2 ms | 776 KB | Output is correct |
19 | Correct | 2 ms | 776 KB | Output is correct |
20 | Incorrect | 2 ms | 776 KB | Output isn't correct |
21 | Halted | 0 ms | 0 KB | - |