QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#225843 | #6547. Banshee | Giga_Cronos# | WA | 518ms | 15708kb | C++23 | 1.5kb | 2023-10-25 10:29:40 | 2023-10-25 10:29:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ld, ld> pdd;
const ld eps = 1e-9;
const ld DAM = 24;
const ld SHOOT_SPD = 0.89;
ll count(vector<pdd> segs, ld t) {
ll ans = 0;
int n = segs.size();
for (int i = n - 1; i >= 0; i--) {
ld act_t = segs[i].first;
ll hp = segs[i].second;
if (!hp)
continue;
ld d = t - act_t;
if (d < SHOOT_SPD)
return 1e18;
ll times = (ll)(d / SHOOT_SPD);
ll tot = times * DAM;
ll cant = (hp - 1) / tot + 1;
ans += cant;
ll rem = cant * tot - hp;
rem = (rem / 24) * 24;
// cout << cant << ' ' << rem << "\n";
int p = i - 1;
while (p >= 0 && rem) {
ll men = min(rem, (ll)segs[p].second);
segs[p].second -= men;
rem -= men;
p--;
}
}
return ans;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.precision(10);
cout << fixed;
int t;
cin >> t;
while (t--) {
ll n, m;
cin >> n >> m;
vector<pdd> segs(n);
for (int i = 0; i < n; i++) {
ll l, r, h, s;
cin >> l >> r >> h >> s;
ld lx = max(0ll, l - 6);
lx /= 5.25;
segs[i] = pdd(lx, h + s);
}
// cout << count(segs, 50) << "\n";
// cout << count(segs, 1) << "\n";
ld l = 0, r = 1e18;
while (r - l > 1e-6) {
ld mid = (l + r) / 2;
// cout << l << ' ' << r << "\n";
// cout.flush();
if (count(segs, mid) <= m)
r = mid;
else
l = mid;
}
cout << l << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3788kb
input:
2 2 1 1 2 1 100 100 500 736 0 3 2 0 1 12 0 1 2 6 6 2 3 3 10
output:
49.9447617218 1.7799992068
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
1 1 1 999999999999 1000000000000 1000000 1000000
output:
190476264642.1171427220
result:
ok found '190476264642.11716', expected '190476264642.11713', error '0.00000'
Test #3:
score: 0
Accepted
time: 192ms
memory: 15692kb
input:
1 200000 1 0 1 969249 972086 1 2 984744 984320 2 3 92755 47817 3 4 949336 988466 4 5 900430 587028 5 6 971159 502802 6 7 41633 978208 7 8 461354 662596 8 9 363071 263510 9 10 38887 360926 10 11 332384 508699 11 12 106353 110896 12 13 164201 615535 13 14 934900 317571 14 15 566503 490603 15 16 84381 ...
output:
7435901358.0647615283
result:
ok found '7435901358.06476', expected '7435986579.12476', error '0.00001'
Test #4:
score: 0
Accepted
time: 197ms
memory: 15688kb
input:
1 200000 333978112 0 1 992356 930126 1 2 176090 530440 2 3 737831 296956 3 4 506537 237481 4 5 707964 79385 5 6 924758 542461 6 7 105732 39650 7 8 873923 3276 8 9 32864 264522 9 10 395587 86623 10 11 350514 927988 11 12 525625 954467 12 13 244408 909598 13 14 560147 647280 14 15 242630 237857 15 16 ...
output:
38094.7947614194
result:
ok found '38094.79476', expected '38094.79476', error '0.00000'
Test #5:
score: 0
Accepted
time: 204ms
memory: 15708kb
input:
1 200000 1000000000 0 1 945997 933305 1 2 5390 151804 2 3 128320 798645 3 4 701383 107391 4 5 937129 989695 5 6 200579 678099 6 7 26621 111037 7 8 787156 534916 8 9 690049 664552 9 10 986545 948890 10 11 282743 37920 11 12 92545 205330 12 13 746804 959767 13 14 390635 119950 14 15 553450 693187 15 1...
output:
38094.7947614194
result:
ok found '38094.79476', expected '38094.79476', error '0.00000'
Test #6:
score: 0
Accepted
time: 518ms
memory: 3556kb
input:
100000 2 4 28797259691 276830799765 72278 33755 754885936393 923475252381 706795 936638 2 3 59508928733 771976493961 16966 42499 806442361566 991034882904 129056 718490 2 2 172750253246 241424267848 229419 649440 245407392377 589992423297 875885 889270 2 2 206097530212 864358471341 25515 147383 9818...
output:
143787813626.4076189697 153608080080.7914282084 46744314239.1738088205 187014532666.0690469742 88639503158.7561902627 133221473842.1276189908 111401799635.8961904496 98383664158.4871426299 159317167805.9238088429 80919772532.8933329731 153439584652.5580952168 147072054798.2457138300 107607022639.528...
result:
ok 100000 numbers
Test #7:
score: 0
Accepted
time: 460ms
memory: 3552kb
input:
100000 2 4 26 41 4 12 49 93 67 31 2 2 16 30 5 6 91 100 15 54 2 2 6 33 36 29 42 81 51 40 2 2 0 10 43 41 12 27 1 1 2 4 43 53 9 4 85 90 30 7 2 4 34 49 4 18 61 80 6 45 2 2 43 69 3 20 79 96 35 6 2 3 8 10 27 3 42 77 54 16 2 4 8 9 13 8 37 62 41 11 2 4 23 27 37 22 38 50 45 2 2 4 27 46 20 6 53 58 27 48 2 3 1...
output:
9.9704761073 17.9704756467 10.4171420576 2.9228567565 15.9376189071 11.3661903626 15.6847613744 8.6371428508 6.7947618181 6.9852375249 10.7323805890 5.6519042684 5.8423808024 3.7471422369 16.0657136152 6.2233330432 9.6519040380 7.8752375419 12.5090470851 3.8128567735 10.6042850537 5.0804754935 4.637...
result:
ok 100000 numbers
Test #8:
score: 0
Accepted
time: 479ms
memory: 3648kb
input:
100000 2 3 63 66 1 0 72 97 331 315 2 2 0 10 482 84 22 90 112 91 2 3 32 50 261 2 67 83 719 181 2 2 12 44 23 10 75 79 413 474 2 2 22 35 421 1 63 97 422 562 2 3 14 24 22 5 37 84 551 305 2 3 9 25 36 1 55 70 374 321 2 2 3 44 373 97 51 85 503 241 2 3 26 50 123 119 79 95 391 332 2 4 26 44 260 632 44 100 38...
output:
21.4714282538 16.3976190088 26.7490473570 30.9428563714 37.5571422691 17.4747611948 19.1233329828 31.7114279288 26.3647615783 24.1480945533 16.5123803927 30.2599997506 16.7819039604 18.2366665037 17.0280944174 21.7899994959 36.6014285427 24.6571423295 17.4647614084 20.9033330168 20.6471427734 26.883...
result:
ok 100000 numbers
Test #9:
score: 0
Accepted
time: 452ms
memory: 3624kb
input:
100000 2 13 69 72 206 156 75 82 119 80 2 30 3 34 307 101 43 62 426 411 2 15 27 30 253 347 50 76 60 388 2 12 16 20 221 51 29 79 173 582 2 17 25 51 3 272 55 58 456 470 2 27 0 43 298 132 67 69 215 529 2 23 30 59 51 563 79 87 363 521 2 29 2 26 36 18 54 78 105 154 2 22 10 19 169 83 57 92 99 412 2 30 1 46...
output:
14.9228568927 8.8276185576 10.1609518142 7.9409520785 12.0033328469 13.3990471021 15.6847613744 10.0328571060 11.4942850707 10.0328571060 9.2085707985 17.2085711650 14.5419046519 2.6699992238 10.1609518142 5.2085710288 10.1609518142 18.6733326675 11.1133328299 12.2038091673 11.3661903626 11.93761831...
result:
ok 100000 numbers
Test #10:
score: 0
Accepted
time: 388ms
memory: 3616kb
input:
66667 3 4 84478696761 215372440520 125248 152596 250810965454 720537889569 668554 998232 828150985733 917337302216 538616 941606 3 3 236183738534 283314823352 801868 737151 341453082312 520548993644 159535 529378 740187497953 870532432850 715530 437783 3 3 175192417072 176862441971 927154 970167 264...
output:
157743063197.8909520507 140988116231.9676187336 106492659239.2852375209 120940620518.9990472198 163160538816.4938089252 188308664413.4428565502 149201625496.7123802006 153551079361.6499994993 106424318255.9561903924 169313137870.3504758179 144256725638.9323807955 147384002511.7276183665 136021413084...
result:
ok 66667 numbers
Test #11:
score: -100
Wrong Answer
time: 329ms
memory: 3652kb
input:
66667 3 4 11 26 62 9 26 33 5 43 77 88 5 18 3 4 1 10 1 3 18 32 16 15 35 46 5 5 3 4 8 45 23 61 50 52 4 0 60 87 6 3 3 2 5 7 1 3 29 49 1 58 54 93 2 20 3 3 7 46 9 23 67 68 1 0 77 79 1 6 3 2 50 57 27 48 61 74 1 2 75 95 27 29 3 4 5 14 19 30 43 45 14 37 50 54 71 21 3 3 42 66 2 43 67 79 24 32 89 99 24 0 3 3 ...
output:
14.4138091166 6.4138087500 11.1757138286 10.0328571060 14.4138091166 15.8128569097 10.1609518142 16.6995233888 12.3842850877 15.7471423731 17.0804756297 15.3661901323 15.8819041570 16.3185711480 18.1609521807 15.6257139135 14.7947613574 12.8899993260 16.8276189241 16.3185711480 15.0509516008 13.0838...
result:
wrong answer 91st numbers differ - expected: '16.89333', found: '16.00333', error = '0.05268'