QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#637678 | #8242. V-Diagram | Moemi_ | WA | 0ms | 4052kb | C++20 | 1.5kb | 2024-10-13 13:47:03 | 2024-10-13 13:47:05 |
Judging History
answer
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <stack>
#include <cstring>
#include <iomanip>
#include <unordered_map>
#include <numeric>
#define sc_int(x) scanf("%d", &x)
#define x first
#define y second
#define pb push_back
using namespace std;
const int N = 510, M = 2e5 + 10, MOD = 1e9 + 7;
const int inf = 1e9;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<string, int> PSI;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef pair<char, int> PCI;
typedef pair<string, string> PSS;
int n, m;
void solve()
{
cin >> n;
vector<LL> a(n + 1);
LL sum = 0;
for(int i = 1; i <= n; i ++) cin >> a[i], sum += a[i];
int pos = 0;
for(int i = 1; i <= n; i ++)
{
if(a[i] < a[i + 1])
{
pos = i;
break;
}
}
LL num = n;
int l = 1;
int r = n;
while(l + 1 < pos && sum >= a[l] * num) sum -= a[l], l ++, num --;
while(r - 1 > pos && sum >= a[r] * num) sum -= a[r], r --, num --;
cout << pos << " " << l << " " << r << " " << sum << endl;
printf("%.15lf\n", 1.0 * sum / num);
}
int main()
{
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int T = 1;
cin >> T;
while(T --)
{
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 4052kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
2 1 4 27 6.750000000000000 4 1 6 35 5.833333333333333
result:
wrong answer 1st numbers differ - expected: '6.7500000', found: '2.0000000', error = '0.7037037'