#include "light.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N;
vector <ll> fire;
void prepare(){
N = 1;
fire.push_back(1);
}
pair<ll,vector<ll>> join(ll p){
N += p;
vector <ll> next;
next.push_back(N);
ll last = fire.back();
while (next.back() != 1) {
ll x = max(1LL, N - (N - next.back() + 1) * 2);
while (fire.back() > x) {
last = fire.back();
fire.pop_back();
}
if (x <= fire.back() + p) {
next.push_back(x);
}
else {
next.push_back(last);
}
}
reverse(next.begin(),next.end());
fire = next;
return {p,fire};
}
pair<ll,vector<ll>> leave(ll p){
return join(-p);
}
| # | 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... |