This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef string st;
typedef bool bl;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
typedef vector<pii> vpi;
#define pu push
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fast ios_base::sync_with_stdio(0);cin.tie();
#define test ll qqqqq;cin>>qqqqq;while(qqqqq--)
#define F first
#define S second
#define forn(i,n) for(ll i=0;i<n;i++)
#define forx(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define pob pop_back
#define all(v) v.begin(),v.end()
#define lb lower_bound
#define ub upper_bound
#define pof pop_front
#define pow powww
#define prtll(x) printf("%lld",x)
#define prtld(x) printf("%Lf",x)
#define prtst(x) printf("%s",x)
#define prtch(x) printf("%c",x)
#define measure chrono::high_resolution_clock::now()
const ll dx[]{1,0,-1,0};
const ll dy[]{0,-1,0,1};
const ll inf=2e18;
//const ll mod=1e9+7;
const ll LM=1e7+2;
const ll M=1e6+10;
const ll MM=1002;
const ll MMM=101;
const ld pi=acos(-1);
const ll mod=998244353;
ll pow(ll r,ll to,ll m=mod){
ll res=1;
while(to){
if((to&1))
res*=r,res%=m;
r*=r,r%=m;
to=(to>>1);
}
return res;
}
bl nprime[LM];
ll count(ll left,ll right,ll dd){
ll ans=0,d=dd;
while(d<=right){
ll l=left,r=right;
l=(l+d-1)/d;
r/=d;
ans+=r-l+1;
d*=dd;
}
return ans;
}
vii primes;
int main(){
fast
forx(i,2,LM){
if(nprime[i])
continue;
ll j=2;
while(j*i<LM)
nprime[j*i]=1,j++;
primes.pb(i);
}
test{
bl chk=1;
ll a,b,c,d;
cin>>a>>b>>c>>d;
for(auto i:primes){
if(i>max(d,b))
break;
if(count(a,b,i)>count(c,d,i))
chk=0;
}
if(chk)
cout<<"DA\n";
else
cout<<"NE\n";
}
return 0;
}
/*
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |