結果
問題 | No.1895 Mod 2 |
ユーザー |
![]() |
提出日時 | 2022-04-08 22:26:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 738 bytes |
コンパイル時間 | 1,655 ms |
コンパイル使用メモリ | 166,156 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-28 13:07:52 |
合計ジャッジ時間 | 2,172 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using P = pair<ll,ll>;#define rep(i, n) for(ll i = 0; i < n; i++)#define all(x) (x).begin(),(x).end()template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}ll cal(ll x){ll ok = 0, ng = 32000000;while(ng-ok>1){ll md = (ng+ok)/2;if(md*md<=x) ok = md;else ng = md;}return ok;}int main(){cin.tie(nullptr);ios::sync_with_stdio(false);int t;cin >> t;rep(houren,t){ll l,r;cin >> l >> r;l--;cout << (cal(r)+cal(r/2)-cal(l)-cal(l/2))%2 << '\n';}return 0;}