結果

問題 No.1091 Range Xor Query
ユーザー CELICA
提出日時 2020-07-04 07:55:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 1,338 ms
コンパイル使用メモリ 169,348 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2024-09-17 12:26:06
合計ジャッジ時間 6,581 ms
ジャッジサーバーID
(参考情報)
judge6 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

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