Submission #866072

# Submission time Handle Problem Language Result Execution time Memory
866072 2023-10-25T11:27:24 Z Blagoj medians (balkan11_medians) C++17
10 / 100
70 ms 12160 KB
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define ll long long
#define all(x) x.begin(), x.end()

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    set<int> notUsed;
    for (int i = 1; i <= n * 2 - 1; i++) notUsed.insert(i);
    vector<int> ans, a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    ans.push_back(a[0]);
    notUsed.erase(a[0]);
    for (int i = 1; i < n; i++) {
        if (notUsed.count(a[i])) {
            notUsed.erase(a[i]);
            ans.push_back(a[i]);
            int x = *notUsed.rbegin();
            ans.push_back(x);
            notUsed.erase(x);
        }
        else {
            int x1 = *notUsed.begin(), x2 = *notUsed.rbegin(); 
            ans.push_back(x1);
            ans.push_back(x2);
            notUsed.erase(x1);
            notUsed.erase(x2);
        }
    }
    for (auto x : ans) cout << x << " ";
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Incorrect 0 ms 460 KB Output isn't correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Incorrect 0 ms 348 KB Output isn't correct
11 Incorrect 1 ms 348 KB Output isn't correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Incorrect 1 ms 348 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Incorrect 2 ms 860 KB Output isn't correct
3 Incorrect 5 ms 1284 KB Output isn't correct
4 Incorrect 10 ms 2108 KB Output isn't correct
5 Incorrect 21 ms 4004 KB Output isn't correct
6 Incorrect 43 ms 7820 KB Output isn't correct
7 Incorrect 70 ms 12160 KB Output isn't correct