이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// 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;
if(i % u == 0) break;
}
}
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |