#ifdef ONLINE_JUDGE #pragma GCC target("avx") #endif #ifndef LOCAL #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #else #define _GLIBCXX_DEBUG #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include using std::cerr; using std::cin; using std::cout; using std::pair; using std::string; using std::vector; //region #define rep(i, n) for (std::uint32_t i = 0; i < (n); ++i) using ll = long long; using ld = long double; using uint = unsigned int; using ull = unsigned long long; using usize = std::size_t; using vint = vector; using vlong = vector; using pii = pair; template using VV = vector>; template using priority_queue_g = std::priority_queue, std::greater<>>; //vector split(const string &s, const string &delim) { // vector res; // string::size_type pos = 0; // while (true) { // const size_t found = s.find(delim, pos); // if (found == std::string::npos) { res.push_back(s.substr(pos)); break; } // res.push_back(s.substr(pos, found - pos)); // pos = found + delim.size(); // } // return res; //} template string join(vector &vec, const string &sep) { size_t size = vec.size(); if (!size) return ""; std::stringstream ss; for (size_t i : range(vec.size() - 1)) ss << vec[i] << sep; ss << vec.back(); return ss.str(); } template std::istream &operator>>(std::istream &is, pair &pair) { return is >> pair.first >> pair.second; } template std::istream &operator>>(std::istream &is, vector &vec) { for (T &x : vec) is >> x; return is; } template inline void print(const Iter &first, const Iter &last, const std::string &d = " ", bool endline = true) { cout << *first; for (Iter iter = first + 1; iter < last; ++iter) cout << d << *iter; if (endline) cout << "\n"; } constexpr ll powmod(ll a, ull b, uint p) { ll res = 1; while (b > 0) { if (b % 2) res = res * a % p; a = a * a % p; b >>= 1u; } return res; } constexpr ll pow(ll a, ll b) { ll res = 1; while (b > 0) { if (b % 2) res = res * a; a = a * a; b >>= 1u; } return res; } template, nullptr_t>* = nullptr> struct RangeIterator { RangeIterator(T current, T step) : _current(current), _step(step) {} constexpr bool operator!=(RangeIterator& other) const noexcept { return _step < 0 ? _current > other._current : _current < other._current; } RangeIterator operator++() noexcept { _current += _step; return *this; } constexpr T operator*() const noexcept { return _current; } private: T _current, _step; }; template, nullptr_t>* = nullptr> struct range { range(T stop) : range(0, stop) {} range(T start, T stop, T step = 1) : _start(start), _stop(stop), _step(step) {} RangeIterator begin() const noexcept { return RangeIterator(_start, _step); } RangeIterator end() const noexcept { return RangeIterator(_stop, _step); } private: T _start, _stop, _step; }; template range rev_range(T stop) { return range(stop - 1, -1, -1); } template::value, nullptr_t>* = nullptr> bool chmax(T &a, const U &b) { return a < T(b) && (a = T(b), true); } template::value, nullptr_t>* = nullptr> bool chmin(T &a, const U &b) { return a > T(b) && (a = T(b), true); } template void bsort(vector &v) { std::sort(v.begin(), v.end()); } template void rsort(vector &v) { std::sort(v.begin(), v.end(), std::greater()); } struct io_init { io_init() { cin.tie(nullptr); cout.tie(nullptr); std::ios::sync_with_stdio(false); cout << std::fixed << std::setprecision(16); } } io_init_nouse; //endregion template vector input_vec(usize n, std::make_signed_t offset = 0) { vector res(n); cin >> res; for (usize i : range(n)) res[i] += offset; return res; } template std::vector make_vec(std::size_t n) { return std::vector(n); } template auto make_vec(std::size_t n, Tail... tail) { return std::vector(n, make_vec(tail...)); } void solve(); int main() { solve(); } #include "testlib.h" void solve() { registerValidation(); usize n = inf.readInt(1, 200000); inf.readEoln(); vector a = inf.readIntegers(n, 0, 1); inf.readEoln(); inf.readEof(); }