#include <stdio.h>
#include <stdlib.h>
#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]);
for (int i = 1; i <= N; i++){
for (int j = 1; j <= M; j++){
if (G[i][j] == 'R'){
for (int k = j; G[i][k] == 'R'; 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;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
6 ms |
11328 KB |
Output is correct |
7 |
Correct |
9 ms |
11592 KB |
Output is correct |
8 |
Correct |
19 ms |
12648 KB |
Output is correct |
9 |
Correct |
0 ms |
10140 KB |
Output is correct |
10 |
Correct |
4 ms |
11064 KB |
Output is correct |
11 |
Correct |
4 ms |
11064 KB |
Output is correct |
12 |
Correct |
6 ms |
11856 KB |
Output is correct |
13 |
Correct |
3 ms |
10800 KB |
Output is correct |
14 |
Correct |
4 ms |
10800 KB |
Output is correct |
15 |
Correct |
12 ms |
12780 KB |
Output is correct |
16 |
Correct |
36 ms |
13836 KB |
Output is correct |
17 |
Correct |
4 ms |
11064 KB |
Output is correct |
18 |
Correct |
15 ms |
13176 KB |
Output is correct |
19 |
Correct |
20 ms |
13836 KB |
Output is correct |
20 |
Correct |
7 ms |
12252 KB |
Output is correct |
21 |
Execution timed out |
1000 ms |
291032 KB |
Program timed out |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |