Submission #1063121

#TimeUsernameProblemLanguageResultExecution timeMemory
1063121beaconmcA Light Inconvenience (CEOI23_light)C++17
0 / 100
1 ms428 KiB
#include "light.h" #include <bits/stdc++.h> typedef long long ll; #define FOR(i,x,y) for(ll i=x; i<y; i++) #define FORNEG(i,x,y) for(ll i=x; i>y; i--) using namespace std; ll n, maxi; vector<ll> prevs; void prepare(){ n = 1; maxi = n; } pair<long long, std::vector<long long>> join(long long p){ n += p; set<ll> stuff; stuff.insert(1); maxi = max(maxi, n); if (n==maxi){ FOR(i,1,70){ stuff.insert(n-(1<<i)+2); } } else{ ll diff = maxi-n; FOR(i,1,70){ stuff.insert(maxi-(1<<i)+2); stuff.insert(maxi-(1<<i)+2 + diff); } } vector<ll> real; for (auto&i : stuff) if (1<=i && i<=n) real.push_back(i); prevs = real; return {p, real}; } std::pair<long long, std::vector<long long>> leave(long long p){ n -= p; set<ll> stuff; stuff.insert(1); stuff.insert(n); ll diff = maxi-n; FOR(i,1,70){ stuff.insert(maxi-(1<<i)+2); stuff.insert(maxi-(1<<i)+2 + diff); } FOR(i,1,70){ ll temp = n - (1<<i)+2; if (lower_bound(prevs.begin(), prevs.end(), temp) != lower_bound(prevs.begin(), prevs.end(), temp-p)){ stuff.insert(n - (1<<i)+2); } } vector<ll> real; for (auto&i : stuff) if (1<=i && i<=n) real.push_back(i); prevs = real; return {p, real}; }
#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...