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 "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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |