結果

問題 No.1091 Range Xor Query
ユーザー tktk_snsn
提出日時 2021-03-30 21:33:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 304 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 70,996 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 21:59:21
合計ジャッジ時間 8,351 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n, q;
    cin >> n >> q;
    vector<int> a(n+1, 0);
    for(int i=0; i<n; ++i) {
        cin >> a[i+1];
        a[i+1] ^= a[i];
    }
    for (int i = 0; i < q; ++i) {
        int l, r;
        cin >> l >> r;
        l--;
        cout << (a[r]^a[l]) << endl;
    }
}
0