| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 168171 | 徐启善(C班) | 紧急集合 | C++ | Accepted | 100 | 6 MS | 344 KB | 537 | 2024-08-19 23:23:33 |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; priority_queue<int, vector<int>, greater<int>> minh; for (int i = 0; i < n; ++i) { int v; cin >> v; minh.push(v); } long long sum = 0; while (minh.size() > 1) { int first = minh.top(); minh.pop(); int second = minh.top(); minh.pop(); sum = sum + first + second; minh.push(first + second); } cout << sum << endl; return 0; }