Getting Runtime error during submission C++

Правка en3, от a_shayaan, 2015-11-01 13:52:01

I am getting below run time for test case 21 error in Codeforces, it works perfectly for all the test cases before it and 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/problemset/problem/330/A[submission:14005523]

#include<iostream>
#include<algorithm>
#include<string>

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;
	}
	

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский a_shayaan 2015-11-01 13:52:01 146
en2 Английский a_shayaan 2015-11-01 13:50:38 93
en1 Английский a_shayaan 2015-11-01 13:48:08 1246 Initial revision (published)