Submission #598005

#TimeUsernameProblemLanguageResultExecution timeMemory
598005chinmoy_101Pareto (COCI17_pareto)C++14
80 / 80
163 ms6568 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long int #define lb long double int main() { ll n; lb sum=0; cin>>n; lb arr[n]; for(ll i=0; i<n; i++) { cin>>arr[i]; sum+=arr[i]; } sort(arr, arr+n); reverse(arr, arr+n); lb cursum=0; lb a=100.0, b=100.0; for(ll i=0; i<n; i++) { cursum+=arr[i]; lb aa = (i+1)*100/(lb)n; lb bb = (cursum*100)/sum; if((bb-aa)>(b-a)) { a=aa; b=bb; } //cout<<a <<" " <<b <<"\n"; } cout<<a <<"\n"; cout<<b <<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...