QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#142703#4564. Digital CircuitQwerty1232#Compile Error//C++201.1kb2023-08-19 18:15:222024-07-04 01:49:00

Judging History

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

  • [2024-07-04 01:49:00]
  • 评测
  • [2023-08-19 18:15:22]
  • 提交

answer

#include "insects.h"

#include <numeric>
#include <vector>

int min_cardinality(int n) {
    int beg = 0, end = n;
    while (beg + 1 < end) {
        int mid = (beg + end) / 2;
        std::vector<bool> fucked(n);
        std::vector<int> vec;

        for (int i = 0; i < n; i++) {
            move_inside(i);
            if (mid < press_button()) {
                fucked[i] = true;
                move_outside(i);
            } else {
                vec.push_back(i);
            }
        }
        for (int i : vec) {
            move_outside(i);
        }
        vec.clear();
        for (int i = n - 1; i >= 0; i--) {
            move_inside(i);
            if (mid < press_button()) {
                fucked[i] = true;
                move_outside(i);
            } else {
                vec.push_back(i);
            }
        }
        for (int i : vec) {
            move_outside(i);
        }
        vec.clear();

        if (std::accumulate(fucked.begin(), fucked.end(), 0) == n) {
            beg = mid;
        } else {
            end = mid;
        }
    }
    return end;
}

详细

answer.code:1:10: fatal error: insects.h: No such file or directory
    1 | #include "insects.h"
      |          ^~~~~~~~~~~
compilation terminated.