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