QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#364269 | #8242. V-Diagram | zhouyuheng | WA | 0ms | 3924kb | C++14 | 1.2kb | 2024-03-24 13:22:56 | 2024-03-24 13:22:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
typedef pair<int,int> pii;
template <typename T> inline T gcd(const T a,const T b){if(b==0)return a;return gcd(b,a%b);}
template <typename T> inline void read(T&x)
{
char cu=getchar();x=0;bool fla=0;
while(!isdigit(cu)){if(cu=='-')fla=1;cu=getchar();}
while(isdigit(cu))x=x*10+cu-'0',cu=getchar();
if(fla)x=-x;
}
template <typename T> void printe(const T x)
{
if(x>=10)printe(x/10);
putchar(x%10+'0');
}
template <typename T> inline void print(const T x)
{
if(x<0)putchar('-'),printe(-x);
else printe(x);
}
const ll mod=998244353;
inline ll Pow(ll x,ll y)
{
ll res=1;//x%=mod
for(;y;y>>=1,x=x*x%mod)if(y&1)res=(res*x)%mod;
return res;
}
int T,n,a[300005],sum,cnt;
double ans;
int main(){
read(T);
while(T--){
read(n);
sum=0;
for(int i=1;i<=n;i++)read(a[i]),sum+=a[i];
ans=1.0*sum/n;
cnt=0;
for(int i=1;i<=n;i++){
if(a[i+1]<a[i+2])break;
cnt+=a[i];
ans=max(ans,1.0*(sum-cnt)/(n-i));
}
cnt=0;
for(int i=n;i>=1;i--){
if(a[i-1]<a[i-2])break;
cnt+=a[i];
ans=max(ans,1.0*(sum-cnt)/(i-1));
}
printf("%lf\n",ans);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3924kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
6.750000 5.833333
result:
wrong answer 2nd numbers differ - expected: '5.8333333', found: '5.8333330', error = '0.0000001'