結果

問題 No.1895 Mod 2
ユーザー eQe
提出日時 2024-12-09 14:15:29
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 1,464 bytes
コンパイル時間 5,674 ms
コンパイル使用メモリ 308,632 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-09 14:15:36
合計ジャッジ時間 6,339 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
namespace my{
#define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__)
#define FO(n) for(ll ij=n;ij--;)
#define FOR(i,...) for(auto[i,i##stop,i##step]=range(0,__VA_ARGS__);i<i##stop;i+=i##step)
#define fo(i,...) FO##__VA_OPT__(R)(i __VA_OPT__(,__VA_ARGS__))
#define of(i,...) for(auto[i,i##stop,i##step]=range(1,__VA_ARGS__);i>=i##stop;i-=i##step)
#define multiple_testcases void solve();}int main(){my::io();int T;std::cin>>T;while(T--)my::solve();}namespace my{
void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<<fixed<<setprecision(15);}
using ll=long long;
constexpr auto range(bool s,auto...a){array<ll,3>r{0,0,1};ll I=0;((r[I++]=a),...);if(!s&&I==1)swap(r[0],r[1]);r[0]-=s;return r;}
constexpr char newline=10;
constexpr char space=32;
void lin(auto&...a){(cin>>...>>a);}
template<char c=space>void pp(const auto&...a){ll n=sizeof...(a);((cout<<a<<string(--n>0,c)),...);cout<<newline;}
constexpr uint64_t kth_root_floor(uint64_t a,ll k){
if (k==1)return a;
auto within=[&](uint32_t x){uint64_t t=1;fo(k)if(__builtin_mul_overflow(t,x,&t))return false;return t<=a;};
uint64_t r=0;
of(i,sizeof(uint32_t)*CHAR_BIT)if(within(r|(1u<<i)))r|=1u<<i;
return r;
}
constexpr auto sqrt_floor(auto x){return kth_root_floor(x,2);}
multiple_testcases
void solve(){
LL(L,R);
auto f=[&](ll n)->ll{
if(n==0)return 0;
return(sqrt_floor(n)+sqrt_floor(n/2))&1;
};
pp((f(R)-f(L-1))&1);
}}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0