QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#210100 | #5531. ICC | Camillus | Compile Error | / | / | C++20 | 4.5kb | 2023-10-11 01:30:27 | 2024-07-01 04:28:35 |
Judging History
你现在查看的是最新测评结果
- [2024-07-01 04:28:35]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-10-11 01:30:27]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-10-11 01:30:27]
- 提交
answer
#include "bits/stdc++.h"
#include "icc.h"
using namespace std;
struct dsu {
vector<int> p;
vector<vector<int>> d;
dsu(int n) {
p.resize(n);
d.resize(n);
for (int i = 0; i < n; i++) {
p[i] = i;
d[i] = {i};
}
}
int get(int u) {
if (u == p[u]) {
return u;
} else {
return p[u] = get(p[u]);
}
}
void join(int u, int v) {
u = get(u);
v = get(v);
if (u == v) {
return;
}
if (d[v].size() > d[u].size()) {
swap(u, v);
}
p[v] = u;
d[u].insert(d[u].end(), d[v].begin(), d[v].end());
d[v].clear();
}
};
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(const vector<int> &A) {
size_t x = A.size() >> 1;
return vector<int>(A.begin(), A.begin() + x);
}
vector<int> top_half(const vector<int> &A) {
size_t x = A.size() >> 1;
return vector<int>(A.begin() + x, A.end());
}
//bool query(const vector<int> &A, const vector<int> &B) {
// cout << "? " << A.size();
// for (int x : A) {
// cout << " " << x;
// }
//
// cout << " " << B.size();
// for (int x : B) {
// cout << " " << x;
// }
//
// cout << endl;
//
// string res;
// cin >> res;
//
// if (res == "YES") {
// return true;
// } else {
// return false;
// }
//}
//void setRoad(int u, int v) {
// cout << "! " << u << " " << v << endl;
//}
void run(int n) {
dsu Q(n + 1);
auto loop = [&]() {
map<int, vector<int>> A;
for (int u = 1; u <= n; u++) {
A[Q.get(u)].push_back(u);
}
vector<vector<int>> B;
B.reserve(A.size());
for (const auto &[a, b] : A) {
B.push_back(b);
}
int m = (int)B.size();
auto get = [&](const vector<int> &p) -> vector<int> {
vector<int> Q;
for (int i : p) {
Q.insert(Q.end(), B[i].begin(), B[i].end());
}
return Q;
};
int x = 0;
vector<int> x0, x1;
for (int i = 0; i <= __lg(m); i++) {
vector<int> p0, p1;
for (int j = 0; j < m; j++) {
if (bitset<32>(j)[i] == 0) {
p0.push_back(j);
} else {
p1.push_back(j);
}
}
if (query(get(p0), get(p1))) {
x1.push_back(i);
x ^= 1 << i;
} else {
x0.push_back(i);
}
}
int u = 0;
for (int i : x0) {
vector<int> p0, p1;
for (int j = 0; j < m; j++) {
if (bitset<32>(j)[i] == 1 && bitset<32>(j)[x1.front()] == 0) {
p0.push_back(j);
}
if (bitset<32>(j)[i] == 1 && bitset<32>(j)[x1.front()] == 1) {
p1.push_back(j);
}
}
if (query(get(p0), get(p1))) {
u |= 1 << i;
}
}
for (int i : x1) {
if (i == x1.front()) {
continue;
}
vector<int> p0, p1;
for (int j = 0; j < m; j++) {
if (bitset<32>(j)[i] == 0 && bitset<32>(j)[x1.front()] == 0) {
p0.push_back(j);
}
if (bitset<32>(j)[i] == 1 && bitset<32>(j)[x1.front()] == 1) {
p1.push_back(j);
}
}
if (!query(get(p0), get(p1))) {
u ^= 1 << i;
}
}
int v = x ^ u;
auto a = get({u});
auto b = get({v});
while (b.size() != 1) {
if (query(a, low_half(b))) {
b = low_half(b);
} else {
b = top_half(b);
}
}
while (a.size() != 1) {
if (query(low_half(a), b)) {
a = low_half(a);
} else {
a = top_half(a);
}
}
setRoad(a.front(), b.front());
Q.join(a.front(), b.front());
};
for (int i = 0; i < n - 1; i++) {
loop();
}
}
//
//int main() {
// int n;
// cin >> n;
// run(n);
//}
详细
answer.code: In lambda function: answer.code:129:26: error: cannot convert ‘std::vector<int>’ to ‘int’ 129 | if (query(get(p0), get(p1))) { | ~~~^~~~ | | | std::vector<int> In file included from answer.code:2: icc.h:10:15: note: initializing argument 1 of ‘int query(int, int, int*, int*)’ 10 | int query(int a, int b, int *A, int *B); | ~~~~^ answer.code:149:26: error: cannot convert ‘std::vector<int>’ to ‘int’ 149 | if (query(get(p0), get(p1))) { | ~~~^~~~ | | | std::vector<int> icc.h:10:15: note: initializing argument 1 of ‘int query(int, int, int*, int*)’ 10 | int query(int a, int b, int *A, int *B); | ~~~~^ answer.code:167:27: error: cannot convert ‘std::vector<int>’ to ‘int’ 167 | if (!query(get(p0), get(p1))) { | ~~~^~~~ | | | std::vector<int> icc.h:10:15: note: initializing argument 1 of ‘int query(int, int, int*, int*)’ 10 | int query(int a, int b, int *A, int *B); | ~~~~^ answer.code:178:23: error: cannot convert ‘std::vector<int>’ to ‘int’ 178 | if (query(a, low_half(b))) { | ^ | | | std::vector<int> icc.h:10:15: note: initializing argument 1 of ‘int query(int, int, int*, int*)’ 10 | int query(int a, int b, int *A, int *B); | ~~~~^ answer.code:186:31: error: cannot convert ‘std::vector<int>’ to ‘int’ 186 | if (query(low_half(a), b)) { | ~~~~~~~~^~~ | | | std::vector<int> icc.h:10:15: note: initializing argument 1 of ‘int query(int, int, int*, int*)’ 10 | int query(int a, int b, int *A, int *B); | ~~~~^