답안 #15075

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
15075 2015-07-11T08:53:58 Z gs14004 빨간 직사각형 (kriii3_QQ) C++14
20 / 20
284 ms 1596 KB
#include <cstdio>
#include <stack>
using namespace std;

int height[3005];
char str[3005];
int n, m;
long long ret;

int main(){
	scanf("%d %d",&n,&m);
	for(int i=1; i<=n; i++){
		scanf("%s",str + 1);
		stack<int> hi, pos, area;
		hi.push(0);
		pos.push(0);
		area.push(0);
		for(int j=1; j<=m; j++){
			if(str[j] == 'R') height[j]++;
			else height[j] = 0;
			while(!hi.empty() && hi.top() > height[j]){
				hi.pop();
				area.pop();
				pos.pop();
			}
			area.push(area.top() + (j - pos.top()) * height[j]);
			pos.push(j);
			hi.push(height[j]);
			ret += area.top();
		}
	}
	printf("%lld",ret);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1596 KB Output is correct
2 Correct 0 ms 1596 KB Output is correct
3 Correct 0 ms 1596 KB Output is correct
4 Correct 0 ms 1596 KB Output is correct
5 Correct 0 ms 1596 KB Output is correct
6 Correct 0 ms 1596 KB Output is correct
7 Correct 0 ms 1596 KB Output is correct
8 Correct 0 ms 1596 KB Output is correct
9 Correct 0 ms 1596 KB Output is correct
10 Correct 0 ms 1596 KB Output is correct
11 Correct 0 ms 1596 KB Output is correct
12 Correct 0 ms 1596 KB Output is correct
13 Correct 0 ms 1596 KB Output is correct
14 Correct 0 ms 1596 KB Output is correct
15 Correct 0 ms 1596 KB Output is correct
16 Correct 0 ms 1596 KB Output is correct
17 Correct 0 ms 1596 KB Output is correct
18 Correct 0 ms 1596 KB Output is correct
19 Correct 0 ms 1596 KB Output is correct
20 Correct 0 ms 1596 KB Output is correct
21 Correct 5 ms 1596 KB Output is correct
22 Correct 6 ms 1596 KB Output is correct
23 Correct 7 ms 1596 KB Output is correct
24 Correct 0 ms 1596 KB Output is correct
25 Correct 5 ms 1596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1596 KB Output is correct
2 Correct 0 ms 1596 KB Output is correct
3 Correct 29 ms 1596 KB Output is correct
4 Correct 27 ms 1596 KB Output is correct
5 Correct 0 ms 1596 KB Output is correct
6 Correct 0 ms 1596 KB Output is correct
7 Correct 0 ms 1596 KB Output is correct
8 Correct 0 ms 1596 KB Output is correct
9 Correct 0 ms 1596 KB Output is correct
10 Correct 23 ms 1596 KB Output is correct
11 Correct 24 ms 1596 KB Output is correct
12 Correct 0 ms 1596 KB Output is correct
13 Correct 33 ms 1596 KB Output is correct
14 Correct 3 ms 1596 KB Output is correct
15 Correct 5 ms 1596 KB Output is correct
16 Correct 4 ms 1596 KB Output is correct
17 Correct 2 ms 1596 KB Output is correct
18 Correct 0 ms 1596 KB Output is correct
19 Correct 0 ms 1596 KB Output is correct
20 Correct 5 ms 1596 KB Output is correct
21 Correct 7 ms 1596 KB Output is correct
22 Correct 8 ms 1596 KB Output is correct
23 Correct 11 ms 1596 KB Output is correct
24 Correct 10 ms 1596 KB Output is correct
25 Correct 13 ms 1596 KB Output is correct
26 Correct 2 ms 1596 KB Output is correct
27 Correct 16 ms 1596 KB Output is correct
28 Correct 10 ms 1596 KB Output is correct
29 Correct 0 ms 1596 KB Output is correct
30 Correct 10 ms 1596 KB Output is correct
31 Correct 208 ms 1596 KB Output is correct
32 Correct 204 ms 1596 KB Output is correct
33 Correct 182 ms 1596 KB Output is correct
34 Correct 170 ms 1596 KB Output is correct
35 Correct 208 ms 1596 KB Output is correct
36 Correct 284 ms 1596 KB Output is correct
37 Correct 276 ms 1596 KB Output is correct
38 Correct 262 ms 1596 KB Output is correct
39 Correct 269 ms 1596 KB Output is correct
40 Correct 210 ms 1596 KB Output is correct