이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 i = 1; i <= N; i++){
		for (int j = 1; j <= M; j++){
			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;
				}
			}
		}
	}
	
	printf("%lld", S);
	return 0;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |