Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

test case issue

Правка en2, от 1_coder, 2016-09-24 21:11:09

this is the contest http://codeforces.com/contest/719 question no 2 can anyone ell me why i m failing 5th test case because i cant see that due to its large input plz help me guys thnxx....

include

using namespace std;

int main() { char a[100000],temp; int n,c=0; cin>>n; for(int i=0;i<n;i++){ cin>>a[i];

} for(int i=1;i<n-1;i++){ if(a[i-1]==a[i]){ if(a[i+1]!=a[i]){ if(i+1<n){ temp=a[i]; a[i]=a[i+1]; a[i+1]=temp; c++; } else{ if(a[i-1]=='r'){ a[i]='b'; c++;

}
        else{
            c++;
            a[i]='r';
        }
        }
    }
    else{
        if(a[i-1]=='r'){
            a[i]='b';
        c++;

        }
        else{
            c++;
            a[i]='r';
        }

    }
}

} cout<<c; return 0;

}

Теги #c++, all problems, #algorithms

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский 1_coder 2016-09-24 21:16:01 1 Tiny change: 'an anyone ell me why' -> 'an anyone tell me why'
en3 Английский 1_coder 2016-09-24 21:14:39 882
en2 Английский 1_coder 2016-09-24 21:11:09 882
en1 Английский 1_coder 2016-09-24 21:08:56 206 Initial revision (published)