Submission #14107

#TimeUsernameProblemLanguageResultExecution timeMemory
14107ggoh볼질 (OJUZ10_ballparade)C++98
22 / 100
7 ms1084 KiB
#include<cstdio> #include<algorithm> #include<vector> #include<queue> #include<cstring> int p,x,s,i,j,b,a[4]; void f(int k) { if(k==4)s++; else { if(a[k])f(k+1); else a[k]=1; } } main() { scanf("%d",&p); for(i=0;i<p;i++) { scanf("%d",&x); if(x==1) { b++; if(b==4)f(1),b=0; } else if(x==2) { f(1),b=0; } else { for(j=3;j>=1;j--) { if(a[j]) { if(j==3)s++; else { a[j]=0; a[j+1]=1; } } } b++; if(b==4)f(1),b=0; } } printf("%d",s); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...