結果

問題 No.1091 Range Xor Query
ユーザー AkabaEriAkabaEri
提出日時 2020-07-24 15:35:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 406 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 1,424 ms
コンパイル使用メモリ 164,072 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 12:21:31
合計ジャッジ時間 13,364 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 55 ms
4,380 KB
testcase_04 AC 236 ms
4,380 KB
testcase_05 AC 256 ms
4,380 KB
testcase_06 AC 11 ms
4,380 KB
testcase_07 AC 260 ms
4,380 KB
testcase_08 AC 364 ms
4,380 KB
testcase_09 AC 183 ms
4,376 KB
testcase_10 AC 253 ms
4,380 KB
testcase_11 AC 320 ms
4,376 KB
testcase_12 AC 192 ms
4,380 KB
testcase_13 AC 384 ms
4,380 KB
testcase_14 AC 270 ms
4,376 KB
testcase_15 AC 293 ms
4,376 KB
testcase_16 AC 291 ms
4,376 KB
testcase_17 AC 385 ms
4,376 KB
testcase_18 AC 60 ms
4,380 KB
testcase_19 AC 74 ms
4,376 KB
testcase_20 AC 382 ms
4,376 KB
testcase_21 AC 186 ms
4,380 KB
testcase_22 AC 356 ms
4,376 KB
testcase_23 AC 397 ms
4,380 KB
testcase_24 AC 404 ms
4,380 KB
testcase_25 AC 406 ms
4,380 KB
testcase_26 AC 393 ms
4,380 KB
testcase_27 AC 402 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;


int main(){
  int n,q;
  cin >> n >> q;
  int a[n+1];
  a[0]=0;
  rep(i,n){
    int g;
    cin >>g;
    a[i+1]=g^a[i];
  }

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