QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#752945 | #5593. Food Processor | anyan26 | WA | 24ms | 5604kb | C++17 | 1.0kb | 2024-11-16 10:33:38 | 2024-11-16 10:33:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
double nxt(double size, double want, double div2){
return (log2(size) - log2(want)) * (double)div2;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//sort by t
double s, t;int n; cin >> s >> t >> n;
pair<double, double> process[n];
double mxblade = 0;
for(int i = 0; i < n; i++){ //hour, blade size
cin >> process[i].second >> process[i].first;
mxblade = max(mxblade, process[i].second);
}
sort(process, process+n);
int cur = n;
bool can = true;
if(mxblade < s){
can = false;
}
double ret = 0;
while (s > t && can){
while(cur > 0 && process[cur-1].second >= s)cur--;
can = true;
int goal = t;
if(cur != 0)goal = process[cur-1].second;
ret += nxt(s, goal, process[cur].first);
s = goal;
}
if(can)cout << fixed << setprecision(10) << ret << "\n";
else cout << -1 << "\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3980kb
input:
10 1 2 10 10 4 5
output:
23.2192809489
result:
ok found '23.21928', expected '23.21928', error '0.00000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
10000 9999 1 10000 1
output:
0.0001442767
result:
ok found '0.00014', expected '0.00014', error '0.00000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3712kb
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: 3748kb
input:
8 2 1 8 10
output:
20.0000000000
result:
ok found '20.00000', expected '20.00000', error '0.00000'
Test #5:
score: 0
Accepted
time: 24ms
memory: 5604kb
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:
1442798.0508796421
result:
ok found '1442798.05088', expected '1442798.05088', error '0.00000'
Test #6:
score: -100
Wrong Answer
time: 22ms
memory: 5472kb
input:
1000000 1 100000 1000000 10 999990 20 999980 30 999970 40 999960 50 999950 60 999940 70 999930 80 999920 90 999910 100 999900 110 999890 120 999880 130 999870 140 999860 150 999850 160 999840 170 999830 180 999820 190 999810 200 999800 210 999790 220 999780 230 999770 240 999760 250 999750 260 99974...
output:
33.2192809489
result:
wrong answer 1st numbers differ - expected: '199.31569', found: '33.21928', error = '0.83333'