QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#691702 | #8242. V-Diagram | SHOJIG# | WA | 81ms | 3912kb | C++20 | 835b | 2024-10-31 12:42:16 | 2024-10-31 12:42:16 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define endl '\n'
const int N = 3e5 + 10;
using ll = long long;
using db = double;
const int inf = 1 << 30;
int n, a[N];
ll pre[N];
void solve() {
cin >> n;
int mi = a[1], pos = 1;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
pre[i] = pre[i - 1] + a[i];
if (a[i] < mi) {
mi = a[i];
pos = i;
}
}
db ans = 1.0 * pre[n] / n;
ans = max(ans, 1.0 * (pre[n] - pre[pos - 2]) / (n - pos + 2)); // [pos - 1, n]
ans = max(ans, 1.0 * pre[pos + 1] / (pos + 1)); // [1, pos + 1]
cout << fixed << setprecision(20) << ans << endl;
}
signed main() {
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int _ = 1;
cin >> _;
while(_--) solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3896kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
6.75000000000000000000 5.83333333333333303727
result:
ok 2 numbers
Test #2:
score: -100
Wrong Answer
time: 81ms
memory: 3912kb
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.00000000000000000000 435670789.66666668653488159180 770302316.66666662693023681641 608562705.00000000000000000000 296293261.66666668653488159180 319149416.33333331346511840820 571816312.66666662693023681641 223646002.33333334326744079590 39407315.66666666418313980103 383253737.666666686534...
result:
wrong answer 1st numbers differ - expected: '833782882.6666666', found: '843938490.0000000', error = '0.0121802'