#include <bits/stdc++.h>
using namespace std;
int main()
{
int S, Q;
cin >> S >> Q;
for (int i = 0; i < Q; i++)
{
int PowH, PowG, BlockH, BlockG;
cin >> PowH >> BlockG >> PowG >> BlockH;
int A = max(0, PowG - S * BlockG), B = max(0, PowH - S * BlockH);
int turn = 1;
while (PowH > 0 && PowG > 0)
{
if (turn)
{
if (A >= S || B >= S)
{
A = max(0, A - B);
PowG -= B;
}
else
{
BlockH--;
B = max(0, PowH - S * BlockH);
}
}
else
{
if (A >= S || B >= S)
{
B = max(0, B - A);
PowH -= A;
}
else
{
BlockG--;
A = max(0, PowG - S * BlockG);
}
}
turn = 1 - turn;
}
if (PowG < 1)
cout << "YES" << '\n';
else
cout << "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... |