# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
145694 | 2019-08-20T18:58:55 Z | TadijaSebez | Dango Maker (JOI18_dango_maker) | C++11 | 392 ms | 51612 KB |
#include <bits/stdc++.h> using namespace std; const int N=3005; const int M=2*N; const int inf=1e9+7; bool can[M][N][2]; char s[N][N]; int dp[N][2][2]; void Clear(){ for(int i=0;i<N;i++) dp[i][0][0]=dp[i][1][0]=dp[i][0][1]=dp[i][1][1]=-inf;} void ckmx(int &a, int b){ a=max(a,b);} int main() { int n,m; scanf("%i %i",&n,&m); for(int i=1;i<=n;i++) scanf("%s",s[i]+1); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { if(s[i][j]=='R' && s[i][j+1]=='G' && s[i][j+2]=='W') can[i+j][i][0]=1; if(s[i][j]=='R' && s[i+1][j]=='G' && s[i+2][j]=='W') can[i+j][i][1]=1; } int ans=0; for(int z=2;z<=n+m;z++) { Clear(); dp[0][0][0]=0; for(int i=1;i<=n;i++) { for(int x=0;x<2;x++) for(int y=0;y<2;y++) { ckmx(dp[i][0][x],dp[i-1][x][y]); if(can[z][i][0] && x==0 && y==0) ckmx(dp[i][0][x],dp[i-1][x][y]+1); if(can[z][i][1]) ckmx(dp[i][1][x],dp[i-1][x][y]+1); } } int tmp=0; for(int x=0;x<2;x++) for(int y=0;y<2;y++) ckmx(tmp,dp[n][x][y]); ans+=tmp; } printf("%i\n",ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 3 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 | 2 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 |
# | 결과 | 실행 시간 | 메모리 | 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 | 3 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 | 2 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 | 504 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 | 504 KB | Output is correct |
23 | Correct | 2 ms | 504 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 | 2 ms | 376 KB | Output is correct |
28 | Correct | 2 ms | 504 KB | Output is correct |
29 | Correct | 2 ms | 504 KB | Output is correct |
30 | Correct | 2 ms | 504 KB | Output is correct |
31 | Correct | 3 ms | 504 KB | Output is correct |
32 | Correct | 2 ms | 376 KB | Output is correct |
33 | Correct | 3 ms | 504 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 | 504 KB | Output is correct |
37 | Correct | 2 ms | 504 KB | Output is correct |
38 | Correct | 2 ms | 376 KB | Output is correct |
39 | Correct | 3 ms | 376 KB | Output is correct |
40 | Correct | 2 ms | 376 KB | Output is correct |
41 | Correct | 3 ms | 504 KB | Output is correct |
42 | Correct | 3 ms | 504 KB | Output is correct |
43 | Correct | 2 ms | 504 KB | Output is correct |
44 | Correct | 3 ms | 376 KB | Output is correct |
45 | Correct | 2 ms | 504 KB | Output is correct |
46 | Correct | 2 ms | 504 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 | 504 KB | Output is correct |
50 | Correct | 2 ms | 376 KB | Output is correct |
51 | Correct | 2 ms | 380 KB | Output is correct |
52 | Correct | 2 ms | 376 KB | Output is correct |
53 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 3 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 | 2 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 | 504 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 | 504 KB | Output is correct |
23 | Correct | 2 ms | 504 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 | 2 ms | 376 KB | Output is correct |
28 | Correct | 2 ms | 504 KB | Output is correct |
29 | Correct | 2 ms | 504 KB | Output is correct |
30 | Correct | 2 ms | 504 KB | Output is correct |
31 | Correct | 3 ms | 504 KB | Output is correct |
32 | Correct | 2 ms | 376 KB | Output is correct |
33 | Correct | 3 ms | 504 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 | 504 KB | Output is correct |
37 | Correct | 2 ms | 504 KB | Output is correct |
38 | Correct | 2 ms | 376 KB | Output is correct |
39 | Correct | 3 ms | 376 KB | Output is correct |
40 | Correct | 2 ms | 376 KB | Output is correct |
41 | Correct | 3 ms | 504 KB | Output is correct |
42 | Correct | 3 ms | 504 KB | Output is correct |
43 | Correct | 2 ms | 504 KB | Output is correct |
44 | Correct | 3 ms | 376 KB | Output is correct |
45 | Correct | 2 ms | 504 KB | Output is correct |
46 | Correct | 2 ms | 504 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 | 504 KB | Output is correct |
50 | Correct | 2 ms | 376 KB | Output is correct |
51 | Correct | 2 ms | 380 KB | Output is correct |
52 | Correct | 2 ms | 376 KB | Output is correct |
53 | Correct | 2 ms | 376 KB | Output is correct |
54 | Correct | 25 ms | 888 KB | Output is correct |
55 | Correct | 123 ms | 9684 KB | Output is correct |
56 | Correct | 27 ms | 7800 KB | Output is correct |
57 | Correct | 67 ms | 12536 KB | Output is correct |
58 | Correct | 58 ms | 14200 KB | Output is correct |
59 | Correct | 392 ms | 51416 KB | Output is correct |
60 | Correct | 382 ms | 51180 KB | Output is correct |
61 | Correct | 380 ms | 51320 KB | Output is correct |
62 | Correct | 22 ms | 1144 KB | Output is correct |
63 | Correct | 372 ms | 50448 KB | Output is correct |
64 | Correct | 306 ms | 31992 KB | Output is correct |
65 | Correct | 307 ms | 31992 KB | Output is correct |
66 | Correct | 308 ms | 31988 KB | Output is correct |
67 | Correct | 338 ms | 51612 KB | Output is correct |
68 | Correct | 336 ms | 51448 KB | Output is correct |
69 | Correct | 343 ms | 51564 KB | Output is correct |
70 | Correct | 48 ms | 7672 KB | Output is correct |
71 | Correct | 48 ms | 7672 KB | Output is correct |
72 | Correct | 49 ms | 7676 KB | Output is correct |
73 | Correct | 48 ms | 7672 KB | Output is correct |
74 | Correct | 49 ms | 7672 KB | Output is correct |
75 | Correct | 48 ms | 7676 KB | Output is correct |
76 | Correct | 48 ms | 7672 KB | Output is correct |
77 | Correct | 48 ms | 7804 KB | Output is correct |
78 | Correct | 48 ms | 7672 KB | Output is correct |
79 | Correct | 48 ms | 7672 KB | Output is correct |
80 | Correct | 48 ms | 7672 KB | Output is correct |
81 | Correct | 48 ms | 7672 KB | Output is correct |
82 | Correct | 48 ms | 7676 KB | Output is correct |
83 | Correct | 48 ms | 7672 KB | Output is correct |
84 | Correct | 48 ms | 7672 KB | Output is correct |
85 | Correct | 48 ms | 7676 KB | Output is correct |
86 | Correct | 49 ms | 7672 KB | Output is correct |
87 | Correct | 48 ms | 7708 KB | Output is correct |
88 | Correct | 49 ms | 7676 KB | Output is correct |
89 | Correct | 49 ms | 7640 KB | Output is correct |
90 | Correct | 48 ms | 7672 KB | Output is correct |