QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#637714#8242. V-DiagramMoemi_WA 0ms3752kbC++201.4kb2024-10-13 13:54:142024-10-13 13:54:15

Judging History

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

  • [2024-10-13 13:54:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3752kb
  • [2024-10-13 13:54:14]
  • 提交

answer

#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <stack>
#include <cstring>
#include <iomanip>
#include <unordered_map>
#include <numeric>

#define sc_int(x) scanf("%d", &x)

#define x first
#define y second
#define pb push_back

using namespace std;

const int N = 510, M = 2e5 + 10, MOD = 1e9 + 7;
const int inf = 1e9;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<string, int> PSI;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef pair<char, int> PCI;
typedef pair<string, string> PSS;

int n, m;

void solve() 
{
    cin >> n;
    vector<LL> a(n + 1);
    LL sum = 0;
    for(int i = 1; i <= n; i ++) cin >> a[i], sum += a[i];
    int pos = 0;
    for(int i = 1; i <= n - 1; i ++)
    {
        if(a[i] < a[i + 1])
        {
            pos = i;
            break;
        }
    }
    if(sum >= a[1] * n)
    {
        for(int i = 1; i < pos - 1; i ++) sum -= a[i], n --;
    }
    else 
    {
        for(int i = n; i > pos + 1; i --) sum -= a[i], n --;
    }
    printf("%.15lf\n", 1.0 * sum / n);
}

int main()
{
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    
    int T = 1;
    cin >> T;
    while(T --)
    {
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

5.666666666666667
5.400000000000000

result:

wrong answer 1st numbers differ - expected: '6.7500000', found: '5.6666667', error = '0.1604938'