結果

問題 No.1091 Range Xor Query
ユーザー hiro71687khiro71687k
提出日時 2023-08-26 23:52:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 432 ms / 2,000 ms
コード長 723 bytes
コンパイル時間 4,288 ms
コンパイル使用メモリ 260,308 KB
実行使用メモリ 6,384 KB
最終ジャッジ日時 2023-08-26 23:52:27
合計ジャッジ時間 16,621 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 57 ms
4,996 KB
testcase_04 AC 238 ms
4,376 KB
testcase_05 AC 265 ms
5,924 KB
testcase_06 AC 11 ms
4,380 KB
testcase_07 AC 270 ms
4,600 KB
testcase_08 AC 374 ms
5,060 KB
testcase_09 AC 181 ms
4,380 KB
testcase_10 AC 261 ms
5,520 KB
testcase_11 AC 342 ms
5,712 KB
testcase_12 AC 197 ms
6,120 KB
testcase_13 AC 432 ms
4,908 KB
testcase_14 AC 286 ms
5,176 KB
testcase_15 AC 309 ms
5,848 KB
testcase_16 AC 296 ms
4,376 KB
testcase_17 AC 422 ms
5,792 KB
testcase_18 AC 61 ms
4,380 KB
testcase_19 AC 77 ms
4,928 KB
testcase_20 AC 382 ms
4,968 KB
testcase_21 AC 181 ms
4,376 KB
testcase_22 AC 359 ms
5,440 KB
testcase_23 AC 406 ms
6,248 KB
testcase_24 AC 406 ms
6,384 KB
testcase_25 AC 406 ms
6,312 KB
testcase_26 AC 416 ms
6,368 KB
testcase_27 AC 408 ms
6,248 KB
権限があれば一括ダウンロードができます

ソースコード

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