結果

問題 No.1091 Range Xor Query
ユーザー hiro71687k
提出日時 2023-08-26 23:52:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 421 ms / 2,000 ms
コード長 723 bytes
コンパイル時間 4,008 ms
コンパイル使用メモリ 250,900 KB
最終ジャッジ日時 2025-02-16 14:54:33
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ll inf=1009999999999999990;
int main(){
    ll n,q;
    cin >> n >> q;
    vector<ll>a(n);
    vector<ll>s(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        if (i==0)
        {
            s[i]=a[i];
        }else{
            s[i]=s[i-1]^a[i];
        }
    }
    for (ll i = 0; i < q; i++)
    {
        ll l,r;
        cin >> l >> r;
        l--,r--;
        if (l==0)
        {
            cout << s[r] << endl;
        }else{
            ll x=s[l-1]^s[r];
            cout << x << endl;
        }
        
    }
    
}
0