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;
#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define _ << ' ' <<
#define INF (ll)1e18
#define mod 998244353
#define maxn 10000010
int i, i1, j, k, k1, t, n, m, res, flag[10], a, b, c, d, er[maxn];
vector<int> pr;
int pdc(int a, int p) {
if (a < p) return 0;
return a / p + pdc(a / p, p);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
/* #if !ONLINE_JUDGE && !EVAL
ifstream cin("input.txt");
ofstream cout("output.txt");
#endif */
for (i = 0; i < maxn; i++) er[i] = i;
for (i = 2; i < maxn; i++) {
if (er[i] != i) continue;
for (j = 2 * i; j < maxn; j += i) er[j] = i;
}
for (i = 2; i < maxn; i++) {
if (er[i] == i) pr.pb(i);
}
cin >> t;
while (t--) {
cin >> a >> b >> c >> d; flag[0] = 1;
for (auto u : pr) {
if (pdc(d, u) - pdc(c - 1, u) - pdc(b, u) + pdc(a - 1, u) < 0) flag[0] = 0;
}
if (flag[0] == 1) cout << "DA" << nl;
else cout << "NE" << nl;
}
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... |