QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202781#5531. ICCCamillusCompile Error//C++201.6kb2023-10-06 13:24:362024-07-01 04:28:33

Judging History

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

  • [2024-07-01 04:28:33]
  • 管理员手动重测本题所有提交记录
  • [2023-10-06 13:24:37]
  • 评测
  • [2023-10-06 13:24:36]
  • 提交

answer

#include "bits/stdc++.h"
#include "icc.h"
using namespace std;

random_device rd;
mt19937 rnd(rd());

int rand(int n) {
    return rnd() % n;
}

int rand(int l, int r) {
    return l + rand(r - l + 1);
}

vector<int> low_half(vector<int> A) {
    int x = A.size() >> 1;
    return vector<int>(A.begin(), A.begin() + x);
}

vector<int> top_half(vector<int> A) {
    int x = A.size() >> 1;
    return vector<int>(A.begin() + x, A.end());
}

int query(vector<int> A, vector<int> B) {
    return query(A.size(), B.size(), A.data(), B.data());
}

void run(int n) {

    auto loop = [&]() {
        vector<int> a;
        vector<int> b;
        while (true) {
            a.clear();
            b.clear();

            vector<int> c(n);
            iota(c.begin(), c.end(), 1);
            a = low_half(c);
            b = top_half(c);

            if (query(a, b)) {
                break;
            }
        }

        int c1 = 0, c2 = 0;
        while (b.size() != 1) {
            if (query(a, low_half(b))) {
                b = low_half(b);
            } else {
                b = top_half(b);
            }
            c1++;
        }

        while (a.size() != 1) {
            if (query(low_half(a), b)) {
                a = low_half(a);
            } else {
                a = top_half(a);
            }
            c2++;
        }

        assert(max(c1, c2) <= 6);

        setRoad(a.front(), b.front());
        Q.join(a.front(), b.front());
    };

    for (int i = 0; i < n - 1; i++) {
        loop();
    }
}

#ifdef LOCAL
int main() {
    int n;
    cin >> n;
    run(n);
}
#endif

详细

answer.code: In lambda function:
answer.code:71:9: error: ‘Q’ was not declared in this scope
   71 |         Q.join(a.front(), b.front());
      |         ^