Submission #15084

# Submission time Handle Problem Language Result Execution time Memory
15084 2015-07-11T09:23:27 Z sujin 빨간 직사각형 (kriii3_QQ) C++
10 / 20
598 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 j = 1; j <= M; j++){
		for (int i = 1; i <= N; i++){
			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;
}
# Verdict Execution time Memory Grader output
1 Correct 36 ms 221084 KB Output is correct
2 Correct 26 ms 221084 KB Output is correct
3 Correct 34 ms 221084 KB Output is correct
4 Correct 32 ms 221084 KB Output is correct
5 Correct 28 ms 221084 KB Output is correct
6 Correct 31 ms 221216 KB Output is correct
7 Correct 43 ms 221216 KB Output is correct
8 Correct 31 ms 221348 KB Output is correct
9 Correct 32 ms 221084 KB Output is correct
10 Correct 40 ms 221084 KB Output is correct
11 Correct 27 ms 221084 KB Output is correct
12 Correct 27 ms 221216 KB Output is correct
13 Correct 57 ms 221084 KB Output is correct
14 Correct 41 ms 221084 KB Output is correct
15 Correct 45 ms 221216 KB Output is correct
16 Correct 38 ms 221348 KB Output is correct
17 Correct 31 ms 221084 KB Output is correct
18 Correct 33 ms 221348 KB Output is correct
19 Correct 28 ms 221348 KB Output is correct
20 Correct 42 ms 221216 KB Output is correct
21 Correct 323 ms 342788 KB Output is correct
22 Correct 192 ms 251180 KB Output is correct
23 Correct 174 ms 247220 KB Output is correct
24 Correct 450 ms 426080 KB Output is correct
25 Correct 466 ms 420404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 224120 KB Output is correct
2 Correct 160 ms 255140 KB Output is correct
3 Memory limit exceeded 598 ms 524288 KB Memory limit exceeded
4 Halted 0 ms 0 KB -