Getting Runtime error during submission C++

Revision en2, by a_shayaan, 2015-11-01 13:50:38

I am getting below run time error in Codeforces, though code works as expected in my local compiler. Time: 0 ms, memory: 0 KB Verdict: RUNTIME_ERROR

I submitted my code for http://codeforces.me/contest/317/problem/A

Code is below.

include

include

include

using namespace std;

int main(){ int n,m; cin>>n>>m; char array[n][m]; int i,j; char read; for(i=0;i<n;i+=1){ for(j=0;j<m;j+=1){ cin>>read; array[i][j]=read; } } int count=0; int tc=0; for(i=0;i<n;i+=1){ tc=0; for(j=0;j<m;j+=1){ if(array[i][j] == 'S'){ tc=0; break; } else tc+=1; } if(tc == 0) continue; else{ for(j=0;j<m;j+=1){ array[i][j]='E'; } count+=tc; } } for(i=0;i<m;i+=1){ tc=0; for(j=0;j<n;j+=1){ if(array[j][i] == 'S'){ tc=0; break; } else if(array[j][i] == 'E'){ continue; } else tc+=1; } if(tc == 0) continue; else{ for(j=0;j<m;j+=1){ array[j][i]='E'; } count+=tc; } } cout<<count<<endl; return 0; }

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English a_shayaan 2015-11-01 13:52:01 146
en2 English a_shayaan 2015-11-01 13:50:38 93
en1 English a_shayaan 2015-11-01 13:48:08 1246 Initial revision (published)