Submission #739002

#TimeUsernameProblemLanguageResultExecution timeMemory
739002UnforgettableplPareto (COCI17_pareto)C++17
80 / 80
110 ms6556 KiB
/* 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 timeMemoryGrader output
Fetching results...