제출 #16840

#제출 시각아이디문제언어결과실행 시간메모리
16840sinceww77볼질 (OJUZ10_ballparade)C++98
22 / 100
8 ms1276 KiB
#include <stdio.h>
int data[50010],c[5];
int main()
{
    int i,j,n,m,b=0,tot=0;
    scanf("%d\n",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d ",&m);
        if(m==1) b++;
        if(b==4)
        {
            if(c[3]==1)
            {
                c[3]=0;
                tot+=1;
            }
            if(c[2]==1)
            {
                c[2]=0;
                c[3]=1;
            }
            if(c[1]==1)
            {
                c[2]=1;
            }
            b=0;
        }
        if(m==2)
        {
            if(c[3]==1)
            {
                c[3]=0;
                tot+=1;
            }
            if(c[2]==1)
            {
                c[2]=0;
                c[3]=1;
            }
            if(c[1]==1)
            {
                c[2]=1;
            }
            c[1]=1;
            b=0;
        }
        if(m==3)
        {
            if(c[3]==1)
            {
                c[3]=0;
                tot+=1;
            }
            if(c[2]==1)
            {
                c[2]=0;
                c[3]=1;
            }
            if(c[1]==1)
            {
                c[1]=0;
                c[2]=1;
            }
            b=0;
        }
    }
    printf("%d",tot);
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...