#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; #include bool op(bool a, bool b) { return a || b; } // なんでも bool e() { return false; } // なんでも bool mapping(bool f, bool x) { return f ^ x; } bool composition(bool f, bool g) { return f ^ g; } bool id() { return false; } int main() { int n, q; cin >> n >> q; vector a(n); rep(i, n) cin >> a[i]; atcoder::lazy_segtree seg(n); rep(i, n) seg.set(i, a[i] == 1); while (q--) { int l, r; cin >> l >> r; seg.apply(l - 1, r, true); } rep(i, n) cout << (seg.get(i) ? 1 : 0) << ' '; cout << endl; return 0; }