Submission #15803

# Submission time Handle Problem Language Result Execution time Memory
15803 2015-07-29T11:05:33 Z comet 빨간 직사각형 (kriii3_QQ) C++
0 / 20
0 ms 142740 KB
#include<iostream>
using namespace std;
int n,m,d[3333][3333],col[3333][3333],lev[3333][3333];
char a[3333][3333];
int main(){
	ios::sync_with_stdio(0);
	cin>>n>>m;
	for(int i=1;i<=n;i++)cin>>&a[i][1];

	for(int j=1;j<=m;j++)
		for(int i=1;i<=n;i++)
			col[i][j]=col[i-1][j]+(a[i][j]=='R');

	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			lev[i][j]=lev[i][j-1]+(a[i][j]=='R');

	int ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(a[i][j]!='R')continue;
			d[i][j]=d[i-1][j]+lev[i][j];
			ans+=d[i][j];
		}
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 142740 KB Output is correct
2 Incorrect 0 ms 142740 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -