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>
#define FOR(ii,aa,bb) for(int ii=aa;ii<bb;ii++)
#define for0(ii,bb) FOR(ii,0,bb)
#define for1(ii,bb) FOR(ii,1,bb+1)
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define st first
#define nd second
#define pii pair<int,int>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define pdi pair<double,int>
#define vi vector<int>
#define sp " "
#define nl "\n"
#define all(x) x.begin(),x.end()
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define int ll
using namespace std;
const int N = 1e7+5;
const int INF = 1e9+5;
const int mod = 1e9+7;
int a,b,c,d;
vi prime(N,1);
vi primes;
int calc(int x,int y){
if(x==0)
return 0;
return x/y+calc(x/y,y);
}
void solve(){
cin >> a >> b >> c >> d;
a--,c--;
for(int i:primes){
if(calc(b,i)-calc(a,i)>calc(d,i)-calc(c,i)){
cout << "NE\n";
return;
}
}
cout << "DA\n";
}
signed main(){
fastio()
for(int i=2;i<N;i++){
if(prime[i]){
primes.pb(i);
for(int j=i*i;j<N;j+=i)
prime[j]=0;
}
}
int tt=1;
cin >> tt;
while(tt--)
solve();
}
# | 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... |