結果

問題 No.1091 Range Xor Query
ユーザー 👑 null
提出日時 2020-06-20 01:59:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 578 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 1,113 ms
コンパイル使用メモリ 91,892 KB
最終ジャッジ日時 2025-01-11 08:23:29
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i, n) for(int i = 0; i < n; ++i)

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
            int n, q;
            cin >> n >> q;
            vector<int> a(n), b(n + 1);
            rep(i, n)cin >> a[i];
            rep(i, n)b[i + 1] = a[i] xor b[i];
            rep(i, q) {
                int l, r;
                cin >> l >> r;
                cout << (b[r] xor b[l - 1]) << '\n';
            }
    return 0;
}
0