QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#668624#8242. V-Diagramfrankly6#WA 0ms3672kbC++171.0kb2024-10-23 15:17:452024-10-23 15:17:45

Judging History

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

  • [2024-10-23 15:17:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3672kb
  • [2024-10-23 15:17:45]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#define int long long
using namespace std;
typedef long double ld;
const int MX=300010;

int T, N;
int ar[MX];
bool c1[MX], c2[MX];
int read()
{
    int r=0, f=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') {r=r*10+ch-'0'; ch=getchar();}
    return r*f;
}
signed main()
{
    // freopen("testdata.in","r",stdin);
    T=read();
    while(T--)
    {
        N=read();
        int sum=0;
        for(int i=1;i<=N;i++) 
        {
            ar[i]=read();
            sum+=ar[i];
            c1[i]=c2[i]=0;
        }
        c1[1]=1;
        for(int i=2;i<=N;i++)
            if(ar[i]<=ar[i-1]&&c1[i-1]) c1[i]=1;
        c2[N]=1;
        for(int i=N-1;i>=1;i--)
            if(ar[i]<=ar[i+1]&&c2[i+1]) c2[i]=1;
        cout << 1.0*sum/N << '\n';
        // for(int i=1;i<=N;i++)
        //     if(c1[i]&&c2[i])
        //     {

        //     }
    }
    return (0-0);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

6.75
5.83333

result:

wrong answer 2nd numbers differ - expected: '5.8333333', found: '5.8333300', error = '0.0000006'