結果

問題 No.1895 Mod 2
ユーザー t98slidert98slider
提出日時 2023-01-09 02:57:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 317 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 1,572 ms
コンパイル使用メモリ 170,360 KB
実行使用メモリ 503,296 KB
最終ジャッジ日時 2024-05-09 15:45:42
合計ジャッジ時間 5,826 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 317 ms
503,276 KB
testcase_01 AC 239 ms
503,188 KB
testcase_02 AC 235 ms
503,188 KB
testcase_03 AC 239 ms
503,236 KB
testcase_04 AC 227 ms
503,272 KB
testcase_05 AC 250 ms
503,256 KB
testcase_06 AC 250 ms
503,136 KB
testcase_07 AC 245 ms
503,260 KB
testcase_08 AC 236 ms
503,192 KB
testcase_09 AC 234 ms
503,296 KB
testcase_10 AC 228 ms
503,236 KB
testcase_11 AC 243 ms
503,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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';
    }
}
0