Submission #929045

# Submission time Handle Problem Language Result Execution time Memory
929045 2024-02-17T14:39:39 Z a_l_i_r_e_z_a Vepar (COCI21_vepar) C++17
30 / 70
194 ms 16228 KB
// 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 time Memory Grader output
1 Correct 69 ms 14776 KB Output is correct
2 Correct 70 ms 15048 KB Output is correct
3 Correct 65 ms 15308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 65 ms 16224 KB Output is correct
2 Correct 70 ms 14892 KB Output is correct
3 Correct 72 ms 15048 KB Output is correct
4 Correct 66 ms 14924 KB Output is correct
5 Correct 67 ms 15052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 65 ms 16112 KB Output is correct
2 Correct 65 ms 15048 KB Output is correct
3 Correct 71 ms 16228 KB Output is correct
4 Correct 72 ms 14976 KB Output is correct
5 Correct 71 ms 15056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 16040 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 193 ms 15564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 190 ms 14524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 194 ms 14384 KB Output isn't correct
2 Halted 0 ms 0 KB -