답안 #125721

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
125721 2019-07-06T09:23:11 Z youngyojun Dango Maker (JOI18_dango_maker) C++11
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
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;
		for(int y = 1, x = sum-1; y <= H; y++, x--) {
			if(x < 1) break; if(W < x) continue;
			memset(D[y], 0, 12);
			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;
			ret = D[y+1][0] = *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:17:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if(x < 1) break; if(W < x) continue;
    ^~
dango_maker.cpp:17: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:11: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:12: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);
                              ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 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 Incorrect 2 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 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 Incorrect 2 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 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 Incorrect 2 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -