QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#259389 | #5593. Food Processor | anton_h# | WA | 0ms | 4088kb | C++20 | 1.2kb | 2023-11-20 21:29:57 | 2023-11-20 21:29:57 |
Judging History
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