結果

問題 No.1091 Range Xor Query
ユーザー tktk_snsntktk_snsn
提出日時 2021-03-30 21:32:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 407 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 71,168 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-08 00:38:38
合計ジャッジ時間 11,126 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 53 ms
5,376 KB
testcase_04 AC 255 ms
5,376 KB
testcase_05 AC 244 ms
5,376 KB
testcase_06 AC 11 ms
5,376 KB
testcase_07 AC 252 ms
5,376 KB
testcase_08 AC 352 ms
5,376 KB
testcase_09 AC 178 ms
5,376 KB
testcase_10 AC 244 ms
5,376 KB
testcase_11 AC 317 ms
5,376 KB
testcase_12 AC 181 ms
5,376 KB
testcase_13 AC 376 ms
5,376 KB
testcase_14 AC 261 ms
5,376 KB
testcase_15 AC 277 ms
5,376 KB
testcase_16 AC 277 ms
5,376 KB
testcase_17 AC 371 ms
5,376 KB
testcase_18 AC 57 ms
5,376 KB
testcase_19 AC 72 ms
5,376 KB
testcase_20 AC 356 ms
5,376 KB
testcase_21 AC 179 ms
5,376 KB
testcase_22 AC 343 ms
5,376 KB
testcase_23 AC 384 ms
5,376 KB
testcase_24 AC 387 ms
5,376 KB
testcase_25 AC 393 ms
5,376 KB
testcase_26 AC 379 ms
5,376 KB
testcase_27 AC 407 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    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