| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 167050 | C班-陈乐 | 紧急集合 | C++ | Accepted | 100 | 4 MS | 344 KB | 375 | 2024-08-19 15:56:02 |
#include<bits/stdc++.h> using namespace std; priority_queue<int, vector<int>, greater<int> > q; int main() { int n, x, ans = 0; cin >> n; for(int i = 1;i <= n;i++){ cin >> x; q.push(x); } while(q.size() > 1){ int x = q.top(); q.pop(); int y = q.top(); q.pop(); ans += x + y; q.push(x + y); } cout << ans << endl; return 0; }