#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios_base :: sync_with_stdio(false); cin.tie(NULL);
ll S, Q;
cin >> S >> Q;
for (ll i=0; i<Q; i++) {
ll c1, f1, c2, f2;
cin >> c1 >> f1 >> c2 >> f2;
ll turn = 1;
while (true) {
if (turn == 1) {
if (f2 * S + c2 <= c1) {
cout << "YES\n";
break;
}
if (f2 && c1 - f2*S < S) {
f2 --;
}
else {
c2 -= (c1 - f2 * S);
}
}
else {
if (f1 * S + c1 <= c2) {
cout << "NO\n";
break;
}
if (f1 && c2 - f1*S < S) {
f1 --;
}
else {
c1 -= (c2 - f1 * S);
}
}
turn = 3 - turn;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
4094 ms |
348 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
56 ms |
1240 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
56 ms |
1240 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4054 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
56 ms |
1240 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
56 ms |
1240 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
56 ms |
1240 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
56 ms |
1240 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |