이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |