Submission #1234172

#TimeUsernameProblemLanguageResultExecution timeMemory
1234172franuchA Light Inconvenience (CEOI23_light)C++20
40 / 100
195 ms408 KiB
#include <bits/stdc++.h> #include "light.h" using namespace std; typedef long long ll; #define vc vector #define st first #define nd second #define pll pair<ll, ll> #define sz(a) (ll)a.size() #define all(a) a.begin(), a.end() #define pub push_back #define pob pop_back ll N = 1e18, L = 61; ll A, B; vc<ll> getpos() { vc<pll> p; for (ll i = 0; i < L; i++) { ll a = 1ll << i; ll y = B / a * a; ll x = y + 2 * a - 2; p.pub({x, y}); } vc<ll> ret; for (auto &[x, y] : p) { if (x >= B) ret.pub(x); if (x - (B - y) >= B) ret.pub(x - (B - y)); } sort(all(ret)); ret.erase(unique(all(ret)), ret.end()); return ret; } void prepare() { A = 1, B = 0; } vc<ll> query() { vc<ll> pos = getpos(); vc<ll> ret; for (ll x : pos) { if (A - x < 1) break; ret.pub(A - x); } if (ret.back() != 1) ret.pub(1); reverse(all(ret)); return ret; } pair<ll, vc<ll>> join(ll p) { A += p; return {p, query()}; } pair<ll, vc<ll>> leave(ll p) { B += p; return {p, query()}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...