Submission #497959

# Submission time Handle Problem Language Result Execution time Memory
497959 2021-12-24T06:19:46 Z dannyboy20031204 Vepar (COCI21_vepar) C++17
10 / 70
1 ms 204 KB
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define fi first
#define se second
#define mp make_pair 
using namespace std;
void db() {cout << endl;}
template <typename T, typename ...U> void db(T a, U ...b) {
    //return;
    cout << a << ' ', db(b...);
}
#ifdef Cloud
#define file freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#else
#define file ios::sync_with_stdio(false); cin.tie(0)
#endif
const int inf = 1e9 + 1, N = 1e3 + 1, mod = 1e9 + 7;
vector<int> p;
int cnt(int l, int r, int x){
    return r / x - (l - 1) / x;
}
void solve(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    for (int i : p){
        if (i > d) break;
        ll x = i, pre1 = 0, pre2 = 0, pw = 1, sum = 0;
        while (x * i <= N) x *= i, pw++;
        for (ll j = x; j > 1; j /= i){
            sum += pw * (cnt(c, d, j) - pre1);
            pre1 = cnt(c, d, j);
            sum -= pw * (cnt(a, b, j) - pre2);
            pre2 = cnt(a, b, j);
            pw--;
        }
        if (sum < 0) return void(cout << "NE\n");
    }
    cout << "DA\n";
}
signed main(){
    file;
    bool out[N]{};
    for (int i = 2; i < N; i++){
        if (!out[i]) p.push_back(i);
        for (int j : p){
            if (j * i >= N) break;
            out[j * i] = 1;
        }
    }
    int t;
    cin >> t;
    while (t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -