結果

問題 No.1091 Range Xor Query
ユーザー pop_o
提出日時 2024-08-06 23:59:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 304 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 1,644 ms
コンパイル使用メモリ 168,152 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-08-06 23:59:11
合計ジャッジ時間 10,713 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int64_t inf = 1e18;
const int64_t mod = 998244353;
// const int64_t mod = 1000000007;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    int tt;
    cin >> tt;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int> s(n+1);
    s[0] = 0;
    for (int i = 0; i < n; i++) {
        s[i+1] = s[i]^a[i];
    }
    for (;tt--;) {
        int l, r;
        cin >> l >> r;
        l--;
        cout << (s[l]^s[r]) << endl;
    }
}
0