| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 201664 | SamAnd | Pareto (COCI17_pareto) | C++17 | 77 ms | 3088 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
int n;
int a[N];
int main()
{
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(14);
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
sort(a + 1, a + n + 1);
reverse(a + 1, a + n + 1);
long double sum = 0;
for (int i = 1; i <= n; ++i)
sum += a[i];
long double ans1 = 1, ans2 = 1;
long double p = 0;
for (int i = 1; i <= n; ++i)
{
p += a[i];
long double yans1 = (i * 1.0) / n;
long double yans2 = p / sum;
if ((yans2 - yans1) > (ans2 - ans1))
{
ans1 = yans1;
ans2 = yans2;
}
}
cout << ans1 * 100 << endl << ans2 * 100 << endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
