# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
596234 | hail | Pareto (COCI17_pareto) | C++17 | 45 ms | 4160 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n; cin>>n;
vector<ll> money_arr(n);
cout<<setprecision(20);
long long total_money{};
for(int i=0; i<n; i++)
{
cin>>money_arr[i];
total_money+=money_arr[i];
}
double perc_ppl;
double perc_money;
double ppl;
double money;
double max_d{};
double money_sum{};
sort(money_arr.rbegin(), money_arr.rend());
for(int i=1; i<=n; i++)
{
money_sum+=money_arr[i-1];
perc_ppl = (i/((double)n));
perc_money = money_sum/((double)total_money);
if(abs(perc_money-perc_ppl)>max_d)
{
max_d = abs(perc_money-perc_ppl);
money = perc_money;
ppl = perc_ppl;
}
}
cout<<(ppl*100)<<"\n"<<(money*100);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |