#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 |
1 |
Incorrect |
0 ms |
1128 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |