QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#546658 | #7276. A Light Inconvenience | hztmax0 | Compile Error | / | / | C++14 | 622b | 2024-09-04 11:16:55 | 2024-09-04 11:16:55 |
Judging History
answer
#include <bits/stdc++.h>
#include "light.h"
using namespace std;
using LL = long long;
LL N = 1;
vector<LL> act = {1};
void prepare () {}
pair<LL, vector<LL>> solve (LL p) {
vector<LL> ret = {N};
LL x = N;
while (x > 1) {
x -= min(x - 1, N - x + 2);
int i = upper_bound(act.begin(), act.end(), x) - act.begin() - 1;
if (x - act[i] > p)
x = act[i + 1];
ret.insert(ret.begin(), x);
}
swap(ret, act);
return {p, act};
}
pair<LL, vector<LL>> join (LL p) {
N += p;
return solve(p);
}
pair<LL, vector<LL>> leave (LL p) {
N -= p;
return solve(p);
}
Details
implementer.cpp:17:22: error: ‘optional’ does not name a type 17 | template<typename T> optional<T> read() { | ^~~~~~~~ implementer.cpp: In function ‘int main()’: implementer.cpp:36:17: error: ‘optional’ was not declared in this scope 36 | optional<long long> d = read<long long>(); | ^~~~~~~~ implementer.cpp:36:17: note: ‘std::optional’ is only available from C++17 onwards implementer.cpp:36:26: error: expected primary-expression before ‘long’ 36 | optional<long long> d = read<long long>(); | ^~~~ implementer.cpp:37:24: error: ‘d’ was not declared in this scope 37 | if(not d or *d == 0) | ^