# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
75153 | 2018-09-08T13:56:40 Z | bogdan10bos | Dango Maker (JOI18_dango_maker) | C++14 | 3 ms | 656 KB |
#include <bits/stdc++.h> using namespace std; //#define FILE_IO int N, M, ans; char a[3005][3005]; int dp[3005][3][3]; int main() { #ifdef FILE_IO freopen("1.in", "r", stdin); freopen("1.out", "w", stdout); #endif scanf("%d%d\n", &N, &M); for(int i = 1; i <= N; i++) scanf("%s", a[i] + 1); for(int l = 3; l <= N + M; l++) { int st = max(1, l - M); for(int i = 1; i <= N; i++) for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) dp[i][j][k] = 0; int mx = 0; for(int i = st; i <= N && i < l; i++) { int x = i, y = l - i; for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) dp[i][j][0] = max(dp[i][j][0], dp[i - 1][k][j]); if(i > 2 && a[x][y] == 'W' && a[x - 1][y] == 'G' && a[x - 2][y] == 'R') { for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) if(j != 1 && k != 1) dp[i][j][1] = max(dp[i][j][1], dp[i - 1][k][j] + 1); } if(y > 2 && a[x][y] == 'W' && a[x][y - 1] == 'G' && a[x][y - 2] == 'R') { for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) dp[i][j][2] = max(dp[i][j][2], dp[i - 1][k][j] + 1); } for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) mx = max(mx, dp[i][j][k]); } ans += mx; } printf("%d\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 524 KB | Output is correct |
4 | Correct | 2 ms | 536 KB | Output is correct |
5 | Correct | 2 ms | 652 KB | Output is correct |
6 | Correct | 2 ms | 656 KB | Output is correct |
7 | Correct | 2 ms | 656 KB | Output is correct |
8 | Incorrect | 2 ms | 656 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 524 KB | Output is correct |
4 | Correct | 2 ms | 536 KB | Output is correct |
5 | Correct | 2 ms | 652 KB | Output is correct |
6 | Correct | 2 ms | 656 KB | Output is correct |
7 | Correct | 2 ms | 656 KB | Output is correct |
8 | Incorrect | 2 ms | 656 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 524 KB | Output is correct |
4 | Correct | 2 ms | 536 KB | Output is correct |
5 | Correct | 2 ms | 652 KB | Output is correct |
6 | Correct | 2 ms | 656 KB | Output is correct |
7 | Correct | 2 ms | 656 KB | Output is correct |
8 | Incorrect | 2 ms | 656 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |