This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// In the name of God
// Hope is last to die
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
#define int long long
#define S second
#define F first
#define mp make_pair
#define smax(x, y) (x) = max((x), (y))
#define smin(x, y) (x) = min((x), (y))
#define all(x) (x).begin(), (x).end()
#define len(x) ((int)(x).size())
const int maxn = 1e7 + 5;
const int inf = 1e9 + 7;
bool mark[maxn];
int get(int a, int b, int p){
int res = 0;
int m = p;
while(m <= b){
res += b / m - ((a - 1) / m);
m *= p;
}
return res;
}
int32_t main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
vector<int> prime;
for(int i = 2; i < maxn; i++){
if(!mark[i]) prime.pb(i);
for(auto u: prime){
if(1ll * u * i > maxn) break;
mark[u * i] = 1;
if(i % u == 0) break;
}
}
int t; cin >> t;
while(t--){
int a, b, c, d; cin >> a >> b >> c >> d;
bool flag = 1;
for(auto p: prime){
int x = get(a, b, p), y = get(c, d, p);
if(x > y) flag = 0;
}
if(flag) 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... |