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 <bits/stdc++.h>
#define pb push_back
#define int long long
#define ep insert
using namespace std;
set<int> s;
int n;
void prepare(){
n=1;
s.ep(1);
}
std::pair<long long, std::vector<long long>> join(long long x){
n+=x;
set<int> z;
for (auto u:s) z.ep(u+x);
s.clear();
s.ep(1);
for (int i=1;i<=n;){
int j=n+1;
auto it=z.upper_bound(i);
if (it!=z.end() && *it<=2*i) j=*it;
it=z.upper_bound(2*i);
if (it!=z.end() && *it<=2*i+x) j=2*i;
if (j!=n+1)s.ep(j);
i=j;
}
vector<int> v;
for (auto u:s) v.pb(n-u+1);
sort(v.begin(),v.end());
return {x,v};
}
std::pair<long long, std::vector<long long>> leave(long long x){
n-=x;
set<int> z;
for (auto u:s) if (u-x>0) z.ep(u-x);
s.clear();
s.ep(1);
for (int i=1;i<=n;){
int j=n+1;
auto it=z.upper_bound(i);
if (it!=z.end() && *it<=2*i) j=*it;
it=z.upper_bound(2*i);
if (it!=z.end() && *it<=2*i+x) j=2*i;
if (j!=n+1)s.ep(j);
i=j;
}
vector<int> v;
for (auto u:s) v.pb(n-u+1);
sort(v.begin(),v.end());
return {x,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... |