Submission #15074

# Submission time Handle Problem Language Result Execution time Memory
15074 2015-07-11T08:53:04 Z sujin 빨간 직사각형 (kriii3_QQ) C++
0 / 20
1000 ms 290636 KB
#define _CRT_SECURE_NO_WARNINGS

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

#define PII pair<int, int> 

using namespace std;

int N, M;
char G[3001][3001];
map<PII, int> D;
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]);
			G[i][j] = (G[i][j] == 'R');
		}
	}

	for (int i = 1; i <= N; i++){
		for (int j = 1; j <= M; j++){
			if (G[i][j] == 1){
				for (int k = j; G[i][k] == 1; k--){
					int d = D[PII((i - 1) * (M + 1) + j, j - k)];
					D[PII(i * (M + 1) + j, j - k)] = d + 1;
					S += d + 1;
				}
			}
		}
	}
	
	printf("%lld", S);

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 10008 KB Output is correct
2 Correct 0 ms 10008 KB Output is correct
3 Correct 0 ms 10008 KB Output is correct
4 Correct 0 ms 10140 KB Output is correct
5 Correct 4 ms 10800 KB Output is correct
6 Correct 7 ms 11328 KB Output is correct
7 Correct 5 ms 11592 KB Output is correct
8 Correct 16 ms 12648 KB Output is correct
9 Correct 2 ms 10140 KB Output is correct
10 Correct 0 ms 11064 KB Output is correct
11 Correct 0 ms 11064 KB Output is correct
12 Correct 9 ms 11856 KB Output is correct
13 Correct 0 ms 10800 KB Output is correct
14 Correct 3 ms 10800 KB Output is correct
15 Correct 9 ms 12780 KB Output is correct
16 Correct 31 ms 13836 KB Output is correct
17 Correct 3 ms 11064 KB Output is correct
18 Correct 19 ms 13176 KB Output is correct
19 Correct 15 ms 13836 KB Output is correct
20 Correct 7 ms 12252 KB Output is correct
21 Execution timed out 1000 ms 290636 KB Program timed out
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -