# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
136919 | 2019-07-26T14:15:02 Z | dnass | Pareto (COCI17_pareto) | C++14 | 166 ms | 4204 KB |
#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; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 9 ms | 504 KB | Output is correct |
6 | Correct | 54 ms | 1528 KB | Output is correct |
7 | Correct | 124 ms | 3112 KB | Output is correct |
8 | Correct | 166 ms | 4204 KB | Output is correct |