| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 26024 | iletavcioski | Pareto (COCI17_pareto) | C++14 | 166 ms | 14508 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long double ll;
int main()
{
ios_base::sync_with_stdio(false);
int n;
cin>>n;
ll brojac=0;
vector<ll> v;
for(int i=0;i<n;i++)
{
ll a;
cin>>a;
v.push_back(a);
brojac+=a;
}
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
int broj=0;
double d1;
double d2;
double maxi=-1;
ll broj1=0;
for(int i=0;i<v.size();i++)
{
broj1+=v[i];
broj++;
double dd=(double)broj/(double)n;
double ddd=(ll)broj1/(ll)brojac;
if(maxi<abs(ddd-dd))
{
maxi=abs(ddd-dd);
d1=dd;
d2=ddd;
}
}
d1*=100;
d2*=100;
cout<<fixed<<setprecision(14);
cout<<d1<<endl;
cout<<fixed<<setprecision(14);
cout<<d2<<endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
