QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#259389#5593. Food Processoranton_h#WA 0ms4088kbC++201.2kb2023-11-20 21:29:572023-11-20 21:29:57

Judging History

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

  • [2023-11-20 21:29:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4088kb
  • [2023-11-20 21:29:57]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll=long long;
using vl = vector<ll>;
#define sz(c) = ll((c).size());
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)

#define all(c) begin(c),end(c)
#define pb push_back
#define FORD(i,a,b) for(ll i=(b)-1;i>=(a);i--)
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vpll = vector<pll>;
#define xx first
#define yy second
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl;})

int main() { cin.sync_with_stdio(0); cin.tie(0);
    ll s,t; ll n; cin >> s >> t >> n;

    set<pll> blades;

    FOR(i,0,n){
        pll curr; cin >> curr.xx >> curr.yy;
        auto big = blades.upper_bound(curr);
        if(big != blades.end() && big->yy <= curr.yy) continue;

        auto from = big;
        for(;from != blades.begin() && prev(from)->yy > curr.yy;from--);
        blades.erase(from, big);
        blades.insert(curr);
    }

    if(prev(blades.end())->xx < s){
        cout << "-1\n";
        return 0;
    }

    double curr = t, res=0;
    auto blade = blades.upper_bound({t,0});
    for(;curr < s; blade++){
        res += log2(blade->xx/curr)*blade->yy;
        curr = blade->xx;
    }
    if(curr != s) res += log2(s/curr)*blade->yy;
    printf("%lf.16\n", res);
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 4088kb

input:

10 1 2
10 10
4 5

output:

23.219281.16

result:

wrong output format Expected double, but "23.219281.16" found