Submission #28451

#TimeUsernameProblemLanguageResultExecution timeMemory
28451ㅁㄴㅇㄹ (#68)Bulb Game (FXCUP2_bulb)C++98
0 / 1
0 ms2036 KiB
#include "bulb.h" #include <bits/stdc++.h> using namespace std; int n; int a[1005]; void Init(int N) { n=N; for(int i=1;i<=n;i++) a[i]=0; } int MakeTurn(int M) { a[M]=1; int l=-999999,r=-999999; for(int i=M+1;i<=n;i++){ if(!a[i]){ r=i; break; } } for(int i=M-1;i;i--){ if(!a[i]){ l=i; break; } } if(l==-999999) return r; if(r==-999999) return l; int res=(r-M>M-l?l:r); a[res]=1; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...