이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define PB push_back
using namespace std;
typedef long long ll;
const int MX = int(1e7) + 10;
const int oo = 2e9;
vector<int> prms;
int mn[MX];
int get_cnt(int l, int r, int cr){
ll po = cr;
int res = 0;
while (po <= r){
res += (r / po) - ((l - 1) / po);
po *= cr;
}
return res;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
fill(mn, mn + MX, oo);
for (int i = 2; i < MX; i++){
if (mn[i] < oo) continue;
mn[i] = i;
prms.PB(i);
if (ll(i) * ll(i) > MX) continue;
for (int j = i * i; j < MX; j += i)
mn[j] = min(mn[j], i);
}
int qq; cin >> qq;
for (; qq; qq--){
int a, b, c, d;
cin >> a >> b >> c >> d;
bool ok = 1;
for (int cr : prms){
int fi = get_cnt(a, b, cr);
int se = get_cnt(c, d, cr);
if (fi > se){
ok = 0;
break;
}
}
cout << (ok ? "DA\n" : "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... |