# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
9550 |
2014-09-28T07:10:31 Z |
silas |
Uniting (kriii2_U) |
C++ |
|
0 ms |
1676 KB |
#include <iostream>
#include <queue>
#include <functional>
using namespace std;
int main() {
priority_queue <int, vector<int>, greater<int> > q;
int n;
cin >> n;
for (int i = 0; i < n; i++){
int tmp;
cin >> tmp;
q.push(tmp);
}
int ans = 0;
while (q.size() >= 2) {
int a, b;
a = q.top();
q.pop();
b = q.top();
q.pop();
ans += a * b;
q.push(a + b);
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
1676 KB |
Output is partially correct |
2 |
Partially correct |
0 ms |
1676 KB |
Output is partially correct |
3 |
Partially correct |
0 ms |
1676 KB |
Output is partially correct |
4 |
Partially correct |
0 ms |
1676 KB |
Output is partially correct |
5 |
Partially correct |
0 ms |
1676 KB |
Output is partially correct |
6 |
Incorrect |
0 ms |
1676 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |