# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
136919 | dnass | Pareto (COCI17_pareto) | C++14 | 166 ms | 4204 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
lld n;
lld a[300100];
int main(){
cout.precision(15);
cin >> n;
lld tot_sum = 0;
for(lld i=0;i<n;i++){
cin >> a[i];
tot_sum += a[i];
}
sort(a, a+n); reverse(a, a+n);
lld sum = 0;
double max_dif = -1;
double aa, bb, real_a, real_b;
for(lld i=0;i<n;i++){
sum += a[i];
aa = ((double)(i+1))/((double)n);
bb = ((double)sum)/((double)tot_sum);
if(bb-aa>max_dif){
max_dif = bb-aa;
real_b = bb;
real_a = aa;
}
}
cout << 100*real_a << endl;
cout << 100*real_b << endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |