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 ll long long
#define ar array
const int MX = 10000001;
bool p[MX];
vector<int> primes;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
memset(p, 1, sizeof(p));
for (int i = 2; i < MX; ++i) {
if (!p[i])
continue;
primes.push_back(i);
if ((ll)i * i >= MX)
continue;
for (int j = i * i; j < MX; j += i)
p[j] = 0;
}
int t; cin >> t;
for (int a, b, c, d; t--;) {
cin >> a >> b >> c >> d;
vector<int> ct(primes.size());
auto Upd = [&](int n, int i, int inc) {
int x = primes[i];
n /= x;
while(n) {
ct[i] += inc * n;
n /= x;
}
};
for (int i = 0; i < primes.size(); ++i) {
Upd(d, i, 1);
Upd(c - 1, i, -1);
Upd(b, i, -1);
Upd(a - 1, i, 1);
}
cout << (*min_element(ct.begin(), ct.end()) >= 0 ? "DA" : "NE") << "\n";
}
return 0;
}
Compilation message (stderr)
Main.cpp: In function 'int main()':
Main.cpp:36:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
36 | for (int i = 0; i < primes.size(); ++i) {
| ~~^~~~~~~~~~~~~~~
# | 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... |