# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15160 |
2015-07-12T02:02:43 Z |
gs13068 |
빨간 직사각형 (kriii3_QQ) |
C++ |
|
269 ms |
55352 KB |
#include<cstdio>
char a[3333][3333];
int d[3333][3333];
int s[3333],p[3333],sn;
int main()
{
long long r=0;
int i,j,n,m,t;
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++)
{
scanf("%s",a[i]+1);
for(j=1;j<=m;j++)
{
d[i][j]=d[i][j-1]+1;
if(a[i][j]=='B')d[i][j]=0;
}
}
for(j=1;j<=m;j++)
{
sn=t=0;
s[sn]=0;
p[sn]=0;
sn++;
for(i=1;i<=n;i++)
{
while(sn>=2&&s[sn-1]>d[i][j])
{
t-=s[sn-1]*(p[sn-1]-p[sn-2]);
sn--;
}
t+=d[i][j]*(i-p[sn-1]);
s[sn]=d[i][j];
p[sn]=i;
sn++;
r+=t;
}
}
printf("%lld",r);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
55352 KB |
Output is correct |
2 |
Correct |
0 ms |
55352 KB |
Output is correct |
3 |
Correct |
0 ms |
55352 KB |
Output is correct |
4 |
Correct |
0 ms |
55352 KB |
Output is correct |
5 |
Correct |
0 ms |
55352 KB |
Output is correct |
6 |
Correct |
0 ms |
55352 KB |
Output is correct |
7 |
Correct |
0 ms |
55352 KB |
Output is correct |
8 |
Correct |
0 ms |
55352 KB |
Output is correct |
9 |
Correct |
0 ms |
55352 KB |
Output is correct |
10 |
Correct |
0 ms |
55352 KB |
Output is correct |
11 |
Correct |
0 ms |
55352 KB |
Output is correct |
12 |
Correct |
0 ms |
55352 KB |
Output is correct |
13 |
Correct |
0 ms |
55352 KB |
Output is correct |
14 |
Correct |
0 ms |
55352 KB |
Output is correct |
15 |
Correct |
0 ms |
55352 KB |
Output is correct |
16 |
Correct |
0 ms |
55352 KB |
Output is correct |
17 |
Correct |
0 ms |
55352 KB |
Output is correct |
18 |
Correct |
0 ms |
55352 KB |
Output is correct |
19 |
Correct |
0 ms |
55352 KB |
Output is correct |
20 |
Correct |
0 ms |
55352 KB |
Output is correct |
21 |
Correct |
4 ms |
55352 KB |
Output is correct |
22 |
Correct |
7 ms |
55352 KB |
Output is correct |
23 |
Correct |
2 ms |
55352 KB |
Output is correct |
24 |
Correct |
3 ms |
55352 KB |
Output is correct |
25 |
Correct |
4 ms |
55352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
55352 KB |
Output is correct |
2 |
Correct |
4 ms |
55352 KB |
Output is correct |
3 |
Correct |
16 ms |
55352 KB |
Output is correct |
4 |
Correct |
19 ms |
55352 KB |
Output is correct |
5 |
Correct |
24 ms |
55352 KB |
Output is correct |
6 |
Correct |
17 ms |
55352 KB |
Output is correct |
7 |
Correct |
7 ms |
55352 KB |
Output is correct |
8 |
Correct |
8 ms |
55352 KB |
Output is correct |
9 |
Correct |
14 ms |
55352 KB |
Output is correct |
10 |
Correct |
8 ms |
55352 KB |
Output is correct |
11 |
Correct |
17 ms |
55352 KB |
Output is correct |
12 |
Correct |
0 ms |
55352 KB |
Output is correct |
13 |
Correct |
23 ms |
55352 KB |
Output is correct |
14 |
Correct |
0 ms |
55352 KB |
Output is correct |
15 |
Correct |
0 ms |
55352 KB |
Output is correct |
16 |
Correct |
4 ms |
55352 KB |
Output is correct |
17 |
Correct |
0 ms |
55352 KB |
Output is correct |
18 |
Correct |
0 ms |
55352 KB |
Output is correct |
19 |
Correct |
0 ms |
55352 KB |
Output is correct |
20 |
Correct |
0 ms |
55352 KB |
Output is correct |
21 |
Correct |
0 ms |
55352 KB |
Output is correct |
22 |
Correct |
2 ms |
55352 KB |
Output is correct |
23 |
Correct |
14 ms |
55352 KB |
Output is correct |
24 |
Correct |
16 ms |
55352 KB |
Output is correct |
25 |
Correct |
4 ms |
55352 KB |
Output is correct |
26 |
Correct |
4 ms |
55352 KB |
Output is correct |
27 |
Correct |
8 ms |
55352 KB |
Output is correct |
28 |
Correct |
10 ms |
55352 KB |
Output is correct |
29 |
Correct |
5 ms |
55352 KB |
Output is correct |
30 |
Correct |
6 ms |
55352 KB |
Output is correct |
31 |
Correct |
165 ms |
55352 KB |
Output is correct |
32 |
Correct |
208 ms |
55352 KB |
Output is correct |
33 |
Correct |
179 ms |
55352 KB |
Output is correct |
34 |
Correct |
170 ms |
55352 KB |
Output is correct |
35 |
Correct |
153 ms |
55352 KB |
Output is correct |
36 |
Correct |
248 ms |
55352 KB |
Output is correct |
37 |
Correct |
249 ms |
55352 KB |
Output is correct |
38 |
Correct |
220 ms |
55352 KB |
Output is correct |
39 |
Correct |
269 ms |
55352 KB |
Output is correct |
40 |
Correct |
167 ms |
55352 KB |
Output is correct |