# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
112600 | 2019-05-20T20:28:18 Z | luciocf | Dango Maker (JOI18_dango_maker) | C++14 | 630 ms | 141944 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e3+10; int n, m; int dp[3][maxn][maxn]; int ans[2*maxn]; bool h[maxn][maxn], v[maxn][maxn]; char tab[maxn][maxn]; int main(void) { scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) scanf(" %c", &tab[i][j]); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (tab[i][j] == 'G') { if (j < m && j > 1 && tab[i][j-1] == 'R' && tab[i][j+1] == 'W') h[i][j] = 1; if (i < n && i > 1 && tab[i-1][j] == 'R' && tab[i+1][j] == 'W') v[i][j] = 1; } } } for (int i = n; i >= 1; i--) { for (int j = 1; j <= m; j++) { dp[0][i][j] = max({dp[0][i+1][j-1], dp[1][i+1][j-1], dp[2][i+1][j-1]}); if (h[i][j]) dp[1][i][j] = 1+max(dp[0][i+1][j-1], dp[1][i+1][j-1]); if (v[i][j]) dp[2][i][j] = 1+max(dp[0][i+1][j-1], dp[2][i+1][j-1]); ans[i+j] = max({ans[i+j], dp[0][i][j], dp[1][i][j], dp[2][i][j]}); } } int tot = 0; for (int i = 1; i <= n+m; i++) tot += ans[i]; printf("%d\n", tot); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 512 KB | Output is correct |
20 | Correct | 2 ms | 512 KB | Output is correct |
21 | Correct | 2 ms | 512 KB | Output is correct |
22 | Correct | 2 ms | 512 KB | Output is correct |
23 | Correct | 2 ms | 512 KB | Output is correct |
24 | Correct | 2 ms | 384 KB | Output is correct |
25 | Correct | 2 ms | 384 KB | Output is correct |
26 | Correct | 2 ms | 384 KB | Output is correct |
27 | Correct | 2 ms | 512 KB | Output is correct |
28 | Correct | 2 ms | 512 KB | Output is correct |
29 | Correct | 2 ms | 512 KB | Output is correct |
30 | Correct | 2 ms | 384 KB | Output is correct |
31 | Correct | 2 ms | 384 KB | Output is correct |
32 | Correct | 2 ms | 384 KB | Output is correct |
33 | Correct | 2 ms | 512 KB | Output is correct |
34 | Correct | 2 ms | 640 KB | Output is correct |
35 | Correct | 2 ms | 512 KB | Output is correct |
36 | Correct | 2 ms | 512 KB | Output is correct |
37 | Correct | 2 ms | 512 KB | Output is correct |
38 | Correct | 2 ms | 512 KB | Output is correct |
39 | Correct | 2 ms | 540 KB | Output is correct |
40 | Correct | 3 ms | 512 KB | Output is correct |
41 | Correct | 2 ms | 512 KB | Output is correct |
42 | Correct | 2 ms | 512 KB | Output is correct |
43 | Correct | 2 ms | 512 KB | Output is correct |
44 | Correct | 2 ms | 512 KB | Output is correct |
45 | Correct | 2 ms | 644 KB | Output is correct |
46 | Correct | 2 ms | 612 KB | Output is correct |
47 | Correct | 2 ms | 512 KB | Output is correct |
48 | Correct | 2 ms | 484 KB | Output is correct |
49 | Correct | 2 ms | 544 KB | Output is correct |
50 | Correct | 2 ms | 512 KB | Output is correct |
51 | Correct | 3 ms | 612 KB | Output is correct |
52 | Correct | 2 ms | 512 KB | Output is correct |
53 | Correct | 2 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 512 KB | Output is correct |
20 | Correct | 2 ms | 512 KB | Output is correct |
21 | Correct | 2 ms | 512 KB | Output is correct |
22 | Correct | 2 ms | 512 KB | Output is correct |
23 | Correct | 2 ms | 512 KB | Output is correct |
24 | Correct | 2 ms | 384 KB | Output is correct |
25 | Correct | 2 ms | 384 KB | Output is correct |
26 | Correct | 2 ms | 384 KB | Output is correct |
27 | Correct | 2 ms | 512 KB | Output is correct |
28 | Correct | 2 ms | 512 KB | Output is correct |
29 | Correct | 2 ms | 512 KB | Output is correct |
30 | Correct | 2 ms | 384 KB | Output is correct |
31 | Correct | 2 ms | 384 KB | Output is correct |
32 | Correct | 2 ms | 384 KB | Output is correct |
33 | Correct | 2 ms | 512 KB | Output is correct |
34 | Correct | 2 ms | 640 KB | Output is correct |
35 | Correct | 2 ms | 512 KB | Output is correct |
36 | Correct | 2 ms | 512 KB | Output is correct |
37 | Correct | 2 ms | 512 KB | Output is correct |
38 | Correct | 2 ms | 512 KB | Output is correct |
39 | Correct | 2 ms | 540 KB | Output is correct |
40 | Correct | 3 ms | 512 KB | Output is correct |
41 | Correct | 2 ms | 512 KB | Output is correct |
42 | Correct | 2 ms | 512 KB | Output is correct |
43 | Correct | 2 ms | 512 KB | Output is correct |
44 | Correct | 2 ms | 512 KB | Output is correct |
45 | Correct | 2 ms | 644 KB | Output is correct |
46 | Correct | 2 ms | 612 KB | Output is correct |
47 | Correct | 2 ms | 512 KB | Output is correct |
48 | Correct | 2 ms | 484 KB | Output is correct |
49 | Correct | 2 ms | 544 KB | Output is correct |
50 | Correct | 2 ms | 512 KB | Output is correct |
51 | Correct | 3 ms | 612 KB | Output is correct |
52 | Correct | 2 ms | 512 KB | Output is correct |
53 | Correct | 2 ms | 512 KB | Output is correct |
54 | Correct | 2 ms | 408 KB | Output is correct |
55 | Correct | 25 ms | 22272 KB | Output is correct |
56 | Correct | 3 ms | 640 KB | Output is correct |
57 | Correct | 29 ms | 32768 KB | Output is correct |
58 | Correct | 82 ms | 33528 KB | Output is correct |
59 | Correct | 599 ms | 141732 KB | Output is correct |
60 | Correct | 630 ms | 141660 KB | Output is correct |
61 | Correct | 597 ms | 141708 KB | Output is correct |
62 | Correct | 3 ms | 512 KB | Output is correct |
63 | Correct | 574 ms | 141532 KB | Output is correct |
64 | Correct | 529 ms | 141944 KB | Output is correct |
65 | Correct | 574 ms | 141648 KB | Output is correct |
66 | Correct | 539 ms | 141828 KB | Output is correct |
67 | Correct | 489 ms | 76260 KB | Output is correct |
68 | Correct | 481 ms | 76412 KB | Output is correct |
69 | Correct | 504 ms | 92688 KB | Output is correct |
70 | Correct | 75 ms | 33912 KB | Output is correct |
71 | Correct | 75 ms | 33940 KB | Output is correct |
72 | Correct | 76 ms | 33912 KB | Output is correct |
73 | Correct | 75 ms | 33856 KB | Output is correct |
74 | Correct | 74 ms | 33912 KB | Output is correct |
75 | Correct | 74 ms | 33912 KB | Output is correct |
76 | Correct | 74 ms | 33912 KB | Output is correct |
77 | Correct | 75 ms | 33944 KB | Output is correct |
78 | Correct | 75 ms | 33996 KB | Output is correct |
79 | Correct | 75 ms | 33916 KB | Output is correct |
80 | Correct | 74 ms | 33912 KB | Output is correct |
81 | Correct | 74 ms | 33912 KB | Output is correct |
82 | Correct | 75 ms | 33912 KB | Output is correct |
83 | Correct | 75 ms | 33784 KB | Output is correct |
84 | Correct | 74 ms | 33952 KB | Output is correct |
85 | Correct | 74 ms | 33912 KB | Output is correct |
86 | Correct | 76 ms | 33912 KB | Output is correct |
87 | Correct | 76 ms | 33912 KB | Output is correct |
88 | Correct | 74 ms | 33912 KB | Output is correct |
89 | Correct | 76 ms | 34004 KB | Output is correct |
90 | Correct | 73 ms | 33908 KB | Output is correct |