#include "light.h"
#include <bits/stdc++.h>
using namespace std;
const int LOG = 63;
int cnt;
long long sz;
vector<long long> indices;
void prepare(){
cnt = 0;
sz = 1;
indices.push_back(1);
}
int msb(long long x) {
for (int i = LOG - 1; i >= 0; --i) {
if (x >> i & 1) {
return i;
}
}
assert(false);
}
pair<long long, vector<long long>> join(long long p){
cnt++;
sz += p;
vector<long long> nindices = {sz};
for (long long b = 1; b < sz - 1; b *= 2) {
nindices.push_back(sz - b);
}
nindices.push_back(1);
reverse(nindices.begin(), nindices.end());
indices = nindices;
return {p, indices};
}
pair<long long, vector<long long>> leave(long long p){// I just need to make sure after one leave I'm able to keep the rightmost lit
cnt++;
while (indices.back() > sz - p) {
indices.pop_back();
}
sz -= p;
if (indices.back() != sz) {
indices.push_back(sz);
}
return {p, indices};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
312 ms |
432 KB |
Correct |
3 |
Correct |
321 ms |
344 KB |
Correct |
4 |
Correct |
271 ms |
344 KB |
Correct |
5 |
Correct |
281 ms |
432 KB |
Correct |
6 |
Correct |
252 ms |
344 KB |
Correct |
7 |
Correct |
306 ms |
416 KB |
Correct |
8 |
Incorrect |
138 ms |
416 KB |
Not correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
344 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
344 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
344 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
344 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
344 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
288 ms |
436 KB |
Correct |
3 |
Correct |
289 ms |
344 KB |
Correct |
4 |
Correct |
285 ms |
344 KB |
Correct |
5 |
Correct |
301 ms |
416 KB |
Correct |
6 |
Correct |
315 ms |
416 KB |
Correct |
7 |
Correct |
295 ms |
592 KB |
Correct |
8 |
Incorrect |
143 ms |
592 KB |
Not correct |
9 |
Halted |
0 ms |
0 KB |
- |