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>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
ll ttt;
const ll INF=1e18;
const ll MOD=1e9+7;
const ll N=5007;
ll n,m,k;
vector<ll>d;
const ll MULT=1;
void prepare() {
d.push_back(1);
n=1;
}
void taza(ll add){
vector<ll>new_d;
new_d.push_back(1);
while(new_d.back()!=n){
ll vl=new_d.back()+(n-new_d.back())*MULT/(MULT+1);
if(n-new_d.back()==1)vl++;
auto it=upper_bound(d.begin(),d.end(),vl);
it--;
vl=min(vl,(*it)+add);
new_d.push_back(vl);
}
d=new_d;
}
pair<ll, vector<ll>> join(ll p) {
n+=p;
taza(MULT*p);
return {MULT*p,d};
}
pair<ll, vector<ll>> leave(ll p) {
n-=p;
taza(MULT*p);
return {MULT*p,d};
}
# | 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... |