Submission #1185469

#TimeUsernameProblemLanguageResultExecution timeMemory
118546929ChuManhTichVepar (COCI21_vepar)C++20
70 / 70
160 ms43804 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)

Main.cpp: In function 'int main()':
Main.cpp:60:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |         freopen(NAME".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:61:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   61 |         freopen(NAME".OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...