Submission #125717

# Submission time Handle Problem Language Result Execution time Memory
125717 2019-07-06T09:21:18 Z youngyojun Dango Maker (JOI18_dango_maker) C++11
100 / 100
178 ms 18168 KB
#include <bits/stdc++.h>
#define upmax(a,b) (a)=max((a),(b))
using namespace std;

char A[3005][3005];

int D[3005][3];

int H, W, Ans;

int main() {
	scanf("%d%d", &H, &W);
	for(int i = 1; i <= H; i++) scanf(" %s", A[i]+1);

	for(int sum = 3; sum < H+W; sum++) {
		int ret = 0;
		memset(D[0], 0, 3005*3*4);
		for(int y = 1, x = sum-1; y <= H; y++, x--) {
			if(x < 1) break; if(W < x) continue;
			D[y][0] = *max_element(D[y-1], D[y-1]+3);
			if('G' != A[y][x]) continue;
			if('R' == A[y][x-1] && 'W' == A[y][x+1])
				D[y][1] = max(D[y-1][0], D[y-1][1]) + 1;
			if('R' == A[y-1][x] && 'W' == A[y+1][x])
				D[y][2] = max(D[y-1][0], D[y-1][2]) + 1;
			upmax(ret, *max_element(D[y], D[y]+3));
		}
		Ans += ret;
	}

	cout << Ans << endl;
	return 0;
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:19:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if(x < 1) break; if(W < x) continue;
    ^~
dango_maker.cpp:19:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    if(x < 1) break; if(W < x) continue;
                     ^~
dango_maker.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &H, &W);
  ~~~~~^~~~~~~~~~~~~~~~
dango_maker.cpp:13:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 1; i <= H; i++) scanf(" %s", A[i]+1);
                              ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 380 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 2 ms 376 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 2 ms 376 KB Output is correct
40 Correct 2 ms 376 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 2 ms 376 KB Output is correct
43 Correct 2 ms 376 KB Output is correct
44 Correct 2 ms 376 KB Output is correct
45 Correct 2 ms 376 KB Output is correct
46 Correct 2 ms 376 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 2 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 2 ms 376 KB Output is correct
51 Correct 2 ms 376 KB Output is correct
52 Correct 2 ms 380 KB Output is correct
53 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 380 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 2 ms 376 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 2 ms 376 KB Output is correct
40 Correct 2 ms 376 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 2 ms 376 KB Output is correct
43 Correct 2 ms 376 KB Output is correct
44 Correct 2 ms 376 KB Output is correct
45 Correct 2 ms 376 KB Output is correct
46 Correct 2 ms 376 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 2 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 2 ms 376 KB Output is correct
51 Correct 2 ms 376 KB Output is correct
52 Correct 2 ms 380 KB Output is correct
53 Correct 2 ms 376 KB Output is correct
54 Correct 6 ms 376 KB Output is correct
55 Correct 21 ms 9208 KB Output is correct
56 Correct 7 ms 376 KB Output is correct
57 Correct 13 ms 6264 KB Output is correct
58 Correct 23 ms 4216 KB Output is correct
59 Correct 178 ms 18016 KB Output is correct
60 Correct 175 ms 18040 KB Output is correct
61 Correct 177 ms 18040 KB Output is correct
62 Correct 6 ms 376 KB Output is correct
63 Correct 170 ms 17656 KB Output is correct
64 Correct 117 ms 18168 KB Output is correct
65 Correct 116 ms 18140 KB Output is correct
66 Correct 117 ms 17912 KB Output is correct
67 Correct 120 ms 18020 KB Output is correct
68 Correct 118 ms 18052 KB Output is correct
69 Correct 121 ms 18040 KB Output is correct
70 Correct 16 ms 4344 KB Output is correct
71 Correct 16 ms 4216 KB Output is correct
72 Correct 16 ms 4216 KB Output is correct
73 Correct 18 ms 4344 KB Output is correct
74 Correct 16 ms 4344 KB Output is correct
75 Correct 16 ms 4216 KB Output is correct
76 Correct 16 ms 4216 KB Output is correct
77 Correct 16 ms 4216 KB Output is correct
78 Correct 16 ms 4344 KB Output is correct
79 Correct 16 ms 4216 KB Output is correct
80 Correct 16 ms 4216 KB Output is correct
81 Correct 16 ms 4344 KB Output is correct
82 Correct 16 ms 4344 KB Output is correct
83 Correct 16 ms 4344 KB Output is correct
84 Correct 33 ms 4344 KB Output is correct
85 Correct 16 ms 4360 KB Output is correct
86 Correct 17 ms 4344 KB Output is correct
87 Correct 16 ms 4316 KB Output is correct
88 Correct 16 ms 4272 KB Output is correct
89 Correct 16 ms 4220 KB Output is correct
90 Correct 16 ms 4344 KB Output is correct