QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#731415 | #5593. Food Processor | beamishboys# | WA | 39ms | 4612kb | C++14 | 1.0kb | 2024-11-10 03:32:42 | 2024-11-10 03:32:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ld TWO = 2.0;
signed main() {
ll cur_size, target_size, n;
cin >> cur_size >> target_size >> n;
vector<pair<ll, ll>> blades(n); // Avg Size Req, Time
for (ll i = 0; i < n; i++) {
cin >> blades[i].first >> blades[i].second;
}
sort(blades.begin(), blades.end());
reverse(blades.begin(), blades.end());
ll T = 1e9;
ll i = 0;
for (; i < n && cur_size <= blades[i].first; i++) {
T = min(T, blades[i].second);
}
if (i == 0) {
cout << -1 << "\n";
return 0;
}
ld ans = 0.0;
for (; i < n && blades[i].first > target_size; i++) {
ld t = ((log((ld)cur_size) - log((ld)blades[i].first)) / log(TWO)) * ((ld)T);
ans += t;
cur_size = blades[i].first;
for (; i < n && cur_size <= blades[i].first; i++) {
T = min(T, blades[i].second);
}
}
ld t = ((log((ld)cur_size) - log((ld)target_size)) / log(TWO)) * ((ld)T);
ans += t;
cout << setprecision(20);
cout << ans << endl;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3844kb
input:
10 1 2 10 10 4 5
output:
23.219280948873623479
result:
ok found '23.21928', expected '23.21928', error '0.00000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
10000 9999 1 10000 1
output:
0.00014427671804503554642
result:
ok found '0.00014', expected '0.00014', error '0.00000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
10 1 2 8 10 4 5
output:
-1
result:
ok found '-1.00000', expected '-1.00000', error '-0.00000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
8 2 1 8 10
output:
20
result:
ok found '20.00000', expected '20.00000', error '0.00000'
Test #5:
score: -100
Wrong Answer
time: 39ms
memory: 4612kb
input:
1000000 1 100000 10 10 20 20 30 30 40 40 50 50 60 60 70 70 80 80 90 90 100 100 110 110 120 120 130 130 140 140 150 150 160 160 170 170 180 180 190 190 200 200 210 210 220 220 230 230 240 240 250 250 260 260 270 270 280 280 290 290 300 300 310 310 320 320 330 330 340 340 350 350 360 360 370 370 380 3...
output:
1442884.3564544313406
result:
wrong answer 1st numbers differ - expected: '1442798.05088', found: '1442884.35645', error = '0.00006'