Search for a command to run...
Progressive hints first, then the full explanation and implementation when you're ready to cash out.
Review status
AI-generated and still unreviewed. Double-check the details before internalizing them.
Hints
Open only as much as you need to keep the solve alive.
Because both and the desired are multiples of , try factoring out completely. The actual size of is mostly a distraction.
Write and . Then becomes .
The divisibility condition also simplifies: is equivalent to . So we need some with such that .
For , look at the largest possible choice: . Does divide ?
If , there is no multiple of strictly between them, so answer is NO. Otherwise works, because .
Since is divisible by , write
where is an integer and .
Any valid must also be divisible by , so it has the form
for some integer .
Now translate the conditions:
So the problem is now hilariously small:
Does there exist an integer such that and ?
If , then there is no integer with
So the answer is definitely NO.
If , choose
Then is valid because
Also, does not divide , since
so the remainder is .
Returning to the original numbers, this choice corresponds to
For , this satisfies , and
So it works. Clean. Almost suspiciously clean, but that's the whole problem.
Since :
Otherwise, answer is NO.
Each test case is solved with one division and one comparison.
Total complexity:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void setIO() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
setIO();
int t;
cin >> t;
while (t--) {
ll x, y;
cin >> x >> y;
ll k = y / x;
cout << (k > 2 ? "YES" : "NO") << '\n';
}
return 0;
}#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void setIO() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
setIO();
int t;
cin >> t;
while (t--) {
ll x, y;
cin >> x >> y;
ll k = y / x;
cout << (k > 2 ? "YES" : "NO") << '\n';
}
return 0;
}