# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
739002 | Unforgettablepl | Pareto (COCI17_pareto) | C++17 | 110 ms | 6556 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long double ll;
typedef pair<ll,ll> pii;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
//#define f first
//#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("measurement.in","r",stdin);
// freopen("measurement.out","w",stdout);
int n;
cin >> n;
vector<ll> acc(n);
ll sum = 0;
for(ll&i:acc){cin>>i;sum+=i;}
sort(allr(acc));
ll A = 0;
ll B = 0;
ll ans = INT32_MIN;
ll curr_sum = 0;
for (ll i = 0; i < n; i++) {
curr_sum+=acc[i];
if(ans<abs((curr_sum/sum)-((i+1)/n))){
ans = abs((curr_sum/sum)-((i+1)/n));
A = ((i+1)/n);
B = (curr_sum/sum);
}
}
cout << A*100 << ' ' << B*100;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |