이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// 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... |