# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82682 | 2018-11-01T10:22:48 Z | heon | Pareto (COCI17_pareto) | C++11 | 75 ms | 1792 KB |
#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; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 440 KB | Output is correct |
4 | Incorrect | 2 ms | 488 KB | Output isn't correct |
5 | Incorrect | 4 ms | 492 KB | Output isn't correct |
6 | Incorrect | 24 ms | 888 KB | Output isn't correct |
7 | Incorrect | 51 ms | 1280 KB | Output isn't correct |
8 | Incorrect | 75 ms | 1792 KB | Output isn't correct |