QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#138424 | #4355. Seesaw | Antekb# | 0 | 1ms | 3868kb | C++14 | 932b | 2023-08-11 18:15:22 | 2024-07-04 01:36:59 |
answer
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define eb emplace_back
#define pp pop_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
using namespace std;
using vi = vector<int>;
using pii = pair<int, int>;
using vii = vector<pii>;
using ll = long long;
using ld = long double;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int main(){
int n;
cin>>n;
vector<ll> V(n+1);
for(int i=1; i<=n; i++){
cin>>V[i];
V[i]+=V[i-1];
}
priority_queue<pair<ld, pii> > Q;
ld ans=1e9;
for(int i=1; i<=n; i++){
Q.push(mp(-V[i]/ld(i), mp(1, i)));
}
ld m=V[n]/ld(n);
while(true){
auto t=Q.top();
ans=min(ans, m+t.st);
Q.pop();
if(t.nd.nd==n)break;
int l=t.nd.st, r=t.nd.nd;
Q.push(mp((V[l-1]-V[r])/ld(r-l+1), mp(l+1, r+1)));
m=max(m, (V[r]-V[l-1])/ld(r-l+1));
}
cout<<fixed<<setprecision(10)<<ans;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 1
Accepted
time: 1ms
memory: 3868kb
input:
2 925278587 966813970
output:
20767691.5000000000
result:
ok found '20767691.500000000', expected '20767691.500000000', error '0.000000000'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3812kb
input:
20 7902238 121690240 160345001 255257832 269315023 288280211 296247186 353929891 494812700 530994847 567379029 567478415 612943598 644028258 654380821 696407711 708542915 738196686 743020754 760907139
output:
54422017.9210526316
result:
wrong answer 1st numbers differ - expected: '52991294.1666667', found: '54422017.9210526', error = '0.0269992'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%