제출 #1073155

#제출 시각아이디문제언어결과실행 시간메모리
1073155NeroZeinA Light Inconvenience (CEOI23_light)C++17
0 / 100
0 ms512 KiB
#include "light.h" #include <bits/stdc++.h> using namespace std; long long tot; vector<long long> vec; void prepare(){ tot = 1; vec.push_back(1); } pair<long long, vector<long long>> join(long long p){ tot += p; for (int i = 0; i < (int) vec.size(); ++i) { vec[i] += p; } vector<long long> new_vec; for (long long x = 1; x <= tot; ) { new_vec.push_back(x); if (x == tot) { break; } auto next_one = upper_bound(vec.begin(), vec.end(), 2 * x) - vec.begin(); if (next_one != (int) vec.size() && vec[next_one] - p <= x * 2) { x = x * 2; } else { x = vec[next_one - 1]; } } vec = new_vec; return {p, vec}; } pair<long long, vector<long long>> leave(long long p){ tot -= p; for (int i = 0; i < (int) vec.size(); ++i) { vec[i] -= p; } vector<long long> new_vec; for (long long x = 1; x <= tot; ) { new_vec.push_back(x); if (x == tot) { break; } auto next_one = upper_bound(vec.begin(), vec.end(), 2 * x) - vec.begin(); if (next_one != (int) vec.size() && vec[next_one] - p <= x * 2) { x = x * 2; } else { x = vec[next_one - 1]; } } vec = new_vec; return {p, vec}; }
#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...