답안 #15079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
15079 2015-07-11T09:15:28 Z sujin 빨간 직사각형 (kriii3_QQ) C++
10 / 20
461 ms 524288 KB
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>
#include <vector>

using namespace std;

int N, M;
char G[3001][3001];
vector<int> D[3001][3001];
long long S;

int main(){
	
	scanf("%d %d", &N, &M);

	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= M; j++)
			scanf(" %c", &G[i][j]);

	for (int i = 1; i <= N; i++){
		for (int j = 1; j <= M; j++){
			if (G[i][j] == 'R'){
				int s = D[i - 1][j].size();
				for (int k = j; G[i][k] == 'R'; k--){
					int d = (j - k < s ? D[i - 1][j][j - k] : 0);
					D[i][j].push_back(d + 1);
					S += d + 1;
				}
			}
			D[i - 1][j].clear();
		}
	}
	
	printf("%lld", S);

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 221084 KB Output is correct
2 Correct 35 ms 221084 KB Output is correct
3 Correct 46 ms 221084 KB Output is correct
4 Correct 27 ms 221084 KB Output is correct
5 Correct 31 ms 221084 KB Output is correct
6 Correct 42 ms 221216 KB Output is correct
7 Correct 41 ms 221216 KB Output is correct
8 Correct 35 ms 221348 KB Output is correct
9 Correct 36 ms 221084 KB Output is correct
10 Correct 30 ms 221084 KB Output is correct
11 Correct 35 ms 221084 KB Output is correct
12 Correct 62 ms 221216 KB Output is correct
13 Correct 45 ms 221084 KB Output is correct
14 Correct 37 ms 221084 KB Output is correct
15 Correct 43 ms 221216 KB Output is correct
16 Correct 39 ms 221348 KB Output is correct
17 Correct 33 ms 221084 KB Output is correct
18 Correct 31 ms 221348 KB Output is correct
19 Correct 39 ms 221348 KB Output is correct
20 Correct 30 ms 221216 KB Output is correct
21 Correct 258 ms 341732 KB Output is correct
22 Correct 149 ms 251048 KB Output is correct
23 Correct 138 ms 247088 KB Output is correct
24 Correct 380 ms 424760 KB Output is correct
25 Correct 374 ms 418688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 224120 KB Output is correct
2 Correct 146 ms 255140 KB Output is correct
3 Memory limit exceeded 461 ms 524288 KB Memory limit exceeded
4 Halted 0 ms 0 KB -