107542024-04-11 12:45:51CWMMexxcpp17Wrong answer 0/100248ms16768 KiB
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

void output_vector(vector<int> vec, bool isEnterSeperated) {
    for (size_t i = 0; i < vec.size(); i++)
    {
        cout << vec[i];
        if (isEnterSeperated) {
            cout << "\n";
        }
        else {
            cout << " ";
        }
    }
}

int main()
{
    int n;
    cin >> n;
    vector<int> res(n,-1);
    vector<int> inp(n);
    vector<bool> app(2*n);
    int old = -1;
    for (size_t i = 0; i < n; i++)
    {
        cin >> inp[i];
        if (inp[i] > i + 1) {
            cout << "NEM";
            return 0;
        }
        app[inp[i]] = true;
        if (inp[i] != old) {
            res[i] = old;
        }
        old = inp[i];
    }
    int l = 0;
    for (size_t i = 0; i < res.size(); i++)
    {
        if (res[i] == -1) {
            for (size_t j = l; j < app.size(); j++)
            {
                if (!app[j]) {
                    l = j;
                    break;
                }
            }
            res[i] = l;
            l++;
        }
    }
    cout << "IGEN\n";
    output_vector(res, false);
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1808 KiB
2Accepted3ms2212 KiB
subtask20/8
3Accepted3ms2280 KiB
4Accepted3ms2528 KiB
5Accepted3ms2732 KiB
6Accepted3ms2956 KiB
7Accepted3ms3152 KiB
8Accepted3ms3344 KiB
9Accepted3ms3584 KiB
10Accepted3ms3792 KiB
11Wrong answer2ms3816 KiB
subtask30/16
12Accepted3ms3792 KiB
13Accepted3ms3796 KiB
14Accepted3ms3908 KiB
15Accepted3ms3916 KiB
16Wrong answer3ms3916 KiB
subtask40/32
17Accepted6ms3940 KiB
18Accepted6ms3940 KiB
19Accepted6ms4196 KiB
20Accepted6ms4148 KiB
21Accepted6ms4444 KiB
22Accepted6ms4404 KiB
23Accepted4ms4336 KiB
24Wrong answer4ms4364 KiB
subtask50/44
25Accepted246ms16164 KiB
26Accepted245ms16200 KiB
27Accepted245ms16164 KiB
28Accepted245ms16164 KiB
29Accepted245ms16164 KiB
30Accepted246ms16160 KiB
31Accepted246ms16400 KiB
32Accepted246ms16376 KiB
33Accepted246ms16408 KiB
34Accepted248ms16768 KiB
35Accepted248ms16692 KiB
36Accepted141ms12520 KiB
37Wrong answer244ms16752 KiB