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 the God
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define pii pair <int, int>
#define smin(x, y) (x) = min((x), (y))
#define smax(x, y) (x) = max((x), (y))
#define all(x) (x).begin(), (x).end()
using namespace std;
const int inf = 1e9+7;
const int mod = 998244353;
const int maxn = 1e7+5;
int t, a, b, c, d, cnt[2][maxn];
bool mark[maxn];
vector <int> primes;
void relax(int x, int p, int i, int v) {
x /= p;
while (x) {
cnt[i][p] += x*v;
x /= p;
}
}
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
for (int i = 2; i < maxn; i++) {
if (!mark[i]) primes.pb(i);
for (int p : primes) {
if (p*i >= maxn) break;
mark[p*i] = 1;
if (!(i%p)) break;
}
}
cin >> t;
while (t--) {
cin >> a >> b >> c >> d; a--, c--;
for (int p : primes) {
relax(a, p, 0, 1), relax(d, p, 0, 1);
}
for (int p : primes) {
relax(b, p, 1, 1), relax(c, p, 1, 1);
}
bool f = 1;
for (int p : primes) {
if (cnt[1][p] > cnt[0][p]) f = 0;
}
if (f) cout << "DA\n";
else cout << "NE\n";
for (int p : primes) {
relax(a, p, 0, -1), relax(d, p, 0, -1);
}
for (int p : primes) {
relax(b, p, 1, -1), relax(c, p, 1, -1);
}
}
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... |