QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#687538 | #8242. V-Diagram | cjpjh# | WA | 183ms | 3856kb | C++20 | 907b | 2024-10-29 19:33:13 | 2024-10-29 19:33:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int n;
cin >> n;
vector<int> a(n);
int sum = 0;
for(int i = 0; i < n; ++i) {
cin >> a[i];
sum += a[i];
}
int p = -1;
for(int i = 1; i < n - 1; ++i) {
if(a[i] > a[i - 1] && a[i] > a[i + 1]) {
p = i;
break;
}
}
int num = n;
for(int i = 0; i < p - 1; ++i) {
if(sum > a[i] * num) {
sum -= a[i];
num--;
} else break;
}
for(int i = n - 1; i > p + 1; --i) {
if(sum > a[i] * num) {
sum -= a[i];
num--;
} else break;
}
cout << fixed << setprecision(20);
cout << 1.0 * sum / num << "\n";
}
signed main() {
int t = 1;
cin >> t;
while(t--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3856kb
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: 183ms
memory: 3792kb
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:
948511478.00000000000000000000 881046825.00000000000000000000 770302316.66666662693023681641 608562705.00000000000000000000 296293261.66666668653488159180 645443456.00000000000000000000 571816312.66666662693023681641 418958362.00000000000000000000 64461646.00000000000000000000 914535039.000000000000...
result:
wrong answer 1st numbers differ - expected: '833782882.6666666', found: '948511478.0000000', error = '0.1376001'