QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#465929 | #7277. Bring Down the | shiomusubi496 | 10 | 392ms | 3692kb | C++14 | 1.1kb | 2024-07-07 13:52:07 | 2024-07-07 13:52:10 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)
#define all(v) begin(v), end(v)
using namespace std;
using ll = long long;
template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; }
template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; }
int main() {
ll S; cin >> S;
int Q; cin >> Q;
rep (_, Q) {
ll cH, fH, cG, fG; cin >> cH >> fH >> cG >> fG;
swap(fH, fG);
cH -= fH * S;
cG -= fG * S;
if (cH <= 0 || cG <= 0) {
if (cH >= cG) puts("YES");
else puts("NO");
continue;
}
while (cH && cG) {
cG = max(cG - cH, 0ll);
cH = max(cH - cG, 0ll);
}
if (cH) puts("YES");
else puts("NO");
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 0ms
memory: 3556kb
input:
17 2 42 1 33 1 42 1 33 7
output:
YES NO
result:
ok 2 token(s): yes count is 1, no count is 1
Test #2:
score: -5
Wrong Answer
time: 169ms
memory: 3560kb
input:
2 250000 75 16 56 55 50 9 49 60 18 67 62 5 30 54 61 39 22 39 42 31 26 30 55 1 23 30 53 16 55 13 6 44 69 8 58 72 53 7 60 12 29 14 26 34 37 64 24 71 19 3 40 1 64 13 33 65 67 24 68 3 64 17 50 66 71 6 62 13 15 29 26 24 51 30 34 45 46 5 40 72 54 52 60 49 35 21 18 30 39 31 35 34 30 74 72 5 74 12 6 15 11 4...
output:
NO NO YES NO NO YES NO NO NO YES NO NO NO NO YES NO YES NO NO NO YES NO NO YES YES NO YES YES NO YES YES NO NO YES NO NO YES NO YES NO NO NO NO YES YES YES YES NO YES NO YES NO YES YES YES YES YES NO NO NO YES NO NO NO YES YES NO YES NO YES NO YES NO YES YES NO YES YES YES NO YES NO NO NO NO NO NO Y...
result:
wrong answer expected YES, found NO [4th token]
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 10
Accepted
Test #28:
score: 10
Accepted
time: 392ms
memory: 3528kb
input:
1 250000 554333015044 833858497873 833858497874 554333015044 655160857180 306396306924 306396306917 655160857187 374728598365 176680698490 176680698490 374728598365 764650258714 835600427315 835600427309 764650258720 521594231110 318048536486 318048536482 521594231115 273627794040 449769302710 10899...
output:
NO YES YES YES NO NO NO NO NO NO YES YES YES YES YES NO NO NO YES YES YES YES YES NO YES NO NO YES YES YES NO NO YES YES YES YES NO NO YES YES YES NO NO YES NO YES YES YES NO YES NO NO NO YES NO NO NO YES NO NO NO YES YES YES YES YES NO YES NO YES YES NO NO NO YES NO YES NO NO NO YES YES NO NO YES N...
result:
ok 250000 token(s): yes count is 126293, no count is 123707
Test #29:
score: 0
Accepted
time: 351ms
memory: 3608kb
input:
1 250000 129596328651 633211431893 1 762807760544 1 983509496641 151077576062 229908055916 36498040145 186033440917 1 995620003790 247250323075 720548396611 720548396605 247250323082 464252981836 491098062545 12027035640 943324008741 719683599156 92798217394 1 812481816550 317330065824 621406415744 ...
output:
NO YES NO NO YES NO YES NO NO NO NO NO NO YES YES NO NO YES YES YES NO YES YES NO NO YES YES NO NO YES YES NO YES NO YES NO NO YES YES YES NO YES YES NO YES NO YES YES YES YES NO NO YES YES YES NO NO YES YES NO YES YES NO YES NO YES YES YES NO NO YES NO YES NO NO YES YES YES NO NO NO NO YES YES NO N...
result:
ok 250000 token(s): yes count is 143356, no count is 106644
Test #30:
score: 0
Accepted
time: 348ms
memory: 3608kb
input:
1 250000 807680045522 377273608557 256372130241 928581523838 536035116725 716237980103 379308294473 872964802356 1 882064014033 529720193901 352343820133 80961796479 258174541326 183165451143 155970886662 739448494904 100650373373 75082626963 765016241315 166426307909 865864146065 703399919607 32889...
output:
YES NO YES YES NO NO NO NO YES YES NO YES YES NO NO NO NO YES YES NO YES NO YES NO NO YES NO YES NO NO YES NO NO NO NO NO NO NO YES NO YES YES YES NO NO NO NO NO YES YES YES YES NO YES NO YES YES NO NO YES NO YES NO NO YES NO YES YES YES NO NO NO YES NO NO YES YES YES NO NO YES YES YES YES NO NO NO ...
result:
ok 250000 token(s): yes count is 132783, no count is 117217
Test #31:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
1 1 999999999999 999999999999 999999999999 999999999999
output:
YES
result:
ok YES
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Wrong Answer
Dependency #3:
100%
Accepted
Test #60:
score: 20
Accepted
time: 368ms
memory: 3680kb
input:
1 250000 554333015044 833858497873 833858497874 554333015044 655160857180 306396306924 306396306917 655160857187 374728598365 176680698490 176680698490 374728598365 764650258714 835600427315 835600427309 764650258720 521594231110 318048536486 318048536482 521594231115 273627794040 449769302710 10899...
output:
NO YES YES YES NO NO NO NO NO NO YES YES YES YES YES NO NO NO YES YES YES YES YES NO YES NO NO YES YES YES NO NO YES YES YES YES NO NO YES YES YES NO NO YES NO YES YES YES NO YES NO NO NO YES NO NO NO YES NO NO NO YES YES YES YES YES NO YES NO YES YES NO NO NO YES NO YES NO NO NO YES YES NO NO YES N...
result:
ok 250000 token(s): yes count is 126293, no count is 123707
Test #61:
score: -20
Wrong Answer
time: 167ms
memory: 3692kb
input:
33 250000 42 63 17 64 48 31 9 35 46 64 75 15 42 14 16 17 3 37 49 15 70 39 16 43 52 2 8 8 12 12 57 9 36 42 75 1 9 60 30 58 47 71 75 69 75 7 3 30 45 51 24 52 14 15 2 25 55 35 2 53 68 32 31 34 69 43 56 45 44 68 75 57 29 36 2 55 56 61 5 71 36 55 75 21 38 73 75 69 61 72 75 24 67 10 74 10 48 28 28 30 47 6...
output:
NO NO YES NO YES NO NO YES YES YES YES NO NO NO NO NO NO YES NO NO YES YES YES NO NO NO NO NO YES YES YES NO YES YES NO NO NO YES NO NO NO NO NO NO NO NO NO YES NO NO NO NO NO NO NO NO NO YES NO NO NO NO YES YES YES NO NO NO NO NO NO NO NO NO NO NO YES NO NO NO NO NO NO YES NO NO YES YES YES YES YES...
result:
wrong answer expected YES, found NO [1st token]
Subtask #6:
score: 0
Skipped
Dependency #1:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%