Submission #20241

# Submission time Handle Problem Language Result Execution time Memory
20241 2016-07-12T16:48:50 Z nova0821 빨간 직사각형 (kriii3_QQ) C++
10 / 20
183 ms 81384 KB
#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
1 Correct 0 ms 81384 KB Output is correct
2 Correct 0 ms 81384 KB Output is correct
3 Correct 0 ms 81384 KB Output is correct
4 Correct 0 ms 81384 KB Output is correct
5 Correct 0 ms 81384 KB Output is correct
6 Correct 0 ms 81384 KB Output is correct
7 Correct 0 ms 81384 KB Output is correct
8 Correct 0 ms 81384 KB Output is correct
9 Correct 0 ms 81384 KB Output is correct
10 Correct 0 ms 81384 KB Output is correct
11 Correct 0 ms 81384 KB Output is correct
12 Correct 0 ms 81384 KB Output is correct
13 Correct 0 ms 81384 KB Output is correct
14 Correct 0 ms 81384 KB Output is correct
15 Correct 0 ms 81384 KB Output is correct
16 Correct 0 ms 81384 KB Output is correct
17 Correct 0 ms 81384 KB Output is correct
18 Correct 0 ms 81384 KB Output is correct
19 Correct 0 ms 81384 KB Output is correct
20 Correct 0 ms 81384 KB Output is correct
21 Correct 33 ms 81384 KB Output is correct
22 Correct 6 ms 81384 KB Output is correct
23 Correct 6 ms 81384 KB Output is correct
24 Correct 49 ms 81384 KB Output is correct
25 Correct 46 ms 81384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 81384 KB Output is correct
2 Correct 6 ms 81384 KB Output is correct
3 Incorrect 183 ms 81384 KB Output isn't correct
4 Halted 0 ms 0 KB -