# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77950 | 2018-10-01T11:10:32 Z | aquablitz11 | Dango Maker (JOI18_dango_maker) | C++14 | 668 ms | 115480 KB |
#include <bits/stdc++.h> using namespace std; const int N = 6010; char S[N][N]; int dp[N*2][8], val[N*2]; int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 0; i < n; ++i) scanf(" %s", S[i]); int ans = 0; for (int d = 0; d <= n+m-2; ++d) { //printf("diagonal %d\n", d); for (int j = 0; j <= d; ++j) { int i = d-j; val[2*j] = (S[i][j] == 'R' && S[i][j+1] == 'G' && S[i][j+2] == 'W') ? 1 : 0; val[2*j+1] = (S[i][j] == 'R' && S[i+1][j] == 'G' && S[i+2][j] == 'W') ? 1 : 0; //printf("%d %d ", val[2*j], val[2*j+1]); } //printf("\n"); fill(dp[2*d], dp[2*d]+8, 0); for (int i = 2*d+1; i >= 0; --i) { //printf("%d: ", i); if (i%2 == 0) { // horizontal for (int j = 0; j <= 3; ++j) { dp[i][j] = max(val[i]+dp[i+1][(j<<1)+1], dp[i+1][j<<1]); //printf("%d ", dp[i][j]); } } else { // vertical for (int j = 0; j <= 7; ++j) { dp[i][j] = dp[i+1][j&3]; if (j == 0) dp[i][j] += val[i]; //printf("%d ", dp[i][j]); } } //printf("\n"); } ans += dp[0][0]; } printf("%d\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 440 KB | Output is correct |
4 | Correct | 2 ms | 440 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 3 ms | 504 KB | Output is correct |
7 | Correct | 2 ms | 632 KB | Output is correct |
8 | Correct | 2 ms | 632 KB | Output is correct |
9 | Correct | 2 ms | 688 KB | Output is correct |
10 | Correct | 2 ms | 688 KB | Output is correct |
11 | Correct | 2 ms | 688 KB | Output is correct |
12 | Correct | 2 ms | 688 KB | Output is correct |
13 | Correct | 3 ms | 688 KB | Output is correct |
14 | Correct | 3 ms | 688 KB | Output is correct |
15 | Correct | 2 ms | 688 KB | Output is correct |
16 | Correct | 2 ms | 688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 440 KB | Output is correct |
4 | Correct | 2 ms | 440 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 3 ms | 504 KB | Output is correct |
7 | Correct | 2 ms | 632 KB | Output is correct |
8 | Correct | 2 ms | 632 KB | Output is correct |
9 | Correct | 2 ms | 688 KB | Output is correct |
10 | Correct | 2 ms | 688 KB | Output is correct |
11 | Correct | 2 ms | 688 KB | Output is correct |
12 | Correct | 2 ms | 688 KB | Output is correct |
13 | Correct | 3 ms | 688 KB | Output is correct |
14 | Correct | 3 ms | 688 KB | Output is correct |
15 | Correct | 2 ms | 688 KB | Output is correct |
16 | Correct | 2 ms | 688 KB | Output is correct |
17 | Correct | 2 ms | 688 KB | Output is correct |
18 | Correct | 2 ms | 688 KB | Output is correct |
19 | Correct | 2 ms | 720 KB | Output is correct |
20 | Correct | 2 ms | 720 KB | Output is correct |
21 | Correct | 3 ms | 720 KB | Output is correct |
22 | Correct | 2 ms | 788 KB | Output is correct |
23 | Correct | 4 ms | 788 KB | Output is correct |
24 | Correct | 2 ms | 788 KB | Output is correct |
25 | Correct | 2 ms | 788 KB | Output is correct |
26 | Correct | 2 ms | 788 KB | Output is correct |
27 | Correct | 2 ms | 788 KB | Output is correct |
28 | Correct | 2 ms | 788 KB | Output is correct |
29 | Correct | 2 ms | 788 KB | Output is correct |
30 | Correct | 2 ms | 788 KB | Output is correct |
31 | Correct | 2 ms | 788 KB | Output is correct |
32 | Correct | 2 ms | 788 KB | Output is correct |
33 | Correct | 2 ms | 820 KB | Output is correct |
34 | Correct | 2 ms | 820 KB | Output is correct |
35 | Correct | 2 ms | 820 KB | Output is correct |
36 | Correct | 2 ms | 820 KB | Output is correct |
37 | Correct | 2 ms | 820 KB | Output is correct |
38 | Correct | 2 ms | 820 KB | Output is correct |
39 | Correct | 2 ms | 820 KB | Output is correct |
40 | Correct | 2 ms | 820 KB | Output is correct |
41 | Correct | 2 ms | 824 KB | Output is correct |
42 | Correct | 2 ms | 904 KB | Output is correct |
43 | Correct | 2 ms | 904 KB | Output is correct |
44 | Correct | 2 ms | 904 KB | Output is correct |
45 | Correct | 4 ms | 904 KB | Output is correct |
46 | Correct | 2 ms | 904 KB | Output is correct |
47 | Correct | 2 ms | 904 KB | Output is correct |
48 | Correct | 2 ms | 904 KB | Output is correct |
49 | Correct | 2 ms | 904 KB | Output is correct |
50 | Correct | 2 ms | 904 KB | Output is correct |
51 | Correct | 2 ms | 904 KB | Output is correct |
52 | Correct | 2 ms | 904 KB | Output is correct |
53 | Correct | 2 ms | 904 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 440 KB | Output is correct |
4 | Correct | 2 ms | 440 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 3 ms | 504 KB | Output is correct |
7 | Correct | 2 ms | 632 KB | Output is correct |
8 | Correct | 2 ms | 632 KB | Output is correct |
9 | Correct | 2 ms | 688 KB | Output is correct |
10 | Correct | 2 ms | 688 KB | Output is correct |
11 | Correct | 2 ms | 688 KB | Output is correct |
12 | Correct | 2 ms | 688 KB | Output is correct |
13 | Correct | 3 ms | 688 KB | Output is correct |
14 | Correct | 3 ms | 688 KB | Output is correct |
15 | Correct | 2 ms | 688 KB | Output is correct |
16 | Correct | 2 ms | 688 KB | Output is correct |
17 | Correct | 2 ms | 688 KB | Output is correct |
18 | Correct | 2 ms | 688 KB | Output is correct |
19 | Correct | 2 ms | 720 KB | Output is correct |
20 | Correct | 2 ms | 720 KB | Output is correct |
21 | Correct | 3 ms | 720 KB | Output is correct |
22 | Correct | 2 ms | 788 KB | Output is correct |
23 | Correct | 4 ms | 788 KB | Output is correct |
24 | Correct | 2 ms | 788 KB | Output is correct |
25 | Correct | 2 ms | 788 KB | Output is correct |
26 | Correct | 2 ms | 788 KB | Output is correct |
27 | Correct | 2 ms | 788 KB | Output is correct |
28 | Correct | 2 ms | 788 KB | Output is correct |
29 | Correct | 2 ms | 788 KB | Output is correct |
30 | Correct | 2 ms | 788 KB | Output is correct |
31 | Correct | 2 ms | 788 KB | Output is correct |
32 | Correct | 2 ms | 788 KB | Output is correct |
33 | Correct | 2 ms | 820 KB | Output is correct |
34 | Correct | 2 ms | 820 KB | Output is correct |
35 | Correct | 2 ms | 820 KB | Output is correct |
36 | Correct | 2 ms | 820 KB | Output is correct |
37 | Correct | 2 ms | 820 KB | Output is correct |
38 | Correct | 2 ms | 820 KB | Output is correct |
39 | Correct | 2 ms | 820 KB | Output is correct |
40 | Correct | 2 ms | 820 KB | Output is correct |
41 | Correct | 2 ms | 824 KB | Output is correct |
42 | Correct | 2 ms | 904 KB | Output is correct |
43 | Correct | 2 ms | 904 KB | Output is correct |
44 | Correct | 2 ms | 904 KB | Output is correct |
45 | Correct | 4 ms | 904 KB | Output is correct |
46 | Correct | 2 ms | 904 KB | Output is correct |
47 | Correct | 2 ms | 904 KB | Output is correct |
48 | Correct | 2 ms | 904 KB | Output is correct |
49 | Correct | 2 ms | 904 KB | Output is correct |
50 | Correct | 2 ms | 904 KB | Output is correct |
51 | Correct | 2 ms | 904 KB | Output is correct |
52 | Correct | 2 ms | 904 KB | Output is correct |
53 | Correct | 2 ms | 904 KB | Output is correct |
54 | Correct | 105 ms | 1128 KB | Output is correct |
55 | Correct | 162 ms | 13036 KB | Output is correct |
56 | Correct | 120 ms | 13036 KB | Output is correct |
57 | Correct | 53 ms | 13036 KB | Output is correct |
58 | Correct | 60 ms | 13036 KB | Output is correct |
59 | Correct | 668 ms | 28748 KB | Output is correct |
60 | Correct | 663 ms | 37880 KB | Output is correct |
61 | Correct | 634 ms | 46692 KB | Output is correct |
62 | Correct | 94 ms | 46692 KB | Output is correct |
63 | Correct | 632 ms | 55136 KB | Output is correct |
64 | Correct | 596 ms | 63844 KB | Output is correct |
65 | Correct | 601 ms | 72756 KB | Output is correct |
66 | Correct | 607 ms | 81684 KB | Output is correct |
67 | Correct | 588 ms | 90252 KB | Output is correct |
68 | Correct | 610 ms | 99324 KB | Output is correct |
69 | Correct | 602 ms | 107936 KB | Output is correct |
70 | Correct | 59 ms | 107936 KB | Output is correct |
71 | Correct | 70 ms | 107936 KB | Output is correct |
72 | Correct | 56 ms | 107936 KB | Output is correct |
73 | Correct | 97 ms | 107936 KB | Output is correct |
74 | Correct | 52 ms | 107936 KB | Output is correct |
75 | Correct | 62 ms | 107936 KB | Output is correct |
76 | Correct | 57 ms | 107936 KB | Output is correct |
77 | Correct | 55 ms | 107936 KB | Output is correct |
78 | Correct | 61 ms | 107936 KB | Output is correct |
79 | Correct | 57 ms | 107936 KB | Output is correct |
80 | Correct | 55 ms | 107936 KB | Output is correct |
81 | Correct | 56 ms | 107936 KB | Output is correct |
82 | Correct | 54 ms | 107936 KB | Output is correct |
83 | Correct | 67 ms | 108620 KB | Output is correct |
84 | Correct | 58 ms | 109808 KB | Output is correct |
85 | Correct | 53 ms | 110580 KB | Output is correct |
86 | Correct | 56 ms | 111704 KB | Output is correct |
87 | Correct | 65 ms | 112540 KB | Output is correct |
88 | Correct | 56 ms | 113588 KB | Output is correct |
89 | Correct | 61 ms | 114500 KB | Output is correct |
90 | Correct | 80 ms | 115480 KB | Output is correct |