QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#348026 | #8242. V-Diagram | Freeuni1# | WA | 67ms | 3988kb | C++14 | 971b | 2024-03-09 16:39:48 | 2024-03-09 16:39:52 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pb push_back
#define MAX ((ll)(1e18 + 100))
#define MX ((ll)(1e6 + 100))
#define ARRS ((ll)(1e6 + 100))
#define MOD ((ll)(998244353))
#define PI ((double)3.141592653)
#define EP ((double)(1e-9))
#define LG 21
ll a[ARRS];
int main() {
ios::sync_with_stdio(0);
ll q;
cin>>q;
while(q--){
ll n;
cin>>n;
double s=0;
double ans=0;
ll c=0;
for(int i=0; i<n; i++){
cin>>a[i];
}
ll C;
for(int i=1; i<n-1; i++){
if(a[i-1]>a[i]&&a[i]<a[i+1])C=i;
}
s=0;c=0;
for(int i=0; i<n; i++){
c++;
s+=a[i];
if(i>=C)
ans=max(ans, s/c);
}
s=0;c=0;
for(int i=n-1; i>=0; i--){
c++;
s+=a[i];
if(i<=C)
ans=max(ans, s/c);
}
printf("%.12f\n", ans);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3988kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
6.750000000000 5.833333333333
result:
ok 2 numbers
Test #2:
score: -100
Wrong Answer
time: 67ms
memory: 3924kb
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.000000000000 454252473.500000000000 770302316.666666626930 608562705.000000000000 296293261.666666686535 365718784.000000000000 571816312.666666626930 237830983.000000000000 45613183.000000000000 474479951.500000000000 742247812.000000000000 779975824.333333373070 503399231.500000000000 64...
result:
wrong answer 1st numbers differ - expected: '833782882.6666666', found: '843938490.0000000', error = '0.0121802'