結果
問題 | No.1895 Mod 2 |
ユーザー |
|
提出日時 | 2024-04-01 14:10:29 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 2,114 bytes |
コンパイル時間 | 2,922 ms |
コンパイル使用メモリ | 244,340 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-30 21:49:15 |
合計ジャッジ時間 | 3,694 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 |
ソースコード
#include<bits/stdc++.h>using namespace std;using vst = vector<string>;using ll = long long;using ld = long double;using pll = pair<ll,ll>;using vll = vector<ll>;using vvll = vector<vll>;using vpll = vector<pll>;#define rep(i, n) for (ll i = 0; i < n; i++)#define repp(i,k,n) for (ll i = k; i < n; i++)#define per(i,s,e) for(ll i = s; i >= e; i--)#define all(v) v.begin(),v.end()#define no() {cout << "No" << endl; return 0;}#define yes(){cout << "Yes" << endl;return 0;}#define yesno(a) a ? cout << "Yes" << endl : cout << "No" << endl#define YESNO(a) a ? cout << "YES" << endl : cout << "NO" << endl#define MODD 998244353LL#define MOD 1000000007LL#define UNOmap unordered_map#define UNOset unordered_set#define ASC(T) T,vector<T>,greater<T>#define join(G,a,b) G[a].push_back(b);G[b].push_back(a);#define PB(a,b) a.push_back(b)template<class... T>void in(T&... a){(cin >> ... >> a);}template<class T, class... Ts>void out(const T& a, const Ts&... b){cout << a;((cout << ' ' << b), ...);cout << '\n';}void vin(vll &v){for(ll i = 0; i < (ll)v.size(); i++)in(v[i]);}void vout(vll &v){for(ll i = 0; i < (ll)v.size(); i++) cout << v[i] << ' ';cout << "\n";}ll INF = 1LL << 62;// #include<boost/multiprecision/cpp_int.hpp>// using namespace boost::multiprecision;// using mint = modint998244353;// using mint = modint1000000007;// using mint = modint;// cout << fixed << setprecision(15);//----------------------------------------------ll count(ll x){ll ok = 0;ll ng = x+10;while(ng-ok > 1){ll mid = (ng+ok)/2;ld m = mid;if(m*m >= 1e16){ng = mid;continue;}if(mid*mid <= x){ok = mid;}else ng = mid;}ll res = ok;ok = 0;ng = x+10;while(ng-ok > 1){ll mid = (ng+ok)/2;ld m = mid;if(2*m*m >= 1e16){ng = mid;continue;}if(2*mid*mid <= x){ok = mid;}else ng = mid;}res += ok;return res;}int main(){ll T;in(T);rep(test,T){ll L,R;in(L,R);ll a = count(R);ll b = count(L-1);out((a-b) % 2);}}