結果

問題 No.1091 Range Xor Query
ユーザー phsplsphspls
提出日時 2020-06-29 23:06:47
言語 Rust
(1.77.0)
結果
AC  
実行時間 304 ms / 2,000 ms
コード長 816 bytes
コンパイル時間 5,408 ms
コンパイル使用メモリ 138,056 KB
実行使用メモリ 4,740 KB
最終ジャッジ日時 2023-09-26 11:25:42
合計ジャッジ時間 14,138 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 26 ms
4,380 KB
testcase_04 AC 190 ms
4,376 KB
testcase_05 AC 183 ms
4,472 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 202 ms
4,380 KB
testcase_08 AC 281 ms
4,380 KB
testcase_09 AC 144 ms
4,376 KB
testcase_10 AC 190 ms
4,376 KB
testcase_11 AC 246 ms
4,376 KB
testcase_12 AC 129 ms
4,436 KB
testcase_13 AC 304 ms
4,376 KB
testcase_14 AC 212 ms
4,376 KB
testcase_15 AC 211 ms
4,496 KB
testcase_16 AC 233 ms
4,376 KB
testcase_17 AC 297 ms
4,376 KB
testcase_18 AC 45 ms
4,376 KB
testcase_19 AC 42 ms
4,380 KB
testcase_20 AC 291 ms
4,380 KB
testcase_21 AC 142 ms
4,380 KB
testcase_22 AC 271 ms
4,376 KB
testcase_23 AC 292 ms
4,708 KB
testcase_24 AC 298 ms
4,640 KB
testcase_25 AC 301 ms
4,740 KB
testcase_26 AC 296 ms
4,704 KB
testcase_27 AC 299 ms
4,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut nq = String::new();
    std::io::stdin().read_line(&mut nq).ok();
    let nq: Vec<usize> = nq.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nq[0];
    let q = nq[1];
    let mut a = String::new();
    std::io::stdin().read_line(&mut a).ok();
    let mut summary: Vec<usize> = vec![0; n+1];
    a.trim().split_whitespace().map(|s| s.parse::<usize>().unwrap()).enumerate().for_each(|pair| {
        summary[pair.0 + 1] = summary[pair.0] ^ pair.1;
    });
    for _ in 0..q {
        let mut lr = String::new();
        std::io::stdin().read_line(&mut lr).ok();
        let lr: Vec<usize> = lr.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
        let l = lr[0];
        let r = lr[1];
        println!("{}", summary[r] ^ summary[l-1]);
    }
}
0