Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <queue>
- using namespace std;
- int main() {
- int n;
- ios::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- cin >> n;
- priority_queue<int> q;
- int i;
- int x;
- for (i = 1;i <= n / 2 + 1;i++) {
- cin >> x;
- q.push(x);
- }
- for (i = n / 2 + 2;i <= n;i++) {
- cin >> x;
- q.push(x);
- q.pop();
- }
- if (n % 2 == 1) {
- cout << q.top();
- }
- else {
- int a = q.top();
- q.pop();
- int b = q.top();
- printf("%.1f", a / 2.0 + b / 2.0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement