Submission #14177

#TimeUsernameProblemLanguageResultExecution timeMemory
14177kdh9949볼질 (OJUZ10_ballparade)C++98
22 / 100
6 ms1084 KiB
#include<stdio.h> int t,n,i,j,s,c,ans,a[4]; void f1() { if(a[3]&&a[2]&&a[1])a[3]--,ans++; if(a[2]&&a[1])a[2]--,a[3]++; if(a[1])a[2]++,a[1]--;a[1]++; } void f2() { if(a[3])ans++; if(a[2])a[2]--,a[3]++; if(a[1])a[1]--,a[2]++; } int main() { scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&t); if(t==1) { if(c==3) { f1(); c=0; } else c++; } else if(t==2) { f1(); c=0; } else if(t==3) { f2(); if(c==3) { a[1]++; c=0; } else c++; } } printf("%d",ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...