130482025-01-05 12:04:24ercseferencTáblajátékcpp17Runtime error 0/50131ms4408 KiB
#include <iostream>
using namespace std;
bool a[502];
void plusz(){
    int k=0;
    while(a[k]==1){k++;}
    for(int i=0; i<=k; i++){a[i]=!a[i];}}
void minusz(){
    int k=0;
    while(a[k]==0){k++;}
    for(int i=0; i<=k; i++){a[i]=!a[i];}}
void ketto(){
    int k=502;
    while(a[k]==0){k--;}
    for(int i=k; i>=0; i--){a[i+1]=a[i];}
    a[0]=0;}
void fel(){
    int k=502;
    while(a[k]==0){k--;}
    for(int i=0; i<=k-1; i++){a[i]=a[i+1];}
    a[k]=0;}
void kiir(){
    int k=502;
    while(a[k]==0){k--;}
    for(int i=k; i>=0; i--){cout<<a[i];}
    cout<<" ";}
int main()
{
    int n,x,sor=0; cin>>n;
    for(int i=0; i<n; i++){
        cin>>x;
        if(x==0){sor++; ketto();}
        if(x==1){sor++; ketto(); plusz();}
        if(x==2){sor--; fel();}
        if(x==3){minusz();}
        if(x==4){plusz();}}
    cout<<sor<<endl;
    kiir();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/01ms512 KiB
2Runtime error0/01ms508 KiB
3Runtime error0/3131ms4152 KiB
4Runtime error0/31ms320 KiB
5Runtime error0/31ms500 KiB
6Runtime error0/31ms320 KiB
7Runtime error0/31ms320 KiB
8Runtime error0/31ms320 KiB
9Runtime error0/3131ms4408 KiB
10Runtime error0/31ms508 KiB
11Runtime error0/31ms320 KiB
12Runtime error0/31ms320 KiB
13Runtime error0/41ms320 KiB
14Runtime error0/41ms320 KiB
15Runtime error0/41ms320 KiB
16Runtime error0/41ms320 KiB
17Runtime error0/4131ms4152 KiB