# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
873619 | vjudge1 | Pareto (COCI17_pareto) | C++17 | 42 ms | 7700 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#ifdef LOCAL
#include "Essentials/algo/debug.h"
#else
#define debug(...) 69
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ldb;
const int N = 3e5 + 23;
const ll inf = 1e18;
#define F first
#define S second
#define pb push_back
#define kill(x) cout<<x<<endl, exit(0);
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lc (v << 1)
#define rc ((v<<1) |1)
#define int ll
int n;
vector<int> vals;
pair< ldb, pair<ldb,ldb>> ans= {0.0 , {100.0 , 100.0}};
int32_t main() {
cin.tie(nullptr)->sync_with_stdio(false);
cin>>n;
int sum = 0;
for(int i = 0 ; i<n ; i++) {
int x; cin>>x;
vals.pb(x);
sum += x;
}
sort(all(vals),greater<>());
int sum1= 0;
for(int i = 0 ; i< n ; i++) {
sum1 += vals[i];
ldb A = (i+1)*1.0 / n;
ldb B = sum1*1.0 / sum;
ans = max(ans, {B-A, {A,B}});
}
cout<<fixed << ans.S.F*100 << '\n'<< ans.S.S*100 << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |