161302025-04-03 20:55:04BencuMexxcpp17Wrong answer 0/100180ms4316 KiB
#include <iostream>
#include <fstream>

using namespace std;
int n, a[500001];
int b[500001] = { -1 };
int sz = 0, L[500001], l,ma=0;

int main()
{
    //ifstream f("be.in");
    cin >> n;
    for (int i = 1; i <= n; i++) b[i] = -1;
    cin >> a[1];
    if (a[1] == 1) b[1] = 0;
    if (a[1] > ma) ma = a[1];
    for (int i = 2; i <= n; i++) {
        cin >> a[i];
        if (a[i] > ma) ma = a[i];
        if (a[i]<a[i - 1] || a[i]>i || a[i]-a[i-1]>=2) {
            sz = 1;
        }
        else {
            if (a[i] > a[i - 1]) {
                b[i] = a[i - 1];
                for (int j = a[i - 1] + 1; j < a[i]; j++) {
                    l++;
                    L[l] = j;
                }
            }
        }
    }
    if (ma > n) sz = 1;
    if (sz == 1) cout << "NEM";
    else {
        cout << "IGEN" << endl;
        int t = 1;
        for (int i = 1; i <= n; i++) {
            if (b[i] >= 0) cout << b[i] << " ";
            else {
                if (t <= l) {
                    cout << L[t] << " ";
                    t++;
                }
                else cout << n * 2 << " ";
            }
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer1ms316 KiB
2Wrong answer1ms340 KiB
subtask20/8
3Accepted1ms316 KiB
4Accepted1ms316 KiB
5Accepted1ms396 KiB
6Accepted1ms316 KiB
7Wrong answer1ms316 KiB
8Accepted1ms316 KiB
9Wrong answer1ms316 KiB
10Accepted1ms316 KiB
11Accepted1ms316 KiB
subtask30/16
12Wrong answer1ms316 KiB
13Wrong answer1ms316 KiB
14Wrong answer1ms316 KiB
15Accepted1ms316 KiB
16Accepted1ms316 KiB
subtask40/32
17Wrong answer3ms316 KiB
18Wrong answer3ms460 KiB
19Wrong answer3ms648 KiB
20Wrong answer3ms388 KiB
21Wrong answer3ms508 KiB
22Wrong answer3ms316 KiB
23Accepted3ms316 KiB
24Accepted3ms512 KiB
subtask50/44
25Wrong answer178ms4148 KiB
26Wrong answer179ms4148 KiB
27Wrong answer180ms4316 KiB
28Wrong answer179ms4224 KiB
29Wrong answer179ms4148 KiB
30Wrong answer179ms4148 KiB
31Wrong answer179ms4272 KiB
32Wrong answer179ms4148 KiB
33Wrong answer179ms4312 KiB
34Wrong answer180ms4168 KiB
35Wrong answer180ms4164 KiB
36Accepted177ms4160 KiB
37Accepted178ms4244 KiB