| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1163659 | dpsaveslives | A Light Inconvenience (CEOI23_light) | C++20 | 0 ms | 0 KiB | 
#include <bits/stdc++.h>
#include "light.h"
#define ll long long
using namespace std;
void prepare(){
}
vector<ll> cur = {1};
ll N = 1; //at the beginning
pair<ll,vector<ll>> solve(ll p){
    N += p;
    if(p < 0) p *= (-1);
    vector<ll> lit = {N};
    ll x = N;
    while(x > 1){
        x -= min(x-1,N-x+2);
        int ind = upper_bound(cur.begin(),cur.end(),x)-cur.begin()-1;
        if(x - cur[ind] >= p+1) x = cur[ind+1];
        lit.insert(lit.begin(),x);
    }
    swap(lit,cur);
    return {p,cur}; //light the rightmost p torches and leave the current ones
}
pair<ll,vector<ll>> join(ll p){
    return solve(p);
}
pair<ll,vector<ll>> leave(ll p){
    return solve(-p);
}
int main()
{
    return 0;
}
