#include <bits/stdc++.h>
using namespace std;
int main() {
int S, Q; cin >> S >> Q;
for (int i = 0; i < Q; i++) {
long long ch, fh, cg, fg;
cin >> ch >> fh >> cg >> fg;
auto usehack = [&](){
if (ch > fg*S) cg -= ch-fg*S;
else fg--;
};
auto useserv = [&]() {
if (cg > fh*S) ch -= cg-fh*S;
else fh--;
};
bool b = 0;
while (ch > 0 && cg > 0) {
usehack();
if (cg <= 0) b = 1;
useserv();
}
cout << (b ? "YES" : "NO") << "\n";
}
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |