結果

問題 No.1091 Range Xor Query
ユーザー 👑 nullnull
提出日時 2020-12-13 23:09:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 909 ms
コンパイル使用メモリ 88,476 KB
実行使用メモリ 4,900 KB
最終ジャッジ日時 2023-10-20 04:31:24
合計ジャッジ時間 13,144 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 59 ms
4,372 KB
testcase_04 AC 234 ms
4,348 KB
testcase_05 AC 257 ms
4,900 KB
testcase_06 AC 12 ms
4,348 KB
testcase_07 AC 260 ms
4,348 KB
testcase_08 AC 368 ms
4,372 KB
testcase_09 AC 182 ms
4,348 KB
testcase_10 AC 257 ms
4,372 KB
testcase_11 AC 332 ms
4,636 KB
testcase_12 AC 199 ms
4,900 KB
testcase_13 AC 391 ms
4,348 KB
testcase_14 AC 278 ms
4,372 KB
testcase_15 AC 298 ms
4,636 KB
testcase_16 AC 288 ms
4,348 KB
testcase_17 AC 392 ms
4,636 KB
testcase_18 AC 60 ms
4,348 KB
testcase_19 AC 77 ms
4,348 KB
testcase_20 AC 370 ms
4,348 KB
testcase_21 AC 182 ms
4,348 KB
testcase_22 AC 355 ms
4,372 KB
testcase_23 AC 402 ms
4,900 KB
testcase_24 AC 402 ms
4,900 KB
testcase_25 AC 401 ms
4,900 KB
testcase_26 AC 402 ms
4,900 KB
testcase_27 AC 403 ms
4,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i, n) for(int i = 0; i < n; ++i)

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
            int n, q;
            cin >> n >> q;
            vector<int> a(n), b(n + 1);
            rep(i, n)cin >> a[i];
            rep(i, n)b[i + 1] = a[i] xor b[i];
            rep(i, q) {
                int l, r;
                cin >> l >> r;
                cout << (b[r] xor b[l - 1]) << '\n';
            }
    return 0;
}
0