QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#572736 | #8242. V-Diagram | ranxi | WA | 83ms | 3840kb | C++14 | 1006b | 2024-09-18 16:10:22 | 2024-09-18 16:10:23 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define alls(x) x.begin(),x.end()
#define ull unsigned long long
#define lowbit(x) x&-x
#define lc p<<1
#define rc p<<1|1
#define PII pair<int,int>
#define vi vector<int>
using namespace std;
const int mod = 998244353;
const int N = 2e5+10;
void solve()
{
int n;
cin >> n;
vi a(n);
for(auto &i:a)cin >> i;
long double sum = 0;
for(auto i:a)sum+=i;
sum/=n;
int x = 0;
for(int i = 0;i<n;i++)
{
if(a[i]>a[i-1] && a[i]<a[i+1]) {
x = i;
break;
}
}
long double ans = sum;
sum = 0;
for(int i = 0;i<=x+1;i++)sum+=a[i];
ans = max(ans,sum/(x+2));
sum = 0;
for(int i = x-1;i<n;i++)sum+=a[i];
ans = max(ans,sum/(n-x+1));
cout<<ans<<'\n';
}
signed main()
{
cout<<fixed<<setprecision(20);
ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
int _ = 1;
cin >> _;
while(_--)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3784kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
6.75000000000000000000 5.83333333333333333348
result:
ok 2 numbers
Test #2:
score: -100
Wrong Answer
time: 83ms
memory: 3840kb
input:
100000 3 948511478 739365502 813471668 3 881046825 27458122 398507422 3 987554257 399092415 924260278 3 984128569 125199021 716360525 3 529589236 45783262 313507287 3 645443456 85994112 226010681 3 914820717 228360911 572267310 3 418958362 56703604 195276041 3 64461646 26764720 26995581 3 914535039 ...
output:
843938490.00000000000000000000 454252473.50000000000000000000 770302316.66666666668606922030 608562705.00000000000000000000 296293261.66666666665696538985 365718784.00000000000000000000 571816312.66666666668606922030 237830983.00000000000000000000 45613183.00000000000000000000 474479951.500000000000...
result:
wrong answer 1st numbers differ - expected: '833782882.6666666', found: '843938490.0000000', error = '0.0121802'