# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
79947 | 2018-10-17T14:48:10 Z | Just_Solve_The_Problem | Dango Maker (JOI18_dango_maker) | C++11 | 2 ms | 720 KB |
#include <bits/stdc++.h> using namespace std; const int N = (int)3e3 + 7; int n, m; char C[N][N]; int c[N][N]; int cost[N]; main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) { getchar(); for (int j = 1; j <= m; j++) { C[i][j] = getchar(); } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (C[i][j] == 'G') { c[i][j] = ((C[i][j - 1] == 'R' && C[i][j + 1] == 'W') || (C[i - 1][j] == 'R' && C[i + 1][j] == 'W')); } } } for (int i = 1; i <= n; i++) { int x, y; x = i; y = 1; int res = 0; while (x >= 1 && y <= m) { if (!c[x][y]) { if (res) { cost[i] += (res + 1) / 2; res = 0; } } else { res++; } x--; y++; } cost[i] += (res + 1) / 2; } int ans = 0; for (int i = 1; i <= n; i++) { ans += cost[i]; } memset(cost, 0, sizeof cost); for (int i = 2; i <= m; i++) { int x, y; x = n; y = i; int res = 0; while (x >= 1 && y <= m) { if (!c[x][y]) { if (res) { cost[i] += (res + 1) / 2; res = 0; } } else { res++; } x--; y++; } cost[i] += (res + 1) / 2; } for (int i = 1; i <= m; i++) { ans += cost[i]; } cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 512 KB | Output is correct |
6 | Correct | 2 ms | 524 KB | Output is correct |
7 | Correct | 2 ms | 524 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 2 ms | 616 KB | Output is correct |
11 | Correct | 2 ms | 616 KB | Output is correct |
12 | Correct | 2 ms | 720 KB | Output is correct |
13 | Correct | 2 ms | 720 KB | Output is correct |
14 | Correct | 2 ms | 720 KB | Output is correct |
15 | Correct | 2 ms | 720 KB | Output is correct |
16 | Correct | 2 ms | 720 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 512 KB | Output is correct |
6 | Correct | 2 ms | 524 KB | Output is correct |
7 | Correct | 2 ms | 524 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 2 ms | 616 KB | Output is correct |
11 | Correct | 2 ms | 616 KB | Output is correct |
12 | Correct | 2 ms | 720 KB | Output is correct |
13 | Correct | 2 ms | 720 KB | Output is correct |
14 | Correct | 2 ms | 720 KB | Output is correct |
15 | Correct | 2 ms | 720 KB | Output is correct |
16 | Correct | 2 ms | 720 KB | Output is correct |
17 | Correct | 2 ms | 720 KB | Output is correct |
18 | Incorrect | 2 ms | 720 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 512 KB | Output is correct |
6 | Correct | 2 ms | 524 KB | Output is correct |
7 | Correct | 2 ms | 524 KB | Output is correct |
8 | Correct | 2 ms | 616 KB | Output is correct |
9 | Correct | 2 ms | 616 KB | Output is correct |
10 | Correct | 2 ms | 616 KB | Output is correct |
11 | Correct | 2 ms | 616 KB | Output is correct |
12 | Correct | 2 ms | 720 KB | Output is correct |
13 | Correct | 2 ms | 720 KB | Output is correct |
14 | Correct | 2 ms | 720 KB | Output is correct |
15 | Correct | 2 ms | 720 KB | Output is correct |
16 | Correct | 2 ms | 720 KB | Output is correct |
17 | Correct | 2 ms | 720 KB | Output is correct |
18 | Incorrect | 2 ms | 720 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |