Submission #929045

#TimeUsernameProblemLanguageResultExecution timeMemory
929045a_l_i_r_e_z_aVepar (COCI21_vepar)C++17
30 / 70
194 ms16228 KiB
// In the name of God
// Hope is last to die

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pb push_back
// #define int long long    
#define S second
#define F first
#define mp make_pair
#define smax(x, y) (x) = max((x), (y))
#define smin(x, y) (x) = min((x), (y))
#define all(x) (x).begin(), (x).end()
#define len(x) ((int)(x).size())

const int maxn = 1e7 + 5;
const int inf = 1e9 + 7;
bool mark[maxn];

int get(int a, int b, int p){
    int res = 0;
    int m = p;
    while(m <= b){
        res += b / m - ((a - 1) / m);
        m *= p;
    }
    return res;
}

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

    vector<int> prime;
    for(int i = 2; i < maxn; i++){
        if(!mark[i]) prime.pb(i);
        for(auto u: prime){
            if(1ll * u * i > maxn) break;
            mark[u * i] = 1;
        }
    }
    int t; cin >> t;
    while(t--){
        int a, b, c, d; cin >> a >> b >> c >> d;
        bool flag = 1;
        for(auto p: prime){
            int x = get(a, b, p), y = get(c, d, p);
            if(x > y) flag = 0;
        }
        if(flag) cout << "DA\n";
        else cout << "NE\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...