QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#215039 | #6547. Banshee | ucup-team1766# | WA | 295ms | 9504kb | C++23 | 1.4kb | 2023-10-15 02:34:05 | 2023-10-15 02:34:05 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct building {
long long l;
int t;
};
void run() {
int n, m; cin >> n >> m;
vector<building> b(n);
long long sum = 0;
for (int i = 0; i < n; i++) {
long long x;
int h, s;
cin >> b[i].l >> x >> h >> s;
b[i].l = max(0ll, b[i].l - 6);
b[i].t = (h+s+23)/24;
sum += b[i].t;
}
auto can = [&](long double limit) {
vector<building> b2(b);
long long pos = 0;
int banshees = m;
for (int i = 0; i < n; i++) {
limit -= (b2[i].l - pos) / (long double)5.25;
pos = b2[i].l;
long long damage = limit/.89;
int total = b2[i].t;
int sac = total/damage;
banshees -= sac;
total -= sac*damage;
if (total > 0) {
double limit2 = limit;
long long pos2 = pos;
limit2 -= total*.89;
banshees -= 1;
while (limit2 >= .89) {
i++;
if (i == n) break;
limit2 -= (b2[i].l - pos2) / 5.25;
pos2 = b2[i].l;
damage = min((int)(limit2/.89), b2[i].t);
b2[i].t -= damage;
limit2 -= damage*.89;
}
i--;
}
if (banshees < 0) {
return false;
}
}
return true;
};
double low = b[n-1].l/5.25 + sum*.89/m;
double high = sum*.89 + b[n-1].l/5.25 + 2;
while (high - low >= 1e-4) {
double mid = (low+high)/2;
//cout << low << ' ' << high << endl;
if (can(mid)) {
high = mid;
} else {
low = mid+ 1e-4;
}
}
cout << fixed << setprecision(13) << low << '\n';
}
int main() {
int t; cin >> t;
while (t--) run();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3760kb
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.9447619047619 1.7800403259277
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 4020kb
input:
1 1 1 999999999999 1000000000000 1000000 1000000
output:
190476264642.1171569824219
result:
ok found '190476264642.11716', expected '190476264642.11713', error '0.00000'
Test #3:
score: 0
Accepted
time: 178ms
memory: 9428kb
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:
7435986579.1247625350952
result:
ok found '7435986579.12476', expected '7435986579.12476', error '0.00000'
Test #4:
score: -100
Wrong Answer
time: 295ms
memory: 9504kb
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:
38116.1194174167395
result:
wrong answer 1st numbers differ - expected: '38094.79476', found: '38116.11942', error = '0.00056'