# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28490 | 일단아무거나적어놓은팀이름 (#68) | Bulb Game (FXCUP2_bulb) | C++14 | 0 ms | 1128 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |