답안 #41076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41076 2018-02-12T12:31:17 Z kdh9949 Dango Maker (JOI18_dango_maker) C++14
100 / 100
633 ms 150768 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 3005;

int n, m, d[N][N][4], r;
char a[N][N];

int v(int x, int y, int d){
	return
		a[x][y] == 'R' &&
		a[x + d][y + !d] == 'G' &&
		a[x + 2 * d][y + 2 * !d] == 'W';
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> n >> m;
	for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) cin >> a[i][j];
	for(int t = 2; t <= n + m; t++){
		int cm = 0;
		for(int i = t - 1, j; i >= 1; i--){
			j = t - i;
			if(j < 1 || j > m || i < 1 || i > n) continue;
			int *c = d[i][j], *p = d[i + 1][j - 1];
			c[0] = max(p[0] + v(i, j, 1), p[1]);
			c[1] = max(p[2], p[3]);
			if(v(i, j, 0)){
				c[2] = max(p[0], p[1]) + 1;
				c[3] = max(p[2], p[3]) + 1;
			}
			cm = max(cm, *max_element(c, c + 4));
		}
		r += cm;
	}
	cout << r;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 552 KB Output is correct
4 Correct 2 ms 552 KB Output is correct
5 Correct 1 ms 552 KB Output is correct
6 Correct 2 ms 552 KB Output is correct
7 Correct 2 ms 552 KB Output is correct
8 Correct 1 ms 552 KB Output is correct
9 Correct 1 ms 552 KB Output is correct
10 Correct 2 ms 552 KB Output is correct
11 Correct 2 ms 552 KB Output is correct
12 Correct 2 ms 552 KB Output is correct
13 Correct 2 ms 552 KB Output is correct
14 Correct 1 ms 552 KB Output is correct
15 Correct 1 ms 552 KB Output is correct
16 Correct 1 ms 552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 552 KB Output is correct
4 Correct 2 ms 552 KB Output is correct
5 Correct 1 ms 552 KB Output is correct
6 Correct 2 ms 552 KB Output is correct
7 Correct 2 ms 552 KB Output is correct
8 Correct 1 ms 552 KB Output is correct
9 Correct 1 ms 552 KB Output is correct
10 Correct 2 ms 552 KB Output is correct
11 Correct 2 ms 552 KB Output is correct
12 Correct 2 ms 552 KB Output is correct
13 Correct 2 ms 552 KB Output is correct
14 Correct 1 ms 552 KB Output is correct
15 Correct 1 ms 552 KB Output is correct
16 Correct 1 ms 552 KB Output is correct
17 Correct 2 ms 552 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 2 ms 656 KB Output is correct
21 Correct 2 ms 656 KB Output is correct
22 Correct 2 ms 656 KB Output is correct
23 Correct 2 ms 656 KB Output is correct
24 Correct 2 ms 656 KB Output is correct
25 Correct 2 ms 656 KB Output is correct
26 Correct 1 ms 656 KB Output is correct
27 Correct 1 ms 656 KB Output is correct
28 Correct 2 ms 656 KB Output is correct
29 Correct 2 ms 656 KB Output is correct
30 Correct 2 ms 656 KB Output is correct
31 Correct 2 ms 656 KB Output is correct
32 Correct 2 ms 656 KB Output is correct
33 Correct 2 ms 656 KB Output is correct
34 Correct 2 ms 656 KB Output is correct
35 Correct 2 ms 656 KB Output is correct
36 Correct 2 ms 656 KB Output is correct
37 Correct 2 ms 656 KB Output is correct
38 Correct 2 ms 656 KB Output is correct
39 Correct 2 ms 656 KB Output is correct
40 Correct 2 ms 656 KB Output is correct
41 Correct 1 ms 656 KB Output is correct
42 Correct 2 ms 656 KB Output is correct
43 Correct 2 ms 656 KB Output is correct
44 Correct 2 ms 656 KB Output is correct
45 Correct 2 ms 656 KB Output is correct
46 Correct 2 ms 656 KB Output is correct
47 Correct 2 ms 656 KB Output is correct
48 Correct 2 ms 656 KB Output is correct
49 Correct 2 ms 656 KB Output is correct
50 Correct 2 ms 656 KB Output is correct
51 Correct 2 ms 656 KB Output is correct
52 Correct 2 ms 656 KB Output is correct
53 Correct 2 ms 656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 552 KB Output is correct
4 Correct 2 ms 552 KB Output is correct
5 Correct 1 ms 552 KB Output is correct
6 Correct 2 ms 552 KB Output is correct
7 Correct 2 ms 552 KB Output is correct
8 Correct 1 ms 552 KB Output is correct
9 Correct 1 ms 552 KB Output is correct
10 Correct 2 ms 552 KB Output is correct
11 Correct 2 ms 552 KB Output is correct
12 Correct 2 ms 552 KB Output is correct
13 Correct 2 ms 552 KB Output is correct
14 Correct 1 ms 552 KB Output is correct
15 Correct 1 ms 552 KB Output is correct
16 Correct 1 ms 552 KB Output is correct
17 Correct 2 ms 552 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 2 ms 656 KB Output is correct
21 Correct 2 ms 656 KB Output is correct
22 Correct 2 ms 656 KB Output is correct
23 Correct 2 ms 656 KB Output is correct
24 Correct 2 ms 656 KB Output is correct
25 Correct 2 ms 656 KB Output is correct
26 Correct 1 ms 656 KB Output is correct
27 Correct 1 ms 656 KB Output is correct
28 Correct 2 ms 656 KB Output is correct
29 Correct 2 ms 656 KB Output is correct
30 Correct 2 ms 656 KB Output is correct
31 Correct 2 ms 656 KB Output is correct
32 Correct 2 ms 656 KB Output is correct
33 Correct 2 ms 656 KB Output is correct
34 Correct 2 ms 656 KB Output is correct
35 Correct 2 ms 656 KB Output is correct
36 Correct 2 ms 656 KB Output is correct
37 Correct 2 ms 656 KB Output is correct
38 Correct 2 ms 656 KB Output is correct
39 Correct 2 ms 656 KB Output is correct
40 Correct 2 ms 656 KB Output is correct
41 Correct 1 ms 656 KB Output is correct
42 Correct 2 ms 656 KB Output is correct
43 Correct 2 ms 656 KB Output is correct
44 Correct 2 ms 656 KB Output is correct
45 Correct 2 ms 656 KB Output is correct
46 Correct 2 ms 656 KB Output is correct
47 Correct 2 ms 656 KB Output is correct
48 Correct 2 ms 656 KB Output is correct
49 Correct 2 ms 656 KB Output is correct
50 Correct 2 ms 656 KB Output is correct
51 Correct 2 ms 656 KB Output is correct
52 Correct 2 ms 656 KB Output is correct
53 Correct 2 ms 656 KB Output is correct
54 Correct 8 ms 680 KB Output is correct
55 Correct 30 ms 21712 KB Output is correct
56 Correct 9 ms 21712 KB Output is correct
57 Correct 18 ms 21712 KB Output is correct
58 Correct 65 ms 23232 KB Output is correct
59 Correct 633 ms 150580 KB Output is correct
60 Correct 620 ms 150580 KB Output is correct
61 Correct 622 ms 150636 KB Output is correct
62 Correct 8 ms 150636 KB Output is correct
63 Correct 596 ms 150636 KB Output is correct
64 Correct 545 ms 150636 KB Output is correct
65 Correct 553 ms 150636 KB Output is correct
66 Correct 525 ms 150768 KB Output is correct
67 Correct 528 ms 150768 KB Output is correct
68 Correct 560 ms 150768 KB Output is correct
69 Correct 547 ms 150768 KB Output is correct
70 Correct 51 ms 150768 KB Output is correct
71 Correct 51 ms 150768 KB Output is correct
72 Correct 58 ms 150768 KB Output is correct
73 Correct 59 ms 150768 KB Output is correct
74 Correct 53 ms 150768 KB Output is correct
75 Correct 54 ms 150768 KB Output is correct
76 Correct 52 ms 150768 KB Output is correct
77 Correct 56 ms 150768 KB Output is correct
78 Correct 58 ms 150768 KB Output is correct
79 Correct 50 ms 150768 KB Output is correct
80 Correct 58 ms 150768 KB Output is correct
81 Correct 60 ms 150768 KB Output is correct
82 Correct 59 ms 150768 KB Output is correct
83 Correct 54 ms 150768 KB Output is correct
84 Correct 50 ms 150768 KB Output is correct
85 Correct 52 ms 150768 KB Output is correct
86 Correct 48 ms 150768 KB Output is correct
87 Correct 48 ms 150768 KB Output is correct
88 Correct 53 ms 150768 KB Output is correct
89 Correct 49 ms 150768 KB Output is correct
90 Correct 48 ms 150768 KB Output is correct