QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#495226#9156. 百万富翁ActuctCompile Error//C++141.5kb2024-07-27 19:35:202024-07-27 19:35:20

Judging History

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

  • [2024-07-27 19:35:20]
  • 评测
  • [2024-07-27 19:35:20]
  • 提交

answer

int richest(int n, int t, int s) {
    std::vector<int> v;
    for (int i = 0; i < n; ++i)
        v.emplace_back(i);
    if (t == 20) {
        while (v.size() > 400) {
            std::vector<int> a, b;
            for (int j = 1; j < v.size(); j += 2)
                a.emplace_back(v[j - 1]), b.emplace_back(v[j]);
            int t;
            if (v.size() & 1) t = v.back();
            else t = -1;
            v = ask(a, b);
            if (~t) v.emplace_back(t);
        }
        if (v.size() == 1)
            return v[0];
        else {
            std::vector<int> a, b;
            for (int i = 0; i < v.size(); ++i)
                for (int j = i + 1; j < v.size(); ++j)
                    a.emplace_back(v[i]), b.emplace_back(v[j]);
            std::vector<int> c = ask(a, b);
            for (int i = 0; i < 2000100; ++i)
                box[i] = 0;
            for (auto &val : c)
                ++box[val];
            for (int i = 0; i < v.size(); ++i)
                if (box[v[i]] >= v.size() - 1) return v[i];
            return -1;
        }
    } else {
        std::vector<int> a, b;
        for (int i = 0; i < n; ++i)
            for (int j = i + 1; j < n; ++j)
                a.emplace_back(i), b.emplace_back(j);
        std::vector<int> c = ask(a, b);
        for (int i = 0; i < 200100; ++i)
            box[i] = 0;
        for (auto &val : c)
            ++box[val];
        for (int i = 0; i < n; ++i)
            if (box[i] >= n - 1) return i;
        return -1;
    }
}

詳細信息

answer.code: In function ‘int richest(int, int, int)’:
answer.code:2:10: error: ‘vector’ is not a member of ‘std’
    2 |     std::vector<int> v;
      |          ^~~~~~
answer.code:1:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
  +++ |+#include <vector>
    1 | int richest(int n, int t, int s) {
answer.code:2:17: error: expected primary-expression before ‘int’
    2 |     std::vector<int> v;
      |                 ^~~
answer.code:4:9: error: ‘v’ was not declared in this scope
    4 |         v.emplace_back(i);
      |         ^
answer.code:6:16: error: ‘v’ was not declared in this scope
    6 |         while (v.size() > 400) {
      |                ^
answer.code:7:18: error: ‘vector’ is not a member of ‘std’
    7 |             std::vector<int> a, b;
      |                  ^~~~~~
answer.code:7:18: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
answer.code:7:25: error: expected primary-expression before ‘int’
    7 |             std::vector<int> a, b;
      |                         ^~~
answer.code:9:17: error: ‘a’ was not declared in this scope
    9 |                 a.emplace_back(v[j - 1]), b.emplace_back(v[j]);
      |                 ^
answer.code:9:43: error: ‘b’ was not declared in this scope
    9 |                 a.emplace_back(v[j - 1]), b.emplace_back(v[j]);
      |                                           ^
answer.code:13:21: error: ‘a’ was not declared in this scope
   13 |             v = ask(a, b);
      |                     ^
answer.code:13:24: error: ‘b’ was not declared in this scope
   13 |             v = ask(a, b);
      |                        ^
answer.code:13:17: error: ‘ask’ was not declared in this scope
   13 |             v = ask(a, b);
      |                 ^~~
answer.code:16:13: error: ‘v’ was not declared in this scope
   16 |         if (v.size() == 1)
      |             ^
answer.code:19:18: error: ‘vector’ is not a member of ‘std’
   19 |             std::vector<int> a, b;
      |                  ^~~~~~
answer.code:19:18: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
answer.code:19:25: error: expected primary-expression before ‘int’
   19 |             std::vector<int> a, b;
      |                         ^~~
answer.code:22:21: error: ‘a’ was not declared in this scope
   22 |                     a.emplace_back(v[i]), b.emplace_back(v[j]);
      |                     ^
answer.code:22:43: error: ‘b’ was not declared in this scope
   22 |                     a.emplace_back(v[i]), b.emplace_back(v[j]);
      |                                           ^
answer.code:23:18: error: ‘vector’ is not a member of ‘std’
   23 |             std::vector<int> c = ask(a, b);
      |                  ^~~~~~
answer.code:23:18: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
answer.code:23:25: error: expected primary-expression before ‘int’
   23 |             std::vector<int> c = ask(a, b);
      |                         ^~~
answer.code:25:17: error: ‘box’ was not declared in this scope
   25 |                 box[i] = 0;
      |                 ^~~
answer.code:26:30: error: ‘c’ was not declared in this scope
   26 |             for (auto &val : c)
      |                              ^
answer.code:27:19: error: ‘box’ was not declared in this scope
   27 |                 ++box[val];
      |                   ^~~
answer.code:29:21: error: ‘box’ was not declared in this scope
   29 |                 if (box[v[i]] >= v.size() - 1) return v[i];
      |                     ^~~
answer.code:33:14: error: ‘vector’ is not a member of ‘std’
   33 |         std::vector<int> a, b;
      |              ^~~~~~
answer.code:33:14: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
answer.code:33:21: error: expected primary-expression before ‘int’
   33 |         std::vector<int> a, b;
      |                     ^~~
answer.code:36:17: error: ‘a’ was not declared in this scope
   36 |                 a.emplace_back(i), b.emplace_back(j);
      |                 ^
answer.code:36:36: error: ‘b’ was not declared in this scope
   36 |                 a.emplace_back(i), b.emplace_back(j);
      |                                    ^
answer.code:37:14: error: ‘vector’ is not a member of ‘std’
   37 |         std::vector<int> c = ask(a, b);
      |              ^~~~~~
answer.code:37:14: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
answer.code:37:21: error: expected primary-expression before ‘int’
   37 |         std::vector<int> c = ask(a, b);
      |                     ^~~
answer.code:39:13: error: ‘box’ was not declared in this scope
   39 |             box[i] = 0;
      |             ^~~
answer.code:40:26: error: ‘c’ was not declared in this scope
   40 |         for (auto &val : c)
      |                          ^
answer.code...