#include <map>
#include <iostream>
using namespace std;
#define F first
#define S second
map<int, int> ab, cd;
inline void factorize(int i, bool b) {
for(int j=2; j<=i; j++) {
while(i%j==0) {
if(b) ab[j]++;
else cd[j]++;
i/=j;
}
}
}
inline void solve() {
int a,b,c,d;
cin >> a >> b >> c >> d;
for(int i=a; i<=b; i++) factorize(i, true);
for(int i=c; i<=d; i++) factorize(i, false);
for(auto x:ab) {
if(cd[x.F]<x.S) {
cout << "NE\n";
ab.clear();
cd.clear();
return;
}
}
ab.clear();
cd.clear();
cout << "DA\n";
}
int main() {
cin.tie(NULL)->sync_with_stdio(false);
int t;
cin >> t;
while(t--) solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
348 KB |
Output is correct |
3 |
Correct |
4 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
348 KB |
Output is correct |
2 |
Correct |
4 ms |
604 KB |
Output is correct |
3 |
Correct |
5 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1563 ms |
852 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1522 ms |
884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1553 ms |
720 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1545 ms |
880 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |