QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#746601 | #5593. Food Processor | i24 | WA | 0ms | 3988kb | C++14 | 1.3kb | 2024-11-14 15:04:48 | 2024-11-14 15:04:54 |
Judging History
answer
// File generated on 24/11/13 22:42 by Anand
#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(false); cin.tie(0)
#define rep(i, m, n) for (long long i = m; i < n; i++)
#define DEBUG(x) cout << "debug: " << x << "\n"
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define pb push_back
#define sz size
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vec;
typedef vector<vec> vecc;
typedef vector<pll> vecp;
void SOLVE() {
ll s, t, n;
cin >> s >> t >> n;
vecp a(n);
rep(i,0,n) {
ll x, y;
cin >> x >> y;
a[i] = {-x, y};
}
sort(a.begin(), a.end());
ll mi = 1e7 + 5;
vecp g;
rep(i,0,n) {
if (mi > a[i].second) {mi = a[i].second; g.pb({-a[i].first, mi});}
}
long double ans = 0;
g.pb({0, 0});
n = g.size();
rep(i,0,n) {
if (i + 1 < n && s <= g[i + 1].first) continue;
if (i + 1 < n && t >= g[i + 1].first) {ans += g[i].second * (log2(s) - log2(t)); s = t; break;}
if (i + 1 < n) {ans += g[i].second * (log2(s) - log2(g[i+1].first)); s = g[i + 1].first;}
else {cout << "-1\n"; return;}
}
cout << setprecision(8) << ans << "\n";
}
signed main() {
fastio;
SOLVE();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3820kb
input:
10 1 2 10 10 4 5
output:
23.219281
result:
ok found '23.21928', expected '23.21928', error '0.00000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
10000 9999 1 10000 1
output:
0.00014427672
result:
ok found '0.00014', expected '0.00014', error '0.00000'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3876kb
input:
10 1 2 8 10 4 5
output:
23.219281
result:
wrong answer 1st numbers differ - expected: '-1.00000', found: '23.21928', error = '24.21928'