QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#752941#5593. Food Processoranyan26WA 0ms3728kbC++171.1kb2024-11-16 10:31:592024-11-16 10:32:00

Judging History

你现在查看的是最新测评结果

  • [2024-11-16 10:32:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3728kb
  • [2024-11-16 10:31:59]
  • 提交

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'