This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <unordered_map>
#include <iostream>
using namespace std;
#define F first
#define S second
unordered_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();
}
# | 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... |