| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 99627 | 梁晨熙 | 紧急集合 | C++ | Accepted | 100 | 590 MS | 324 KB | 339 | 2023-08-23 13:48:43 |
#include <bits/stdc++.h> #define int long long using namespace std; int n,x,ans=0; int a[1000005]; signed main(){ cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; } sort(a+1,a+n+1); for(int i = 2; i <= n; i++){ ans += a[i]+a[i-1]; a[i]+=a[i-1]; sort(a+i,a+n+1); } cout << ans << endl; return 0; }