結果

問題 No.1091 Range Xor Query
ユーザー kk
提出日時 2020-07-08 17:00:32
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 2,264 ms
コンパイル使用メモリ 196,312 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 23:49:58
合計ジャッジ時間 10,507 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 32 ms
6,940 KB
testcase_04 AC 185 ms
6,944 KB
testcase_05 AC 183 ms
6,940 KB
testcase_06 AC 6 ms
6,944 KB
testcase_07 AC 200 ms
6,940 KB
testcase_08 AC 283 ms
6,944 KB
testcase_09 AC 141 ms
6,940 KB
testcase_10 AC 188 ms
6,944 KB
testcase_11 AC 248 ms
6,944 KB
testcase_12 AC 133 ms
6,940 KB
testcase_13 AC 308 ms
6,944 KB
testcase_14 AC 207 ms
6,940 KB
testcase_15 AC 223 ms
6,944 KB
testcase_16 AC 230 ms
6,944 KB
testcase_17 AC 295 ms
6,944 KB
testcase_18 AC 47 ms
6,944 KB
testcase_19 AC 49 ms
6,944 KB
testcase_20 AC 290 ms
6,940 KB
testcase_21 AC 145 ms
6,944 KB
testcase_22 AC 264 ms
6,944 KB
testcase_23 AC 313 ms
6,944 KB
testcase_24 AC 309 ms
6,940 KB
testcase_25 AC 310 ms
6,940 KB
testcase_26 AC 307 ms
6,940 KB
testcase_27 AC 305 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, q;
  cin >> n >> q;

  vector<int> a(n+1);
  vector<int> sum(n+1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = sum[i-1] ^ a[i];
  }

  REP (_, q) {
    int l, r;
    cin >> l >> r;
    cout << (sum[r] ^ sum[l-1]) << endl;
  }
  
  return 0;
}
0