This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* author: wxhtzdy
* created: 03.07.2022 11:06:33
**/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
const int MAX = 1e7 + 5;
vector<bool> pr(MAX, true);
for (int i = 2; i < MAX; i++) {
if (pr[i]) {
for (long long j = i * 1LL * i; j < MAX; j += i) {
pr[j] = false;
}
}
}
vector<int> primes;
for (int i = 2; i < MAX; i++) {
if (pr[i]) {
primes.push_back(i);
}
}
auto Count = [&](int x, int L, int R) {
long long p = x, cnt = 0;
while (p <= R) {
cnt += (R / p - (L - 1) / p);
p *= x;
}
return cnt;
};
int tt;
cin >> tt;
while (tt--) {
int a, b, c, d;
cin >> a >> b >> c >> d;
bool ok = true;
for (int i = 0; i < (int) primes.size(); i++) {
if (Count(primes[i], a, b) > Count(primes[i], c, d)) {
ok = false;
break;
}
}
cout << (ok ? "DA" : "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... |