結果

問題 No.1895 Mod 2
ユーザー umezo
提出日時 2022-04-08 22:28:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
MLE  
実行時間 -
コード長 743 bytes
コンパイル時間 1,931 ms
コンパイル使用メモリ 199,272 KB
最終ジャッジ日時 2025-01-28 16:24:18
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 ll MM=32000000;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  vector<ll> A;
  for(ll i=3;i<MM;i+=2){
    ll t=i*i;
    ll tmp=t;
    while(1){
      while(1){
        A.push_back(tmp);
        if(tmp>MAX/2) break;
        tmp*=2;
      }
      if(tmp>MAX/t) break;
      tmp*=t;
    }
  }
  ll k=1;
  while(1){
    A.push_back(k);
    if(k>MAX/2) break;
    k*=2;
  }
  sort(ALL(A));
  
  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