# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
82682 | heon | Pareto (COCI17_pareto) | C++11 | 75 ms | 1792 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
scanf("%d", &n);
vector <int> v(n);
int sum = 0;
for(int i = 0; i < n; i++){
scanf("%d", &v[i]);
sum += v[i];
}
sort(v.rbegin(), v.rend());
int curr = 0;
double a, b;
double solb = 0.0, sola = 0.0;
for(int i = 0; i < n; i++){
curr += v[i];
a = (double) (i+1) / n;
b = (double) curr / sum;
if(b - a > solb - sola){
solb = b, sola = a;
}
}
cout << fixed << setprecision(14) << sola * 100 << "\n";
cout << fixed << setprecision(14) << solb * 100;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |