#![allow(non_snake_case, unused_must_use, unused_imports)] use std::io::{self, prelude::*}; fn main() { let (stdin, stdout) = (io::read_to_string(io::stdin()).unwrap(), io::stdout()); let (mut stdin, mut buffer) = (stdin.split_whitespace(), io::BufWriter::new(stdout.lock())); macro_rules! input { ($t: tt, $n: expr) => { (0..$n).map(|_| input!($t)).collect::>() }; (Chars) => { input! {String}.chars().collect::>() }; (Usize1) => { stdin.next().unwrap().parse::().unwrap() - 1 }; ($t: ty) => { stdin.next().unwrap().parse::<$t>().unwrap() }; } let N = input!(usize); let Q = input!(usize); let A = input!(i32, N); let mut D = vec![0; N + 1]; for _ in 0..Q { let l = input!(Usize1); let r = input!(Usize1); D[l] += 1; D[r + 1] -= 1; } let mut S = vec![D[0]]; for i in 1..N { S.push(S[i - 1] + D[i]); } let ans = (0..N) .map(|i| if (A[i] + S[i]) % 2 == 0 { 0 } else { 1 }) .collect::>(); writeln!( buffer, "{}", ans.iter() .map(|x| x.to_string()) .collect::>() .join(" ") ); }