Submission #15085

# Submission time Handle Problem Language Result Execution time Memory
15085 2015-07-11T09:27:32 Z sujin 빨간 직사각형 (kriii3_QQ) C++
10 / 20
1000 ms 10004 KB
#define _CRT_SECURE_NO_WARNINGS

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

using namespace std;

int N, M;
char G[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]);

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

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 10004 KB Output is correct
2 Correct 0 ms 10004 KB Output is correct
3 Correct 0 ms 10004 KB Output is correct
4 Correct 0 ms 10004 KB Output is correct
5 Correct 0 ms 10004 KB Output is correct
6 Correct 0 ms 10004 KB Output is correct
7 Correct 0 ms 10004 KB Output is correct
8 Correct 0 ms 10004 KB Output is correct
9 Correct 0 ms 10004 KB Output is correct
10 Correct 0 ms 10004 KB Output is correct
11 Correct 0 ms 10004 KB Output is correct
12 Correct 0 ms 10004 KB Output is correct
13 Correct 0 ms 10004 KB Output is correct
14 Correct 0 ms 10004 KB Output is correct
15 Correct 0 ms 10004 KB Output is correct
16 Correct 0 ms 10004 KB Output is correct
17 Correct 0 ms 10004 KB Output is correct
18 Correct 0 ms 10004 KB Output is correct
19 Correct 0 ms 10004 KB Output is correct
20 Correct 0 ms 10004 KB Output is correct
21 Correct 87 ms 10004 KB Output is correct
22 Correct 34 ms 10004 KB Output is correct
23 Correct 35 ms 10004 KB Output is correct
24 Correct 145 ms 10004 KB Output is correct
25 Correct 144 ms 10004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 10004 KB Output is correct
2 Correct 36 ms 10004 KB Output is correct
3 Correct 613 ms 10004 KB Output is correct
4 Execution timed out 1000 ms 10004 KB Program timed out
5 Halted 0 ms 0 KB -