// 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 |
1 |
Correct |
93 ms |
14540 KB |
Output is correct |
2 |
Correct |
93 ms |
14796 KB |
Output is correct |
3 |
Correct |
92 ms |
15052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
100 ms |
15816 KB |
Output is correct |
2 |
Correct |
93 ms |
16012 KB |
Output is correct |
3 |
Correct |
94 ms |
15644 KB |
Output is correct |
4 |
Correct |
93 ms |
15072 KB |
Output is correct |
5 |
Correct |
101 ms |
15560 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
14792 KB |
Output is correct |
2 |
Correct |
94 ms |
15052 KB |
Output is correct |
3 |
Correct |
97 ms |
16280 KB |
Output is correct |
4 |
Correct |
107 ms |
15480 KB |
Output is correct |
5 |
Correct |
96 ms |
15856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
151 ms |
15556 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
220 ms |
15216 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
220 ms |
14824 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
221 ms |
15308 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |