Submission #14158

#TimeUsernameProblemLanguageResultExecution timeMemory
14158pichulia볼질 (OJUZ10_ballparade)C++98
100 / 100
7 ms1472 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...