#include "light.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
int cnt;
vector<long long>v;
void prepare(){
cnt = 1;
v.push_back(1);
}
std::pair<long long, std::vector<long long>> join(long long p){
cnt+=p;
vector<long long> vv;
vv.push_back(1);
for(auto &it:v)
it+=p;
for(long long i=1;1;) {
long long res=1;
for(auto it:v) {
if((2ll*i+p)>=it)
res=max(res,min(it,2ll*i));
}
if(res>=cnt) {
vv.push_back(cnt);
break;
}
else
vv.push_back(res);
i=res;
}
v=vv;
vector<long long>ans;
for(auto it:v)
ans.push_back(cnt-it+1);
sort(ans.begin(),ans.end());
return {p,v};
}
std::pair<long long, std::vector<long long>> leave(long long p){
cnt-=p;
vector<long long> vv,vvv;
vvv=v;
v.clear();
for(auto it:vvv) {
if(it-p>0)
v.push_back(it-p);
}
vv.push_back(1);
for(long long i=1;1;) {
long long res=1;
for(auto it:v) {
if((2ll*i+p)>=it)
res=max(res,min(it,2ll*i));
}
if(res>=cnt) {
vv.push_back(cnt);
break;
}
vv.push_back(res);
i=res;
}
v=vv;
vector<long long>ans;
if(cnt==1)
v.clear(),v.push_back(1);
for(auto it:v)
ans.push_back(cnt-it+1);
sort(ans.begin(),ans.end());
return {p,v};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 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 |
1 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 |
1 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 |
1 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 |
1 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 |
1 ms |
344 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |