cp-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub dgcnz/cp-library

:warning: cplib/divide_conquer/binary_search01.hpp

Code

#ifndef CPLIB_BINARY_SEARCH01_HPP
#define CPLIB_BINARY_SEARCH01_HPP

#include <algorithm>
#include <cassert>
#include <iterator>

namespace cplib
{
using namespace std;
template <typename InputIt,
          typename UnaryFunction,
          typename T = typename iterator_traits<InputIt>::value_type>
InputIt binary_search01(InputIt first, InputIt last, UnaryFunction p)
{
    return lower_bound(
        first, last, T(), [&p](T x, [[maybe_unused]] T val) { return !p(x); });
}
} // namespace cplib

#endif // CPLIB_BINARY_SEARCH01_HPP
#line 1 "cplib/divide_conquer/binary_search01.hpp"



#include <algorithm>
#include <cassert>
#include <iterator>

namespace cplib
{
using namespace std;
template <typename InputIt,
          typename UnaryFunction,
          typename T = typename iterator_traits<InputIt>::value_type>
InputIt binary_search01(InputIt first, InputIt last, UnaryFunction p)
{
    return lower_bound(
        first, last, T(), [&p](T x, [[maybe_unused]] T val) { return !p(x); });
}
} // namespace cplib
Back to top page