# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1103705 | melody_rules | Pareto (COCI17_pareto) | C++17 | 67 ms | 12112 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define db long double
using namespace std;
signed main() {
int n=0;
int a=0;
db b=0;
db c=0;
db d=0;
int i=0;
cin>>n;
vector<int> vec(n);
vector<pair<db, db>> veco(n);
for(i=0;i<n;i++) {
cin>>a;
vec.at(i) = a;
c += a;
}
sort(vec.begin(), vec.end());
reverse(vec.begin(), vec.end());
a=0;
b=0;
for(i=0;i<n;i++) {
b = (i+1);
b *= 100;
b /= n;
veco.at(i).first = b;
}
a=0;
b=0;
for(i=0;i<n;i++) {
b += vec.at(i);
d = b;
d *= 100;
d /= c;
veco.at(i).second = d;
}
b=0;
for(i=0;i<n;i++) {
if((veco.at(i).second - veco.at(i).first) > b) {
b = (veco.at(i).second - veco.at(i).first);
a = i;
}
}
cout<<setprecision(17);
cout<<veco.at(a).first<<endl;
cout<<setprecision(17);
cout<<veco.at(a).second<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |