이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |