Submission #13964

#TimeUsernameProblemLanguageResultExecution timeMemory
13964gs14004볼질 (OJUZ10_ballparade)C++14
100 / 100
7 ms1084 KiB
#include <cstdio> int a[4]; int ball_count, ret; void BALL(){ ball_count++; if(ball_count == 4){ ball_count = 0; if(a[1] && a[2] && a[3]){ ret++; } else if(a[1] && a[2]){ a[3] = 1; } else if(a[1]){ a[2] = 1; } a[1] = 1; } } int main(){ int n; scanf("%d",&n); while (n--) { int t; scanf("%d",&t); if(t == 1){ BALL(); } else if(t == 2){ ball_count = 0; if(a[1] && a[2] && a[3]){ ret++; } else if(a[1] && a[2]){ a[3] = 1; } else if(a[1]){ a[2] = 1; } a[1] = 1; } else{ if(a[3]) ret++; a[3] = a[2]; a[2] = a[1]; a[1] = 0; BALL(); } } printf("%d",ret); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...