# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
75155 | 2018-09-08T14:02:14 Z | bogdan10bos | Dango Maker (JOI18_dango_maker) | C++14 | 416 ms | 113424 KB |
#include <bits/stdc++.h> using namespace std; //#define FILE_IO int N, M, ans; char a[3005][3005]; int dp[3005][3][3]; 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 l = 4; l <= N + M; l++) { int st = max(1, l - M); for(int i = 1; i <= N; i++) for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) dp[i][j][k] = 0; int mx = 0; for(int i = st; i <= N && i < l; i++) { int x = i, y = l - i; for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) dp[i][j][0] = max(dp[i][j][0], dp[i - 1][k][j]); if(i > 2 && a[x][y] == 'W' && a[x - 1][y] == 'G' && a[x - 2][y] == 'R') { for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) if(j != 2 && k != 2) dp[i][j][1] = max(dp[i][j][1], dp[i - 1][k][j] + 1); } if(y > 2 && a[x][y] == 'W' && a[x][y - 1] == 'G' && a[x][y - 2] == 'R') { for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) dp[i][j][2] = max(dp[i][j][2], dp[i - 1][k][j] + 1); } for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) mx = max(mx, dp[i][j][k]); } ans += mx; } printf("%d\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 3 ms | 464 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 524 KB | Output is correct |
7 | Correct | 2 ms | 540 KB | Output is correct |
8 | Correct | 2 ms | 540 KB | Output is correct |
9 | Correct | 2 ms | 540 KB | Output is correct |
10 | Correct | 2 ms | 560 KB | Output is correct |
11 | Correct | 2 ms | 564 KB | Output is correct |
12 | Correct | 2 ms | 568 KB | Output is correct |
13 | Correct | 2 ms | 572 KB | Output is correct |
14 | Correct | 2 ms | 576 KB | Output is correct |
15 | Correct | 2 ms | 580 KB | Output is correct |
16 | Correct | 2 ms | 584 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 3 ms | 464 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 524 KB | Output is correct |
7 | Correct | 2 ms | 540 KB | Output is correct |
8 | Correct | 2 ms | 540 KB | Output is correct |
9 | Correct | 2 ms | 540 KB | Output is correct |
10 | Correct | 2 ms | 560 KB | Output is correct |
11 | Correct | 2 ms | 564 KB | Output is correct |
12 | Correct | 2 ms | 568 KB | Output is correct |
13 | Correct | 2 ms | 572 KB | Output is correct |
14 | Correct | 2 ms | 576 KB | Output is correct |
15 | Correct | 2 ms | 580 KB | Output is correct |
16 | Correct | 2 ms | 584 KB | Output is correct |
17 | Correct | 2 ms | 588 KB | Output is correct |
18 | Correct | 2 ms | 592 KB | Output is correct |
19 | Correct | 3 ms | 596 KB | Output is correct |
20 | Correct | 2 ms | 644 KB | Output is correct |
21 | Correct | 2 ms | 676 KB | Output is correct |
22 | Correct | 2 ms | 680 KB | Output is correct |
23 | Correct | 2 ms | 684 KB | Output is correct |
24 | Correct | 2 ms | 720 KB | Output is correct |
25 | Correct | 2 ms | 728 KB | Output is correct |
26 | Correct | 2 ms | 732 KB | Output is correct |
27 | Correct | 2 ms | 740 KB | Output is correct |
28 | Correct | 2 ms | 740 KB | Output is correct |
29 | Correct | 2 ms | 744 KB | Output is correct |
30 | Correct | 2 ms | 844 KB | Output is correct |
31 | Correct | 2 ms | 844 KB | Output is correct |
32 | Correct | 2 ms | 844 KB | Output is correct |
33 | Correct | 2 ms | 844 KB | Output is correct |
34 | Correct | 2 ms | 844 KB | Output is correct |
35 | Correct | 2 ms | 844 KB | Output is correct |
36 | Correct | 2 ms | 844 KB | Output is correct |
37 | Correct | 2 ms | 844 KB | Output is correct |
38 | Correct | 2 ms | 844 KB | Output is correct |
39 | Correct | 2 ms | 844 KB | Output is correct |
40 | Correct | 2 ms | 844 KB | Output is correct |
41 | Correct | 2 ms | 924 KB | Output is correct |
42 | Correct | 2 ms | 924 KB | Output is correct |
43 | Correct | 2 ms | 924 KB | Output is correct |
44 | Correct | 2 ms | 924 KB | Output is correct |
45 | Correct | 2 ms | 924 KB | Output is correct |
46 | Correct | 2 ms | 924 KB | Output is correct |
47 | Correct | 2 ms | 924 KB | Output is correct |
48 | Correct | 2 ms | 924 KB | Output is correct |
49 | Correct | 2 ms | 924 KB | Output is correct |
50 | Correct | 2 ms | 960 KB | Output is correct |
51 | Correct | 2 ms | 960 KB | Output is correct |
52 | Correct | 2 ms | 960 KB | Output is correct |
53 | Correct | 3 ms | 960 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 3 ms | 464 KB | Output is correct |
5 | Correct | 2 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 524 KB | Output is correct |
7 | Correct | 2 ms | 540 KB | Output is correct |
8 | Correct | 2 ms | 540 KB | Output is correct |
9 | Correct | 2 ms | 540 KB | Output is correct |
10 | Correct | 2 ms | 560 KB | Output is correct |
11 | Correct | 2 ms | 564 KB | Output is correct |
12 | Correct | 2 ms | 568 KB | Output is correct |
13 | Correct | 2 ms | 572 KB | Output is correct |
14 | Correct | 2 ms | 576 KB | Output is correct |
15 | Correct | 2 ms | 580 KB | Output is correct |
16 | Correct | 2 ms | 584 KB | Output is correct |
17 | Correct | 2 ms | 588 KB | Output is correct |
18 | Correct | 2 ms | 592 KB | Output is correct |
19 | Correct | 3 ms | 596 KB | Output is correct |
20 | Correct | 2 ms | 644 KB | Output is correct |
21 | Correct | 2 ms | 676 KB | Output is correct |
22 | Correct | 2 ms | 680 KB | Output is correct |
23 | Correct | 2 ms | 684 KB | Output is correct |
24 | Correct | 2 ms | 720 KB | Output is correct |
25 | Correct | 2 ms | 728 KB | Output is correct |
26 | Correct | 2 ms | 732 KB | Output is correct |
27 | Correct | 2 ms | 740 KB | Output is correct |
28 | Correct | 2 ms | 740 KB | Output is correct |
29 | Correct | 2 ms | 744 KB | Output is correct |
30 | Correct | 2 ms | 844 KB | Output is correct |
31 | Correct | 2 ms | 844 KB | Output is correct |
32 | Correct | 2 ms | 844 KB | Output is correct |
33 | Correct | 2 ms | 844 KB | Output is correct |
34 | Correct | 2 ms | 844 KB | Output is correct |
35 | Correct | 2 ms | 844 KB | Output is correct |
36 | Correct | 2 ms | 844 KB | Output is correct |
37 | Correct | 2 ms | 844 KB | Output is correct |
38 | Correct | 2 ms | 844 KB | Output is correct |
39 | Correct | 2 ms | 844 KB | Output is correct |
40 | Correct | 2 ms | 844 KB | Output is correct |
41 | Correct | 2 ms | 924 KB | Output is correct |
42 | Correct | 2 ms | 924 KB | Output is correct |
43 | Correct | 2 ms | 924 KB | Output is correct |
44 | Correct | 2 ms | 924 KB | Output is correct |
45 | Correct | 2 ms | 924 KB | Output is correct |
46 | Correct | 2 ms | 924 KB | Output is correct |
47 | Correct | 2 ms | 924 KB | Output is correct |
48 | Correct | 2 ms | 924 KB | Output is correct |
49 | Correct | 2 ms | 924 KB | Output is correct |
50 | Correct | 2 ms | 960 KB | Output is correct |
51 | Correct | 2 ms | 960 KB | Output is correct |
52 | Correct | 2 ms | 960 KB | Output is correct |
53 | Correct | 3 ms | 960 KB | Output is correct |
54 | Correct | 2 ms | 960 KB | Output is correct |
55 | Correct | 53 ms | 9748 KB | Output is correct |
56 | Correct | 2 ms | 9748 KB | Output is correct |
57 | Correct | 24 ms | 9748 KB | Output is correct |
58 | Correct | 40 ms | 9748 KB | Output is correct |
59 | Correct | 382 ms | 19636 KB | Output is correct |
60 | Correct | 401 ms | 28592 KB | Output is correct |
61 | Correct | 407 ms | 37356 KB | Output is correct |
62 | Correct | 2 ms | 37356 KB | Output is correct |
63 | Correct | 401 ms | 45984 KB | Output is correct |
64 | Correct | 416 ms | 54756 KB | Output is correct |
65 | Correct | 395 ms | 63540 KB | Output is correct |
66 | Correct | 371 ms | 72252 KB | Output is correct |
67 | Correct | 379 ms | 81196 KB | Output is correct |
68 | Correct | 369 ms | 89892 KB | Output is correct |
69 | Correct | 380 ms | 98824 KB | Output is correct |
70 | Correct | 45 ms | 98824 KB | Output is correct |
71 | Correct | 55 ms | 98824 KB | Output is correct |
72 | Correct | 40 ms | 98824 KB | Output is correct |
73 | Correct | 40 ms | 98824 KB | Output is correct |
74 | Correct | 40 ms | 98824 KB | Output is correct |
75 | Correct | 47 ms | 98824 KB | Output is correct |
76 | Correct | 40 ms | 99592 KB | Output is correct |
77 | Correct | 40 ms | 100704 KB | Output is correct |
78 | Correct | 47 ms | 101700 KB | Output is correct |
79 | Correct | 54 ms | 102528 KB | Output is correct |
80 | Correct | 40 ms | 103640 KB | Output is correct |
81 | Correct | 40 ms | 104748 KB | Output is correct |
82 | Correct | 42 ms | 105488 KB | Output is correct |
83 | Correct | 38 ms | 106468 KB | Output is correct |
84 | Correct | 40 ms | 107448 KB | Output is correct |
85 | Correct | 41 ms | 108428 KB | Output is correct |
86 | Correct | 40 ms | 109416 KB | Output is correct |
87 | Correct | 39 ms | 110388 KB | Output is correct |
88 | Correct | 42 ms | 111504 KB | Output is correct |
89 | Correct | 40 ms | 112364 KB | Output is correct |
90 | Correct | 38 ms | 113424 KB | Output is correct |