104782024-04-03 11:13:40csaron71Mexxcpp17Wrong answer 0/100250ms17812 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> szamok;
    vector<int> valt;
    bool vege=false;
    for (int i=0; i<n; i++) {
        int x;
        cin >> x;
        szamok.push_back(x);
        if (szamok[i]>i+1) {
            vege=true;
        }
    }
    if (vege==true) {
        cout << "NEM\n";
        return 0;
    }
    for (int i=1; i<n; i++) {
        if (szamok[i]<szamok[i-1]) {
            cout << "NEM\n";
            return 0;
        }
        if (szamok[i]>szamok[i-1]) {
            valt.push_back(szamok[i]);
        }
    }

    int epp=0;
    vector<int> veg;
    int y=0;
    if (szamok[0]==0) {
        epp++;
        while (epp==valt[y]) {
            epp++;
            y++;
        }
        veg.push_back(epp);
    }
    for (int i=1; i<n; i++) {
        if (szamok[i]>szamok[i-1]) {
             veg.push_back(szamok[i-1]);
        }
        else {
            epp++;
            while (epp==valt[y]) {
                epp++;
                y++;
            }
            veg.push_back(epp);
        }
    }

    for (int sz : veg) {
        cout << sz << " ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms2016 KiB
2Wrong answer3ms2160 KiB
subtask20/8
3Runtime error3ms2100 KiB
4Wrong answer3ms2288 KiB
5Wrong answer3ms2520 KiB
6Wrong answer2ms2500 KiB
7Accepted2ms2512 KiB
8Runtime error3ms2644 KiB
9Wrong answer3ms2820 KiB
10Wrong answer3ms2996 KiB
11Accepted3ms3176 KiB
subtask30/16
12Wrong answer3ms3396 KiB
13Wrong answer3ms3476 KiB
14Wrong answer3ms3604 KiB
15Accepted3ms3816 KiB
16Accepted3ms3932 KiB
subtask40/32
17Wrong answer4ms4408 KiB
18Wrong answer4ms4324 KiB
19Wrong answer4ms4328 KiB
20Wrong answer6ms4220 KiB
21Wrong answer6ms4476 KiB
22Wrong answer4ms4484 KiB
23Accepted4ms4436 KiB
24Accepted4ms4624 KiB
subtask50/44
25Wrong answer244ms14304 KiB
26Wrong answer245ms14232 KiB
27Wrong answer246ms14180 KiB
28Wrong answer246ms14164 KiB
29Wrong answer246ms16316 KiB
30Wrong answer247ms16348 KiB
31Wrong answer246ms16680 KiB
32Wrong answer250ms16812 KiB
33Wrong answer248ms16904 KiB
34Wrong answer247ms17320 KiB
35Wrong answer250ms17812 KiB
36Accepted179ms9000 KiB
37Accepted179ms8876 KiB