Блог пользователя a_shayaan

Автор a_shayaan, история, 9 лет назад, По-английски

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.com/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;
	}
	

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится