結果

問題 No.1895 Mod 2
ユーザー umezo
提出日時 2022-04-08 22:59:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
MLE  
実行時間 -
コード長 713 bytes
コンパイル時間 1,913 ms
コンパイル使用メモリ 199,880 KB
最終ジャッジ日時 2025-01-28 16:40:10
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample MLE * 1
other MLE * 11
権限があれば一括ダウンロードができます

ソースコード

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;

const ll MAX=1e15;
const int MM=32000000;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  vector<ll> A;
  for(int i=3;i<MM;i+=2){
    ll t=(ll)i*i;
    ll tmp=t;
    while(1){
      A.push_back(tmp);
      if(tmp>MAX/2) break;
      tmp*=2;
    }
  }
  ll k=1;
  while(1){
    A.push_back(k);
    if(k>MAX/2) break;
    k*=2;
  }
  sort(ALL(A));
  A.erase(unique(ALL(A)),A.end());
  
  int t;
  cin>>t;
  while(t--){
    ll l,r;
    cin>>l>>r;
    cout<<(upper_bound(ALL(A),r)-lower_bound(ALL(A),l))%2<<endl;
  }
   
  return 0;
}
0