結果

問題 No.1091 Range Xor Query
ユーザー CELICACELICA
提出日時 2020-07-04 07:55:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 3,622 ms
コンパイル使用メモリ 168,656 KB
実行使用メモリ 6,556 KB
最終ジャッジ日時 2023-10-17 14:39:06
合計ジャッジ時間 8,610 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 19 ms
4,444 KB
testcase_04 AC 39 ms
4,708 KB
testcase_05 AC 57 ms
5,764 KB
testcase_06 AC 6 ms
4,348 KB
testcase_07 AC 49 ms
5,236 KB
testcase_08 AC 70 ms
5,764 KB
testcase_09 AC 32 ms
4,444 KB
testcase_10 AC 54 ms
5,500 KB
testcase_11 AC 67 ms
5,764 KB
testcase_12 AC 46 ms
5,500 KB
testcase_13 AC 72 ms
5,764 KB
testcase_14 AC 57 ms
5,500 KB
testcase_15 AC 63 ms
5,764 KB
testcase_16 AC 48 ms
4,972 KB
testcase_17 AC 78 ms
6,028 KB
testcase_18 AC 12 ms
4,348 KB
testcase_19 AC 21 ms
4,480 KB
testcase_20 AC 68 ms
5,764 KB
testcase_21 AC 32 ms
4,504 KB
testcase_22 AC 70 ms
5,764 KB
testcase_23 AC 76 ms
6,556 KB
testcase_24 AC 74 ms
6,556 KB
testcase_25 AC 77 ms
6,556 KB
testcase_26 AC 77 ms
6,556 KB
testcase_27 AC 77 ms
6,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using ll = long long;

using namespace std;

int main()
{
    ll n,q;
    scanf("%lld%lld", &n, &q);

    vector<ll> a(n+1);
    a[0] = 0;
    for (int i = 1; i < n+1; ++i)
    {
        ll aa;
        scanf("%lld", &aa);
        a[i] = a[i-1]^aa;
    }

    ll l, r;
    vector<ll> res(q);
    for (int i = 0; i < q; ++i)
    {
        scanf("%lld%lld", &l, &r);
        res[i] = a[--l]^a[r];
    }

    for (int i = 0; i < q; ++i)
        printf("%lld\n", res[i]);

    return 0;
}
0