QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#343279 | #8242. V-Diagram | zzuqy# | WA | 119ms | 3968kb | C++14 | 685b | 2024-03-02 13:08:51 | 2024-03-02 13:08:52 |
Judging History
answer
#include <bits/stdc++.h>
#define N 1000009
using namespace std;
int n, a[N];
double ans;
void solve() {
scanf("%d", &n);
int sum = 0;
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]), sum += a[i];
int mn = 1;
for (int i = 1; i <= n; i++)
if (a[mn] > a[i])
mn = i;
ans = 1.0 * sum / n;
for (int i = 1; i < mn - 1; i++) {
sum -= a[i];
ans = max(ans, 1.0 * sum / (n - i));
}
for (int i = 1; i < mn - 1; i++)
sum += a[i];
for (int i = n; i > mn + 1; i--) {
sum -= a[i];
ans = max(ans, 1.0 * sum / (i - 1));
}
cout << fixed << setprecision(15) << ans << endl;
}
int main() {
int t;
scanf("%d", &t);
while (t--)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3908kb
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: -100
Wrong Answer
time: 119ms
memory: 3968kb
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:
-597872882.666666626930237 435670789.666666686534882 -661353448.666666626930237 608562705.000000000000000 296293261.666666686534882 319149416.333333313465118 571816312.666666626930237 223646002.333333343267441 39407315.666666664183140 383253737.666666686534882 -697292126.666666626930237 -651679941.0...
result:
wrong answer 1st numbers differ - expected: '833782882.6666666', found: '-597872882.6666666', error = '1.7170606'