結果

問題 No.1091 Range Xor Query
ユーザー ashipanashipan
提出日時 2020-06-26 20:42:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 395 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 3,221 ms
コンパイル使用メモリ 167,104 KB
実行使用メモリ 5,716 KB
最終ジャッジ日時 2023-09-18 01:13:30
合計ジャッジ時間 10,937 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 54 ms
4,380 KB
testcase_04 AC 231 ms
4,376 KB
testcase_05 AC 247 ms
5,224 KB
testcase_06 AC 11 ms
4,376 KB
testcase_07 AC 250 ms
4,380 KB
testcase_08 AC 360 ms
4,956 KB
testcase_09 AC 175 ms
4,376 KB
testcase_10 AC 249 ms
4,796 KB
testcase_11 AC 321 ms
5,520 KB
testcase_12 AC 185 ms
5,132 KB
testcase_13 AC 374 ms
4,864 KB
testcase_14 AC 266 ms
5,076 KB
testcase_15 AC 286 ms
5,680 KB
testcase_16 AC 279 ms
4,380 KB
testcase_17 AC 381 ms
5,236 KB
testcase_18 AC 59 ms
4,380 KB
testcase_19 AC 73 ms
4,376 KB
testcase_20 AC 360 ms
4,824 KB
testcase_21 AC 175 ms
4,380 KB
testcase_22 AC 347 ms
5,192 KB
testcase_23 AC 392 ms
5,580 KB
testcase_24 AC 386 ms
5,680 KB
testcase_25 AC 395 ms
5,684 KB
testcase_26 AC 393 ms
5,716 KB
testcase_27 AC 387 ms
5,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    vector<int> sum(n);
    sum[0] = a[0];
    rep(i, 0, n-1){
        sum[i+1] = sum[i]^a[i+1];
    }
    vector<int> ans;
    rep(i, 0, q){
        int l, r;
        cin >> l >> r;
        l--; r--;
        ans.push_back(sum[r]^sum[l-1]);
    }
    for(int i : ans){
        cout << i << endl;
    }
    return 0;
}
0