結果

問題 No.2879 Range Flip Queries
ユーザー well-definedwell-defined
提出日時 2024-09-14 09:45:00
言語 Rust
(1.77.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 24,632 ms
コンパイル使用メモリ 380,164 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-09-14 09:45:33
合計ジャッジ時間 21,339 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 100 ms
5,248 KB
testcase_04 AC 64 ms
5,376 KB
testcase_05 AC 45 ms
5,376 KB
testcase_06 AC 28 ms
5,376 KB
testcase_07 AC 28 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 75 ms
10,368 KB
testcase_14 AC 76 ms
11,136 KB
testcase_15 AC 52 ms
7,936 KB
testcase_16 AC 28 ms
5,376 KB
testcase_17 AC 68 ms
9,216 KB
testcase_18 AC 100 ms
13,184 KB
testcase_19 AC 101 ms
13,440 KB
testcase_20 AC 103 ms
13,312 KB
testcase_21 AC 102 ms
13,440 KB
testcase_22 AC 100 ms
13,256 KB
testcase_23 AC 100 ms
13,312 KB
testcase_24 AC 115 ms
13,568 KB
testcase_25 AC 104 ms
13,568 KB
testcase_26 AC 102 ms
13,696 KB
testcase_27 AC 103 ms
13,568 KB
testcase_28 AC 100 ms
13,568 KB
testcase_29 AC 84 ms
9,216 KB
testcase_30 AC 84 ms
9,216 KB
testcase_31 AC 85 ms
9,216 KB
testcase_32 AC 84 ms
9,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;

fn main() {
    input! {
        n: usize,
        q: usize,
        mut a: [i32; n],
    }
    let mut b = vec![0; n];
    for _ in 0..q {
        input! {
            l: usize,
            r: usize,
        }
        let l = l-1;
        let r = r-1;
        b[l] ^= 1;
        if r+1 < n { b[r+1] ^= 1};
    }
    let mut flip = 0;
    for i in 0..n {
        flip ^= b[i];
        let ans = if flip == 1 { a[i]^flip } else { a[i] };
        if i != n-1 { print!("{} ", ans); }
        else { println!("{}", ans); }
    }
}
0