QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#524739#6335. Belt ConveyorQwerty1232#Compile Error//C++231.2kb2024-08-20 03:43:312024-08-20 03:43:31

Judging History

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

  • [2024-08-20 03:43:31]
  • 评测
  • [2024-08-20 03:43:31]
  • 提交

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{};
      |                              ^~~~