#include #define rep(i, a, n) for (int i = a; i < (int)(n); i++) #define vi vector #define vb vector #define ll long long using namespace std; void faster() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } template void input(T &x) { cin >> x; } template void input(T &x, Args &...args) { cin >> x; input(args...); } vi xudlr = {0, 0, -1, 1}; vi yudlr = {-1, 1, 0, 0}; int main() { int n, q; input(n, q); vector v(n); rep(i, 0, n) { int k; input(k); if (k == 0) v[i] = false; else v[i] = true; } rep(i, 0, q) { int l, r; input(l, r); rep(j, l - 1, r) { v[j] = !v[j]; } } for (auto ans : v) { if (ans == false) cout << 0 << " "; else cout << 1 << " "; } cout << '\n'; }