47052023-03-31 09:47:40csaron71Kombináció (50)cpp17Runtime error 15/503ms3932 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> van(n, 0);
    vector<int> v(n);
    for (int i=0; i<m; i++) {
        int x;
        cin >> x;
        van[x]++;
        v[i]=x;
    }

    int masik=-1, hol=m;
    while (masik==-1) {
        hol--;
        if (van[v[hol]-1]==0) {
            masik=v[hol]-1;
        }
    }

    int b=0;
    while (v[b]<masik) {
        cout << v[b]  << " ";
        b++;
    }
    for (int i=masik; i<masik+m-hol; i++) {
        cout << i << " ";
    }
    cout << "\n";

    int uj=-1, epp=m;
    while (uj==-1) {
        epp--;
        if (van[v[epp]+1]==0) {
            uj=v[epp]+1;
        }
    }

    int a=0;
    while (v[a]<uj-1) {
        cout << v[a] << " ";
        a++;
    }
    for (int i=uj; i<uj+m-epp; i++) {
        cout << i << " ";
    }



    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Runtime error0/03ms1920 KiB
2Wrong answer0/03ms2008 KiB
3Wrong answer0/23ms2248 KiB
4Accepted2/23ms2468 KiB
5Partially correct1/23ms2704 KiB
6Runtime error0/23ms2872 KiB
7Wrong answer0/23ms2760 KiB
8Runtime error0/23ms2996 KiB
9Partially correct1/23ms3108 KiB
10Runtime error0/43ms3124 KiB
11Runtime error0/43ms3384 KiB
12Runtime error0/43ms3512 KiB
13Accepted4/43ms3608 KiB
14Wrong answer0/43ms3692 KiB
15Accepted4/43ms3932 KiB
16Wrong answer0/63ms3788 KiB
17Partially correct3/63ms3812 KiB