結果

問題 No.1930 XOR of Two Range
ユーザー umezoumezo
提出日時 2022-05-06 23:04:18
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 3,974 ms
コンパイル使用メモリ 197,228 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-20 05:21:39
合計ジャッジ時間 3,915 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 156 ms
4,376 KB
testcase_02 AC 162 ms
4,376 KB
testcase_03 AC 164 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int t;
  cin>>t;
  while(t--){
    ll l,r;
    cin>>l>>r;
    
    ll k=r-l;
    ll m=k/4*4;
    if(k%8==0) cout<<2*l+m<<endl;
    else if(k%8<4) cout<<1<<endl;
    else if(k%8==4) cout<<((2*l+m)^1)<<endl;
    else cout<<0<<endl;
  }
  
  return 0;
}
0