Submission #137094

#TimeUsernameProblemLanguageResultExecution timeMemory
137094KLPPPareto (COCI17_pareto)C++14
80 / 80
71 ms6652 KiB
#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)

pareto.cpp: In function 'int main()':
pareto.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
   ~~~~~^~~~~~~~~
pareto.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&arr[i]);
     ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...