QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#752941 | #5593. Food Processor | anyan26 | WA | 0ms | 3728kb | C++17 | 1.1kb | 2024-11-16 10:31:59 | 2024-11-16 10:32:00 |
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 = false;
if(mxblade < s){
cout << "-1\n";
return -1;
}
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";
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3728kb
input:
10 1 2 10 10 4 5
output:
-1
result:
wrong answer 1st numbers differ - expected: '23.21928', found: '-1.00000', error = '1.04307'