結果

問題 No.1091 Range Xor Query
ユーザー tktk_snsntktk_snsn
提出日時 2021-03-30 21:33:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 1,700 ms
コンパイル使用メモリ 71,328 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-20 18:15:07
合計ジャッジ時間 9,770 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 26 ms
4,376 KB
testcase_04 AC 167 ms
4,376 KB
testcase_05 AC 160 ms
4,376 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 171 ms
4,376 KB
testcase_08 AC 241 ms
4,380 KB
testcase_09 AC 120 ms
4,380 KB
testcase_10 AC 155 ms
4,380 KB
testcase_11 AC 208 ms
4,380 KB
testcase_12 AC 110 ms
4,376 KB
testcase_13 AC 252 ms
4,376 KB
testcase_14 AC 173 ms
4,380 KB
testcase_15 AC 189 ms
4,380 KB
testcase_16 AC 202 ms
4,376 KB
testcase_17 AC 262 ms
4,380 KB
testcase_18 AC 43 ms
4,376 KB
testcase_19 AC 43 ms
4,376 KB
testcase_20 AC 258 ms
4,376 KB
testcase_21 AC 128 ms
4,380 KB
testcase_22 AC 239 ms
4,380 KB
testcase_23 AC 267 ms
4,376 KB
testcase_24 AC 276 ms
4,380 KB
testcase_25 AC 264 ms
4,376 KB
testcase_26 AC 278 ms
4,376 KB
testcase_27 AC 269 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n, q;
    cin >> n >> q;
    vector<int> a(n+1, 0);
    for(int i=0; i<n; ++i) {
        cin >> a[i+1];
        a[i+1] ^= a[i];
    }
    for (int i = 0; i < q; ++i) {
        int l, r;
        cin >> l >> r;
        l--;
        cout << (a[r]^a[l]) << endl;
    }
}
0