QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#259540#5593. Food Processoranton_h#WA 0ms4044kbC++201.4kb2023-11-21 00:31:422023-11-21 00:31:43

Judging History

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

  • [2023-11-21 00:31:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4044kb
  • [2023-11-21 00:31:42]
  • 提交

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;})
const ll oo = 0x3f3f3f3f3f3f3f3f;

bool cmp(pll a, pll b){
    if(a.xx == b.xx) return a.yy > b.yy;
    return a.xx < b.xx;
}

bool rcomp(pll a, pll b) {return !cmp(a,b);}

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

    vpll blades(n);

    FOR(i,0,n){
        pll curr; cin >> curr.xx >> curr.yy;
        blades[i] = curr;
    }

    sort(all(blades), cmp);

    vpll par;

    ll max = oo;
    FORD(i,0,n){
        if(blades[i].yy < max) {
            par.pb(blades[i]);
            max = blades[i].yy;
        }
    }

    if(par.front().xx < s){
        cout << "-1\n";
        return 0;
    }

    FOR(j,0,sz(par)) cout << par[j].xx << " " << par[j].yy << " ";
    cout << endl;

    double res=0;
    ll curr = t;
    ll i=sz(par)-1;
    while(par[i].xx < t) i--;

    for(;par[i].xx < s;i--){
        res += log2(par[i].xx/curr) * par[i].yy;
        curr = par[i].xx;
    }

    res += log2(((double) s)/curr)*par[i].yy;
    printf("%.16lf\n", res);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

10 1 2
10 10
4 5

output:

10 10 4 5 
23.2192809488736245

result:

wrong answer 1st numbers differ - expected: '23.21928', found: '10.00000', error = '0.56932'