#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<ll> f;
ll n;
void prepare(){
n =1;
f.resize(1, 1);
}
pair<long long, vector<long long>> join(long long p){
n+=p;
vector<ll> sol = {n};
ll temp = n;
while(temp>1){
temp -= min(temp-1, n-temp+2);
ll i = lower_bound(f.begin(), f.end(), temp)-f.begin()-1;
if(temp-i>p){
temp = f[i+1];
}
sol.insert(sol.begin(), temp);
}
swap(sol, f);
return {p, f};
}
pair<long long, vector<long long>> leave(long long p){
n-=p;
vector<ll> sol = {n};
ll temp = n;
while(temp>1){
temp -= min(temp-1, n-temp+2);
ll i = lower_bound(f.begin(), f.end(), temp)-f.begin()-1;
if(temp-i>p){
temp = f[i+1];
}
sol.insert(sol.begin(), temp);
}
swap(sol, f);
return {p, f};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
424 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Incorrect |
1 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 |
1 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 |
1 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 |
1 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 |
1 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 |
1 ms |
344 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |