結果

問題 No.1091 Range Xor Query
ユーザー AkabaEri
提出日時 2020-07-24 15:35:40
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 232 ms / 2,000 ms
コード長 545 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 876 ms
コンパイル使用メモリ 183,856 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-11 13:33:07
合計ジャッジ時間 7,635 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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