This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
int cnt;
int n;
int a[100000];
int b[9];
int res;
void go()
{
b[0]++;
if(b[0]==2)
{
b[0]=1;
b[1]++;
if(b[1]==2)
{
b[1]=1;
b[2]++;
if(b[2]==2)
{
b[2]=1;
res++;
}
}
}
}
int main()
{
int i, j, k;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
res=0;
for(i=0;i<n;i++)
{
if(a[i]&1)cnt++;
if(a[i]==3){
res += b[2];
b[2]=b[1];
b[1]=b[0];
b[0]=0;
}
if(a[i]==2 || cnt==4)
{
cnt=0;
go();
}
}
printf("%d\n",res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |