結果

問題 No.1091 Range Xor Query
ユーザー AkabaEri
提出日時 2020-07-24 15:35:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 418 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 1,704 ms
コンパイル使用メモリ 165,708 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 06:25:45
合計ジャッジ時間 12,291 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

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