結果

問題 No.1895 Mod 2
ユーザー t98slidert98slider
提出日時 2023-01-09 02:57:39
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 1,606 ms
コンパイル使用メモリ 168,104 KB
実行使用メモリ 503,116 KB
最終ジャッジ日時 2023-08-22 10:07:17
合計ジャッジ時間 5,676 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 189 ms
502,908 KB
testcase_01 AC 201 ms
503,020 KB
testcase_02 AC 205 ms
503,024 KB
testcase_03 AC 209 ms
502,960 KB
testcase_04 AC 195 ms
502,908 KB
testcase_05 AC 221 ms
502,908 KB
testcase_06 AC 222 ms
502,928 KB
testcase_07 AC 221 ms
502,948 KB
testcase_08 AC 202 ms
503,116 KB
testcase_09 AC 203 ms
502,892 KB
testcase_10 AC 197 ms
502,984 KB
testcase_11 AC 212 ms
502,908 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