Submission #1234198

#TimeUsernameProblemLanguageResultExecution timeMemory
1234198franuchA Light Inconvenience (CEOI23_light)C++20
100 / 100
253 ms420 KiB
#include <bits/stdc++.h> #include "light.h" using namespace std; typedef long long ll; typedef __int128 xl; #define vc vector #define st first #define nd second #define pll pair<ll, ll> #define pxl pair<xl, xl> #define sz(a) (ll)a.size() #define all(a) a.begin(), a.end() #define pub push_back #define pob pop_back xl L = 61; xl A, B; vc<xl> getpos() { vc<pxl> p; for (xl i = 0; i < L; i++) { xl a = xl(1) << i; xl y = B / a * a; xl x = y + 2 * a - 2; p.pub({x, y}); } vc<xl> 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<xl> pos = getpos(); vc<ll> ret; for (xl 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...