結果
| 問題 | 
                            No.1895 Mod 2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-01-09 02:57:39 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 442 ms / 2,000 ms | 
| コード長 | 589 bytes | 
| コンパイル時間 | 1,848 ms | 
| コンパイル使用メモリ | 169,952 KB | 
| 実行使用メモリ | 503,292 KB | 
| 最終ジャッジ日時 | 2024-12-16 06:03:42 | 
| 合計ジャッジ時間 | 8,168 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 11 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int Q, m = 32000000;
    cin >> Q;
    vector<ll> sq(m + 1), sq2(m + 1);
    for(ll i = 1; i <= m; i++){
        sq[i] = i * i;
        sq2[i] = sq[i] << 1;
    }
    while(Q--){
        ll L, R;
        cin >> L >> R;
        bool ans = upper_bound(sq.begin(), sq.end(), R) - lower_bound(sq.begin(), sq.end(), L) & 1;
        ans ^= upper_bound(sq2.begin(), sq2.end(), R) - lower_bound(sq2.begin(), sq2.end(), L) & 1;
        cout << ans << '\n';
    }
}