# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
137094 | 2019-07-27T05:15:56 Z | KLPP | Pareto (COCI17_pareto) | C++14 | 71 ms | 6652 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 400 KB | Output is correct |
5 | Correct | 5 ms | 504 KB | Output is correct |
6 | Correct | 24 ms | 2296 KB | Output is correct |
7 | Correct | 50 ms | 4728 KB | Output is correct |
8 | Correct | 71 ms | 6652 KB | Output is correct |