# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
137094 | KLPP | Pareto (COCI17_pareto) | C++14 | 71 ms | 6652 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.
#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
#define rep(i,a,b) for(int i=a;i<b;i++)
int main(){
cout<<setprecision(10);
int n;
scanf("%d",&n);
lld arr[n];
lld sum=0;
rep(i,0,n){
scanf("%lld",&arr[i]);
sum+=arr[i];
}
sort(arr,arr+n);
reverse(arr,arr+n);
lld par[n+1];
par[0]=0;
rep(i,1,n+1){
par[i]=arr[i-1]+par[i-1];
}
pair<lld,int> MD=pair<lld,int>(0,0);
rep(i,0,n+1){
MD=max(MD,pair<lld,int>(par[i]*n-sum*i,i));
}
cout<<(double)(100*MD.second)/n<<endl<<(double)(100*par[MD.second])/sum<<endl;
//cout<<ans<<endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |