# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1185469 | 29ChuManhTich | Vepar (COCI21_vepar) | C++20 | 160 ms | 43804 KiB |
#include<bits/stdc++.h>
using namespace std;
#define NAME "FOX"
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FOD(i, a, b) for(int i = a; i >= b; i--)
#define ll long long
#define ii pair<int, int>
#define fi first
#define se second
#define fastIO ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define BIT(x, i) ((x >> i) & 1)
#define ALL(x) x.begin(), x.end()
const int maxn = 1e7 + 11;
const int LOGN = 20;
const int MOD = 1e9 + 7;
int t;
vector<int> p;
int nt[maxn];
void sieve() {
nt[0] = nt[1] = 0;
for(int i = 2; i <= maxn; i++) {
if(!nt[i]) {
p.push_back(i);
for(ll j = 1LL * i * i; j <= maxn; j += i) {
nt[j] = 1;
}
}
}
}
int get(int a, int x) {
int res = 0;
while(a > 0) {
res += a / x;
a /= x;
}
return res;
}
void solve() {
int a, b, c, d; cin >> a >> b >> c >> d;
for(auto x : p) {
if(get(c - 1, x) + get(b, x) > get(a - 1, x) + get(d, x)) {
cout << "NE\n";
return;
}
}
cout << "DA\n";
}
signed main() {
if(fopen(NAME".INP", "r")) {
freopen(NAME".INP", "r", stdin);
freopen(NAME".OUT", "w", stdout);
}
fastIO;
sieve();
cin >> t;
while(t--) {
solve();
}
return 0;
}
/*
2
9 10 3 6
2 5 7 9
*/
Compilation message (stderr)
# | 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... |