Submission #9752

# Submission time Handle Problem Language Result Execution time Memory
9752 2014-09-28T08:40:00 Z silas Uniting (kriii2_U) C++
0 / 4
0 ms 1676 KB
#include <iostream>
#include <queue>
#include <functional>

using namespace std;

int main() {
	priority_queue<int, vector<int> > max_heap;
	priority_queue <int, vector<int>, greater<int> > min_heap;
	int cost = 0; // 비용의 합의 최솟값
	int num_busu = 0;
	int num, temp; // num : 부서의 수
	cin >> num;
	for (int i = 0 ; i < num; i++) {
		cin >> temp;
		max_heap.push(temp);
		min_heap.push(temp);
		num_busu++;
	}
	while (num_busu > 1) {
		cost = max_heap.top() * min_heap.top();
		min_heap.pop(); max_heap.pop();
		num_busu--;
	}
	cout << cost << endl;
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1676 KB Output isn't correct
2 Halted 0 ms 0 KB -