QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#524739 | #6335. Belt Conveyor | Qwerty1232# | Compile Error | / | / | C++23 | 1.2kb | 2024-08-20 03:43:31 | 2024-08-20 03:43:31 |
Judging History
answer
#include <vector>
#include "conveyor.h"
void Solve(int n, std::vector<int> A, std::vector<int> B) {
std::vector<int> ans(n - 1, -1);
while (true) {
int it = std::find(ans.begin(), ans.end(), -1) - ans.begin();
if (it == ans.size()) {
break;
}
int u = A[it];
std::vector<int> rev(n - 1);
std::vector<int> put(n);
put[u] = 1;
for (int i = 0; i < n - 1; i++) {
if (ans[i] != -1) {
if ((ans[i] ? B[i] : A[i]) == u) {
rev[i] = 1;
}
}
}
auto res = Query(rev, put);
int ind = std::find(res.begin(), res.end(), 1) - res.begin();
if (ind == u) {
for (int i = 0; i < n - 1; i++) {
if (ans[i] == -1 && (A[i] == u || B[i] == u)) {
ans[i] = A[i] == u;
}
}
} else {
for (int i = 0; i < n - 1; i++) {
if (ans[i] == -1 && (A[i] == u && B[i] == ind || A[i] == ind && B[i] == u)) {
ans[i] = A[i] == ind;
}
}
}
}
Answer(ans);
}
詳細信息
answer.code: In function ‘void Solve(int, std::vector<int>, std::vector<int>)’: answer.code:9:23: error: ‘find’ is not a member of ‘std’; did you mean ‘std::ranges::find’? 9 | int it = std::find(ans.begin(), ans.end(), -1) - ans.begin(); | ^~~~ In file included from /usr/include/c++/13/tuple:44, from /usr/include/c++/13/bits/uses_allocator_args.h:38, from /usr/include/c++/13/bits/memory_resource.h:41, from /usr/include/c++/13/vector:80, from answer.code:1: /usr/include/c++/13/bits/ranges_util.h:494:30: note: ‘std::ranges::find’ declared here 494 | inline constexpr __find_fn find{}; | ^~~~ answer.code:25:24: error: ‘find’ is not a member of ‘std’; did you mean ‘std::ranges::find’? 25 | int ind = std::find(res.begin(), res.end(), 1) - res.begin(); | ^~~~ /usr/include/c++/13/bits/ranges_util.h:494:30: note: ‘std::ranges::find’ declared here 494 | inline constexpr __find_fn find{}; | ^~~~