Submission #28490

#TimeUsernameProblemLanguageResultExecution timeMemory
28490일단아무거나적어놓은팀이름 (#68)Bulb Game (FXCUP2_bulb)C++14
0 / 1
0 ms1128 KiB
#include "bulb.h" int n; bool b[1001], used[1010]; void Init(int N) { n = N; for(int i = 1; i <= n; ++i) b[i] = 0; for(int i = 1; i <= n + 1; ++i) used[i] = 0; } int MakeTurn(int M) { used[M] = 1; int cnt = 0, mx = -1, sel = -1; for(int i = 1; i <= n; ++i) cnt++; for(int i = 1; i <= n + 1; ++i) { if(used[i]) continue; int l = i < M ? i : M; int r = i > M ? i : M; int loc = cnt; for(int j = l; j < r; ++j) { if(b[j]) loc--; else loc++; } if(mx < loc) mx = loc, sel = i; } int l = sel < M ? sel : M; int r = sel > M ? sel : M; for(int i = l; i < r; ++i) b[i] = 1 - b[i]; used[sel] = 1; return sel; }
#Verdict Execution timeMemoryGrader output
Fetching results...