QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#259542#5593. Food Processoranton_h#WA 11ms6720kbC++201.3kb2023-11-21 00:32:422023-11-21 00:32:42

Judging History

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

  • [2023-11-21 00:32:42]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:6720kb
  • [2023-11-21 00:32: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;
    }

    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: 100
Accepted
time: 0ms
memory: 4044kb

input:

10 1 2
10 10
4 5

output:

23.2192809488736245

result:

ok found '23.21928', expected '23.21928', error '0.00000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3964kb

input:

10000 9999 1
10000 1

output:

0.0001442767180449

result:

ok found '0.00014', expected '0.00014', error '0.00000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3784kb

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: 4048kb

input:

8 2 1
8 10

output:

20.0000000000000000

result:

ok found '20.00000', expected '20.00000', error '0.00000'

Test #5:

score: -100
Wrong Answer
time: 11ms
memory: 6720kb

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:

67.6463034929413141

result:

wrong answer 1st numbers differ - expected: '1442798.05088', found: '67.64630', error = '0.99995'