Submission #381938

#TimeUsernameProblemLanguageResultExecution timeMemory
381938NONAMEVepar (COCI21_vepar)C++17
30 / 70
1593 ms81556 KiB
#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> inline bool chmin(T& a, const T b) {a = min(a, b); return (a == b);}
template <typename T> inline bool chmax(T& a, const T b) {a = max(a, b); return (a == b);}

const int base = (int)(1e9 + 7);
const int man = (int)(1e7 + 10);

int lp[man], cnt[man];
vector <int> prime;

inline void cls() {}

void solve() {
    cls();

    int a, b, c, d;
    for (int i = 1; i <= 1e7; ++i) {
        cnt[i] = 0;
    }
    cin >> a >> b >> c >> d;
    for (int i = a; i <= b; ++i) {
        int d = i;
        while (d > 1) {
            ++cnt[lp[d]];
            d /= lp[d];
        }
    }
    for (int i = c; i <= d; ++i) {
        int d = i;
        while (d > 1) {
            cnt[lp[d]] = max(cnt[lp[d]] - 1, 0);
            d /= lp[d];
        }
    }

    bool gd = true;
    for (int i = 1; i <= 1e7; ++i) {
        gd &= !cnt[i];
    }

    if (gd) {
        cout << "DA\n";
    } else {
        cout << "NE\n";
    }
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//    int t = 1;
    #ifdef _LOCAL
        system("color a");
        freopen("in.txt", "r", stdin);
//        cin >> t;
    #endif

    for (int i = 2; i <= 1e7; ++i) {
        if (lp[i] == 0) {
            lp[i] = i;
            prime.push_back(i);
        }
        for (int j = 0; (j < (int)(prime.size())) && (prime[j] <= lp[i]) && ((i * 1LL * prime[j]) <= 1e7); ++j) {
            lp[i * prime[j]] = prime[j];
        }
    }

    int t;
    cin >> t;
    while (t--) {
        solve();
    }
//    for (int i = 1; i <= t; ++i) {
//        cerr << "Case #" << i << ": \n";
//        solve();
//        cerr << "\n";
//    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...