QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#546663 | #7276. A Light Inconvenience | hztmax0 | Compile Error | / | / | C++14 | 637b | 2024-09-04 11:19:03 | 2024-09-04 11:19:03 |
Judging History
answer
#include <algorithm>
#include <vector>
#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);
}
詳細信息
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) | ^