QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#546658#7276. A Light Inconveniencehztmax0Compile Error//C++14622b2024-09-04 11:16:552024-09-04 11:16:55

Judging History

你现在查看的是最新测评结果

  • [2024-09-04 11:16:55]
  • 评测
  • [2024-09-04 11:16:55]
  • 提交

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);
}

详细

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)
      |                        ^