104712024-04-03 07:51:38RRoliMexxcpp17Wrong answer 0/100164ms12592 KiB
#include <bits/stdc++.h>
using namespace std;

int n, a[500001], b[500001];
bool c[1000001];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ifstream f("be.in");

    cin>> n;
    for(int i = 1; i <= n; i++) {
        cin>> a[i];
        b[i] = -1;
        c[a[i]] = true;
    }
    for(int i = 1; i < n; i++)
        if(a[i+1] > a[i])
            b[i+1] = a[i];

    for(int i = 1; i <= n; i++) cout << b[i] << ' ';
    cout << endl;

    int szam = 0;
    bool jo = true;
    for(int i = 1; i <= n; i++) {
        while(c[szam]) szam++;
        if(b[i] == -1) {
            b[i] = szam;
            szam++;
        }
        if(szam < a[i]-1) jo = false;
    }

    if(!jo || szam > 2*n+1 || szam < a[n]-1) cout << "NEM";
    else {
        cout << "IGEN\n";
        for(int i = 1; i <= n; i++) cout << b[i] << ' ';
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1872 KiB
2Wrong answer3ms2184 KiB
subtask20/8
3Wrong answer3ms2276 KiB
4Wrong answer3ms2496 KiB
5Wrong answer3ms2816 KiB
6Wrong answer2ms2776 KiB
7Wrong answer2ms2776 KiB
8Wrong answer2ms2776 KiB
9Wrong answer3ms2912 KiB
10Wrong answer3ms2996 KiB
11Wrong answer3ms3324 KiB
subtask30/16
12Wrong answer2ms3284 KiB
13Wrong answer2ms3284 KiB
14Wrong answer2ms3284 KiB
15Wrong answer3ms3220 KiB
16Wrong answer2ms3284 KiB
subtask40/32
17Wrong answer4ms3760 KiB
18Wrong answer4ms3724 KiB
19Wrong answer4ms3608 KiB
20Wrong answer4ms3564 KiB
21Wrong answer4ms3572 KiB
22Wrong answer4ms3572 KiB
23Wrong answer4ms3440 KiB
24Wrong answer4ms3564 KiB
subtask50/44
25Wrong answer158ms11976 KiB
26Wrong answer157ms12340 KiB
27Wrong answer157ms12468 KiB
28Wrong answer158ms12432 KiB
29Wrong answer158ms12592 KiB
30Wrong answer158ms12532 KiB
31Wrong answer158ms12416 KiB
32Wrong answer158ms12424 KiB
33Wrong answer159ms12408 KiB
34Wrong answer160ms12408 KiB
35Wrong answer164ms12460 KiB
36Wrong answer111ms11932 KiB
37Wrong answer158ms11940 KiB