Submission #1061944

#TimeUsernameProblemLanguageResultExecution timeMemory
1061944MilosMilutinovicA Light Inconvenience (CEOI23_light)C++17
0 / 100
1 ms440 KiB
#include "light.h" #include <bits/stdc++.h> using namespace std; long long n; bool on[5005]; bool new_on[5005]; void prepare() { n = 1; on[1] = true; } pair<long long, vector<long long>> join(long long p) { n += p; int lst = -p; for (int i = 1; i <= n; i++) { if (on[i]) { lst = i; } new_on[i] = (i - lst < p); } for (int i = 1; i <= n; i++) { on[i] = new_on[i]; } vector<long long> ids(1, n); while (true) { int i = ids.back(); int idx = -1; int len = n - i + 1; for (int j = max(1, i - len - 1); j < i; j++) { if (on[j]) { idx = j; break; } } if (idx == -1) { break; } ids.push_back(idx); } ids.push_back(1); for (int i = 1; i <= n; i++) { on[i] = false; } for (int i : ids) { on[i] = true; } sort(ids.begin(), ids.end()); ids.erase(unique(ids.begin(), ids.end()), ids.end()); return {p, ids}; } pair<long long, vector<long long>> leave(long long p) { n -= p; int lst = -p; for (int i = 1; i <= n; i++) { if (on[i]) { lst = i; } new_on[i] = (i - lst < p); } for (int i = 1; i <= n; i++) { on[i] = new_on[i]; } vector<long long> ids(1, n); while (true) { int i = ids.back(); int idx = -1; int len = n - i + 1; for (int j = max(1, i - len - 1); j < i; j++) { if (on[j]) { idx = j; break; } } if (idx == -1) { break; } ids.push_back(idx); } ids.push_back(1); for (int i = 1; i <= n; i++) { on[i] = false; } for (int i : ids) { on[i] = true; } sort(ids.begin(), ids.end()); ids.erase(unique(ids.begin(), ids.end()), ids.end()); return {p, ids}; }
#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...