QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#737393 | #8242. V-Diagram | KiritoXD | WA | 170ms | 3820kb | C++20 | 910b | 2024-11-12 15:42:01 | 2024-11-12 15:42:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ls now<<1
#define rs now<<1|1
#define endl "\n"
#define lowbit(x) ((x)&(-x))
typedef long long ll;
const int N=3e5+7, mod=1e9+7;
int sum[N],a[N];
void solve(){
int n;
cin>>n;
double ans1,ans2,ans3;
int mn=1e9+10;
int p=0;
double sum1=0,sum2=0,sum3=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
sum1+=a[i];
if(a[i]<mn)
{
p=i;
mn=a[i];
}
}
ans1=sum1/n;
for(int i=1;i<=p;i++)
{
sum2+=a[i];
}
ans2=sum2/p;
for(int i=p;i<=n;i++)
{
sum3+=a[i];
}
ans3=sum3/(n-p+1);
double ans=max(ans1,max(ans2,ans3));
printf("%.9lf\n",ans);
}
int main(){
// ios::sync_with_stdio(0);
// cin.tie(0);cout.tie(0);
int t=1;
cin>>t;
while(t--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3820kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
6.750000000 5.833333333
result:
ok 2 numbers
Test #2:
score: -100
Wrong Answer
time: 170ms
memory: 3816kb
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.000000000 454252473.500000000 770302316.666666627 608562705.000000000 296293261.666666687 365718784.000000000 571816312.666666627 237830983.000000000 45613183.000000000 474479951.500000000 742247812.000000000 779975824.333333373 503399231.500000000 645879534.500000000 432761815.000000000 6...
result:
wrong answer 1st numbers differ - expected: '833782882.6666666', found: '843938490.0000000', error = '0.0121802'