結果

問題 No.1091 Range Xor Query
ユーザー deuteridayo
提出日時 2020-12-03 20:40:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 425 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 1,723 ms
コンパイル使用メモリ 168,328 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 06:05:53
合計ジャッジ時間 12,845 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using lint = long long;
long const mod = 1e9+7;
int main(){
    lint n,q;
    cin >> n >> q;
    lint a[n+1];
    for(int i=1;i<=n;i++)cin >> a[i];
    lint xorr[n+1];
    xorr[0] = 0;
    for(int i=1;i<=n;i++){
        xorr[i] = xorr[i-1] ^ a[i];
    }
    for(int i=0;i<q;i++){
        lint l,r;
        cin >> l >> r;
        cout << (xorr[l-1] ^ xorr[r] )<< endl;
    }
}
0