結果

問題 No.1091 Range Xor Query
ユーザー SSRSSSRS
提出日時 2020-11-12 00:18:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 414 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 1,871 ms
コンパイル使用メモリ 167,012 KB
実行使用メモリ 4,752 KB
最終ジャッジ日時 2023-09-30 00:59:04
合計ジャッジ時間 13,902 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 56 ms
4,376 KB
testcase_04 AC 244 ms
4,376 KB
testcase_05 AC 267 ms
4,376 KB
testcase_06 AC 11 ms
4,376 KB
testcase_07 AC 269 ms
4,376 KB
testcase_08 AC 380 ms
4,500 KB
testcase_09 AC 189 ms
4,376 KB
testcase_10 AC 259 ms
4,380 KB
testcase_11 AC 340 ms
4,408 KB
testcase_12 AC 196 ms
4,468 KB
testcase_13 AC 401 ms
4,380 KB
testcase_14 AC 282 ms
4,376 KB
testcase_15 AC 305 ms
4,384 KB
testcase_16 AC 298 ms
4,380 KB
testcase_17 AC 396 ms
4,464 KB
testcase_18 AC 63 ms
4,380 KB
testcase_19 AC 76 ms
4,380 KB
testcase_20 AC 388 ms
4,380 KB
testcase_21 AC 188 ms
4,376 KB
testcase_22 AC 364 ms
4,376 KB
testcase_23 AC 411 ms
4,752 KB
testcase_24 AC 414 ms
4,560 KB
testcase_25 AC 411 ms
4,672 KB
testcase_26 AC 409 ms
4,672 KB
testcase_27 AC 411 ms
4,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, Q;
  cin >> N >> Q;
  vector<int> a(N);
  for (int i = 0; i < N; i++){
    cin >> a[i];
  }
  vector<int> s(N + 1);
  s[0] = 0;
  for (int i = 0; i < N; i++){
    s[i + 1] = s[i] ^ a[i];
  }
  for (int i = 0; i < Q; i++){
    int l, r;
    cin >> l >> r;
    l--;
    cout << (s[r] ^ s[l]) << endl;
  }
}
0