Submission #15807

# Submission time Handle Problem Language Result Execution time Memory
15807 2015-07-29T11:34:35 Z comet 빨간 직사각형 (kriii3_QQ) C++
Compilation error
0 ms 0 KB
#include<iostream>
#include<cstring>
using namespace std;
int n,m,col[3333][3333],st[3333],index[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++)
			if(a[i][j]=='R')col[i][j]=col[i-1][j]+(a[i][j]=='R');

	int ans=0;
	for(int i=1;i<=n;i++){
		int sz=0;
		st[sz]=0;
		index[sz++]=0;
		for(int j=1;j<=m+1;j++){
			//for(int k=0;k<sz;k++)cout<<st[k]<<" ";
			////cout<<endl;
			//for(int k=0;k<sz;k++)cout<<index[k]<<" ";
			while(sz>1&&st[sz-1]>=col[i][j]){
				//cout<<"wow  "<<j<<" "<<index[sz-2]<<" "<<st[sz-1]<<endl;
				ans+=(j-index[sz-2]-1)*st[sz-1];
				sz--;
			}
			//cout<<endl<<"ans= "<<ans<<endl<<endl;
			st[sz]=col[i][j];
			index[sz++]=j;
		}
	}
	cout<<ans;
}

Compilation message

qq.cpp:4:44: error: ‘int index [3333]’ redeclared as different kind of symbol
 int n,m,col[3333][3333],st[3333],index[3333];
                                            ^
In file included from /usr/include/c++/4.9/cstring:42:0,
                 from qq.cpp:2:
/usr/include/string.h:482:1: note: previous declaration ‘const char* index(const char*, int)’
 index (const char *__s, int __c) __THROW
 ^
qq.cpp: In function ‘int main()’:
qq.cpp:19:13: error: invalid types ‘<unresolved overloaded function type>[int]’ for array subscript
   index[sz++]=0;
             ^
qq.cpp:26:23: error: invalid types ‘<unresolved overloaded function type>[int]’ for array subscript
     ans+=(j-index[sz-2]-1)*st[sz-1];
                       ^
qq.cpp:31:14: error: invalid types ‘<unresolved overloaded function type>[int]’ for array subscript
    index[sz++]=j;
              ^