QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#332413#8242. V-DiagramdownfallWA 0ms3820kbC++17976b2024-02-19 15:22:412024-02-19 15:22:42

Judging History

你现在查看的是最新测评结果

  • [2024-02-19 15:22:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3820kb
  • [2024-02-19 15:22:41]
  • 提交

answer

#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define endl "\n"
#define eb emplace_back
#define int long long
using namespace std;
using ll=long long;
const int N=1e5+3;
int a[N];
void solve()
{
    int n; cin>>n;
    rep(i,1,n) cin>>a[i];
    int sum = 0;
    double ans = 0;
    int pos = 0;
    rep(i,2,n) if(a[i - 1] < a[i]) {pos = i;break;}
    
    rep(i,1,n) sum += a[i];
    ans = max(ans , sum * 1.0 / n);

    sum = 0;
    rep(i,1,pos + 1) sum += a[i];
    ans = max(ans , sum * 1.0 / (pos + 1));

    sum = 0;
    rep(i,pos - 1 ,n) sum += a[i];
    ans = max(ans , sum * 1.0 / (n - pos + 2));

    cout<<pos<<endl;
    cout<<fixed<<setprecision(20)<<ans<<endl;
}
signed main(){IOS;int T=1;cin>>T;while(T--)solve();} 
/*
1
9
7 5 10 9 8 7 5 6 8

3 1 2 3 4 5 6 7 8 9 10

8
 7 5 1 3 9 11
6/3
9/4
13/5
18/6
24/7
31/8
39/9
48/10
58/11
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3820kb

input:

2
4
8 2 7 10
6
9 6 5 3 4 8

output:

3
6.75000000000000000000
5
5.83333333333333303727

result:

wrong answer 1st numbers differ - expected: '6.7500000', found: '3.0000000', error = '0.5555556'