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 sc,base[3];
void mv()
{
if (base[2] && base[1] && base[0]){
sc++;
}
else if (base[1] && base[0]){
base[2] = 1;
}
else if (base[0]){
base[1] = 1;
}
base[0] = 1;
}
int main()
{
int N,bc=0; scanf ("%d",&N);
while (N--){
int x; scanf ("%d",&x);
if (x == 2){
bc = 0;
mv();
}
else{
if (x == 3){
if (base[2]) sc++;
for (int i=2;i>=1;i--) base[i] = base[i-1];
base[0] = 0;
}
if (++bc == 4){
bc = 0;
mv();
}
}
}
printf ("%d\n",sc);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |