#include "light.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> cur;
void prepare() {
cur = {1};
}
pair<ll, vector<ll>> join(ll p) {
ll cz = cur.back() + p;
vector<ll> newcur;
newcur.push_back(1);
ll sm = 0;
for (ll i = 1; sm < cz; i++) {
newcur.push_back(cz-sm);
sm += i;
}
sort(newcur.begin(), newcur.end());
newcur.resize(unique(newcur.begin(), newcur.end()) - newcur.begin());
ll t = 0;
for (ll i : newcur) {
t = max(t, i - *(upper_bound(cur.begin(), cur.end(), i) - 1));
}
cur = newcur;
return make_pair(t, cur);
}
pair<ll, vector<ll>> leave(ll p){
ll cz = cur.back() - p;
vector<ll> newcur;
newcur.push_back(1);
ll sm = 0;
for (ll i = 1; sm < cz; i++) {
newcur.push_back(cz-sm);
sm += i;
}
sort(newcur.begin(), newcur.end());
newcur.resize(unique(newcur.begin(), newcur.end()) - newcur.begin());
ll t = 0;
for (ll i : newcur) {
t = max(t, i - *(upper_bound(cur.begin(), cur.end(), i) - 1));
}
cur = newcur;
return make_pair(t, cur);
}
# | 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... |