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 p[4];
int main(){
int n;
scanf("%d",&n);
int ans = 0;
for(int i=0, x, now = 0;i<n;i++){
scanf("%d",&x);
if(x == 3)ans += p[3], p[3] = p[2], p[2] = p[1], p[1] = 0;
if(x == 1 || x == 3){
now++;
}
if(x == 2 || now == 4){
ans += (p[3]&p[2]&p[1]);
p[3] |= (p[1]&p[2]);
p[2] |= p[1];
p[1] = 1, now = 0;
}
}
printf("%d",ans);
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... |