이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#define MAX 3002
char input[MAX][MAX];
int countX[MAX][MAX];
int countY[MAX][MAX];
int N, M, result;
using namespace std;
void count() 
{
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			if (input[i][j] == 'R') {
				if (j == 0) countX[i][j] = 1;
				else countX[i][j] = countX[i][j - 1] + 1;
				if (i == 0) countY[i][j] = 1;
				else countY[i][j] = countY[i - 1][j] + 1;
			}
			else countX[i][j] = countY[i][j] = 0;
		}
	}
}
void solve()
{
	result = 0;
	int min;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			min = MAX;
			for (int k = 0; k < countX[i][j]; k++) {
				if (min > countY[i][j - k]) min = countY[i][j - k];
				result += min;
			}
		}
	}
}
int main(int argc, char** argv)
{
	ios::sync_with_stdio(false);
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> input[i];
	}
	count();
	solve();
	cout << result << endl;
	return 0;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |