161222025-04-03 10:20:23BencuMexxcpp17Részben helyes 23/100245ms9580 KiB
#include <bits/stdc++.h>

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

int main()
{
    //ifstream f("be.in");
    cin>>n;
    for (int i=1; i<=n; i++) b[i]=-1;
    cin>>a[1];
    for (int i=2; i<=n; i++) {
        cin>>a[i];
        if (a[i]<a[i-1] || a[i]>i) {
            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 (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;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
subtask10/0
1Elfogadva1ms508 KiB
2Részben helyes1ms316 KiB
subtask20/8
3Elfogadva1ms316 KiB
4Elfogadva1ms316 KiB
5Részben helyes1ms316 KiB
6Elfogadva1ms380 KiB
7Hibás válasz1ms316 KiB
8Részben helyes1ms316 KiB
9Elfogadva1ms508 KiB
10Részben helyes1ms316 KiB
11Elfogadva1ms316 KiB
subtask34/16
12Részben helyes1ms316 KiB
13Részben helyes1ms316 KiB
14Részben helyes1ms508 KiB
15Elfogadva1ms316 KiB
16Elfogadva1ms316 KiB
subtask48/32
17Részben helyes4ms316 KiB
18Részben helyes4ms316 KiB
19Részben helyes4ms316 KiB
20Részben helyes4ms508 KiB
21Részben helyes4ms316 KiB
22Részben helyes4ms316 KiB
23Elfogadva3ms508 KiB
24Elfogadva3ms316 KiB
subtask511/44
25Elfogadva243ms9524 KiB
26Részben helyes243ms9580 KiB
27Részben helyes240ms9524 KiB
28Részben helyes241ms9520 KiB
29Részben helyes241ms9408 KiB
30Részben helyes243ms9536 KiB
31Részben helyes240ms9536 KiB
32Részben helyes240ms9480 KiB
33Részben helyes240ms9280 KiB
34Részben helyes243ms9360 KiB
35Részben helyes245ms9168 KiB
36Elfogadva178ms5952 KiB
37Elfogadva178ms5952 KiB