#include <bits/stdc++.h>
#define TASK "coci2021_r4_vepar"
#define int long long
#define fi first
#define se second
#define pb push_back
#define ii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vii vector<ii>
#define reset(f, x) memset(f, x, sizeof(f))
#define all(x) x.begin(), x.end()
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; --i)
#define FORV(v, H) for (auto &v: H)
#define __builtin_popcount __builtin_popcountll
#define BIT(mask, i) (mask & (1ll << (i)))
#define MASK(i) (1ll << (i))
#define ONBIT(mask, i) (mask (1ll << (i)))
#define OFFBIT(mask, i) (mask &~ (1ll << (i)))
#define mid(l,r) ((l + r) >> 1)
#define left(id) (id << 1)
#define right(id) ((id << 1) | 1)
using namespace std;
const int oo = 1e18;
const int MOD = 1e9 + 7;
const int MAXN = 1e7 + 17;
int T;
bool check[MAXN];
vi primes;
int hi(int P, int X) {
if (X == 0) return 0;
return X / P + hi(P, X / P);
}
main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
reset(check, true);
FOR(i, 2, 3162){
if (check[i]){
for(int j = i * i; j <= 1e7; j += i) check[j] = false;
}
}
FOR(i, 2, 1e7) if (check[i]) primes.pb(i);
cin >> T;
while (T--){
int A, B, C, D;
cin >> A >> B >> C >> D;
A--; C--;
bool flag = true;
for(int p : primes){
if ((p > A) && (p > B) && (p > C) && (p > D)) break;
if (hi(p, B) + hi(p, C) > hi(p, A) + hi(p, D)){
flag = false;
break;
}
}
if (flag) cout << "DA" << '\n'; else cout << "NE" << '\n';
}
return 0;
}
Compilation message (stderr)
Main.cpp:40:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
40 | main(){
| ^~~~
# | 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... |