# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
24003 | Trathz | Pareto (COCI17_pareto) | C++98 | 113 ms | 4364 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define int long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define ieps (int) 1e5 + 800
#define eps (int) 1e9
#define jmp exit(0)
double pct(int x , int y){
return 1.0*x/y;
}
int32_t main(){
int n ;
cin>>n;
vector<int> v(n);
int s = 0;
for(int i = 0;i<n;i++) cin>>v[i] , s+=v[i];
sort(v.rbegin() , v.rend());
int atual = 0;
pair<double , double > tot = mp(0, 0);
for(int i = 0;i<n;i++){
atual+=v[i];
pair<double , double > l = mp(pct(i + 1 , n) , pct(atual,s));
if(l.S - l.F> tot.S - tot.F){
tot = l;
}
}
printf("%.10f\n%.10f", 100 * tot.F, 100 * tot.S);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |