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>
using namespace std;
typedef long long int ll;
#define pb push_back
#define all(x) x.begin(), x.end()
const int N = 1e7+10;
int a, b, c, d, T, x, y;
vector<ll> primes;
vector<bool> is(N);
int main(){
cin.tie(0); ios::sync_with_stdio(0);
for(int i = 2; i < N; i++){
if(!is[i]){
primes.pb(i);
for(int j = i; j < N; j += i) is[j] = 1;
}
}
cin >> T;
while(T--){
cin >> a >> b >> c >> d;
bool ok = 1;
for(ll p: primes){
x = y = 0;
ll e = p;
while(e <= max(b, d)){
ll n = ((a+e-1) / e);
ll m = (b / e);
x += max(0LL, m-n+1);
n = ((c+e-1) / e);
m = (d / e);
y += max(0LL, m-n+1);
e *= p;
}
if(x>y) ok = 0;
}
if(ok) 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... |