QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#626999 | #8242. V-Diagram | zzfs# | WA | 108ms | 3892kb | C++14 | 875b | 2024-10-10 14:26:19 | 2024-10-10 14:26:20 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5 + 5;
int a[N];
int n;
void solve()
{
cin >> n;
a[0] = 0x3f3f3f3f;
int p = 0;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
if (a[i] > a[i - 1])
p = i - 1;
}
ll sum = 0;
double ans = 0;
sum = 0;
for (int i = 1; i <= n; i++)
{
sum += a[i];
if (i > p)
ans = max(ans, 1.0 * sum / i);
}
sum = 0;
for (int i = n; i >= 1; i--)
{
sum += a[i];
if (i < p)
ans = max(ans, 1.0 * sum / (n - i + 1));
}
cout << fixed << setprecision(15) << ans << endl;
}
int main()
{
cin.tie(0)->ios::sync_with_stdio(false);
int t = 1;
cin >> t;
while (t--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3764kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
6.750000000000000 5.833333333333333
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 108ms
memory: 3836kb
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:
833782882.666666626930237 435670789.666666686534882 770302316.666666626930237 608562705.000000000000000 296293261.666666686534882 319149416.333333313465118 571816312.666666626930237 223646002.333333343267441 39407315.666666664183140 383253737.666666686534882 734363638.666666626930237 779975824.33333...
result:
ok 100000 numbers
Test #3:
score: -100
Wrong Answer
time: 36ms
memory: 3892kb
input:
10000 4 194123849 79274911 191162487 570110764 86 957917218 915359202 914726017 873273226 867724859 867674150 809652204 805531383 745262007 743835491 727071232 714782071 645394643 639432679 594879540 587173904 583418126 560538589 518721836 469558994 427721766 411582333 404948350 402948978 357228675 ...
output:
280182720.666666686534882 971673720.333333373069763 729761539.666666626930237 963950546.333333373069763 630796860.333333373069763 642159163.000000000000000 964329404.000000000000000 254833443.199999988079071 870415123.666666626930237 908181856.666666626930237 564217787.333333373069763 962191105.6666...
result:
wrong answer 1st numbers differ - expected: '258668002.7500000', found: '280182720.6666667', error = '0.0831750'