Submission #14281

#TimeUsernameProblemLanguageResultExecution timeMemory
14281jang718볼질 (OJUZ10_ballparade)C++98
22 / 100
7 ms1084 KiB
#include<stdio.h> int main() { int i,j,n,score=0,k,a[5]={0,},b=0; scanf("%d",&n); for(j=0;j<n;j++){ scanf("%d",&k); if(k==1)b++; else if(k==2){ b=0; a[0]=1; for(i=3;i>=1;i--){if(a[i-1]==1&&a[i]==1){a[i+1]=1;a[i]=0;}else if(a[i-1]==1){a[i]=1;a[i-1]=0;}} a[1]=1; a[0]=0; } else{ b++; for(i=3;i>=1;i--){if(a[i]==1){a[i+1]=1;a[i]=0;}else if(a[i-1]==1){a[i]=1;a[i-1]=0;}} } if(b==4){ b=0; a[0]=1; for(i=3;i>=1;i--)if(a[i-1]==1&&a[i]==1){a[i+1]=1;a[i]=0;} a[1]=1; a[0]=0; } if(a[4]==1){ score++; a[4]=0; } } printf("%d",score); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...