Submission #75819750
Source Code Expand
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
#define rep(i, s, e) for (ll i = (s); i <= (e); i++)
#define all(v) v.begin(), v.end()
#define pb push_back
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = array<ll, 2>;
ll n;
ld c, res, m[101010];
int main() {
cin.tie(0)->sync_with_stdio(0), cout.precision(10);
cin >> n;
rep(i, 1, n) cin >> m[i];
sort(m + 1, m + n + 1);
rep(i, 1, n) c += m[i];
rep(i, 1, n) {
ll l = n - i;
res += c * (i - 1) / n * l / 2;
}
rep(i, 1, n) {
res += (n - i + 2) * m[i] / 2;
}
cout << fixed << res;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - Opening Magical Box |
| User | iAi |
| Language | C++23 (GCC 15.2.0) |
| Score | 100 |
| Code Size | 664 Byte |
| Status | AC |
| Exec Time | 19 ms |
| Memory | 5604 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-001.txt, 00-sample-002.txt |
| All | 00-sample-001.txt, 00-sample-002.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt, 01-017.txt, 01-018.txt, 01-019.txt, 01-020.txt, 01-021.txt, 01-022.txt, 01-023.txt, 01-024.txt, 01-025.txt, 01-026.txt, 01-027.txt, 01-028.txt, 01-029.txt, 01-030.txt, 01-031.txt, 01-032.txt, 01-033.txt, 01-034.txt, 01-035.txt, 01-036.txt, 01-037.txt, 01-038.txt, 01-039.txt, 01-040.txt, 01-041.txt, 01-042.txt, 01-043.txt, 01-044.txt, 01-045.txt, 01-046.txt, 01-047.txt, 01-048.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-001.txt | AC | 1 ms | 3796 KiB |
| 00-sample-002.txt | AC | 1 ms | 3760 KiB |
| 01-001.txt | AC | 11 ms | 5364 KiB |
| 01-002.txt | AC | 13 ms | 5356 KiB |
| 01-003.txt | AC | 19 ms | 5604 KiB |
| 01-004.txt | AC | 19 ms | 5552 KiB |
| 01-005.txt | AC | 19 ms | 5552 KiB |
| 01-006.txt | AC | 19 ms | 5480 KiB |
| 01-007.txt | AC | 19 ms | 5268 KiB |
| 01-008.txt | AC | 18 ms | 5488 KiB |
| 01-009.txt | AC | 19 ms | 5480 KiB |
| 01-010.txt | AC | 19 ms | 5480 KiB |
| 01-011.txt | AC | 19 ms | 5292 KiB |
| 01-012.txt | AC | 19 ms | 5244 KiB |
| 01-013.txt | AC | 19 ms | 5360 KiB |
| 01-014.txt | AC | 19 ms | 5376 KiB |
| 01-015.txt | AC | 19 ms | 5480 KiB |
| 01-016.txt | AC | 19 ms | 5360 KiB |
| 01-017.txt | AC | 19 ms | 5504 KiB |
| 01-018.txt | AC | 19 ms | 5256 KiB |
| 01-019.txt | AC | 19 ms | 5332 KiB |
| 01-020.txt | AC | 19 ms | 5352 KiB |
| 01-021.txt | AC | 19 ms | 5424 KiB |
| 01-022.txt | AC | 18 ms | 5488 KiB |
| 01-023.txt | AC | 1 ms | 4064 KiB |
| 01-024.txt | AC | 1 ms | 3704 KiB |
| 01-025.txt | AC | 1 ms | 4016 KiB |
| 01-026.txt | AC | 1 ms | 3656 KiB |
| 01-027.txt | AC | 1 ms | 3760 KiB |
| 01-028.txt | AC | 1 ms | 3760 KiB |
| 01-029.txt | AC | 1 ms | 3760 KiB |
| 01-030.txt | AC | 1 ms | 3888 KiB |
| 01-031.txt | AC | 1 ms | 3760 KiB |
| 01-032.txt | AC | 1 ms | 3704 KiB |
| 01-033.txt | AC | 1 ms | 3952 KiB |
| 01-034.txt | AC | 1 ms | 3700 KiB |
| 01-035.txt | AC | 1 ms | 3708 KiB |
| 01-036.txt | AC | 1 ms | 3760 KiB |
| 01-037.txt | AC | 11 ms | 5424 KiB |
| 01-038.txt | AC | 13 ms | 5424 KiB |
| 01-039.txt | AC | 11 ms | 5256 KiB |
| 01-040.txt | AC | 11 ms | 5424 KiB |
| 01-041.txt | AC | 13 ms | 5600 KiB |
| 01-042.txt | AC | 11 ms | 5364 KiB |
| 01-043.txt | AC | 12 ms | 5364 KiB |
| 01-044.txt | AC | 12 ms | 5332 KiB |
| 01-045.txt | AC | 13 ms | 5364 KiB |
| 01-046.txt | AC | 19 ms | 5480 KiB |
| 01-047.txt | AC | 1 ms | 4064 KiB |
| 01-048.txt | AC | 1 ms | 3812 KiB |