47162023-03-31 09:55:16csaron71Kombináció (50)cpp17Runtime error 22/503ms3760 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++;
    }
    cout << masik << " ";
    for (int i=n-(m-hol)+2; i<=n; 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
base22/50
1Runtime error0/03ms1916 KiB
2Accepted0/03ms2004 KiB
3Wrong answer0/23ms2252 KiB
4Accepted2/22ms2300 KiB
5Partially correct1/23ms2540 KiB
6Runtime error0/23ms2736 KiB
7Partially correct1/23ms2876 KiB
8Runtime error0/23ms3100 KiB
9Partially correct1/22ms3068 KiB
10Runtime error0/43ms3424 KiB
11Runtime error0/43ms3688 KiB
12Runtime error0/43ms3760 KiB
13Accepted4/43ms3488 KiB
14Wrong answer0/43ms3468 KiB
15Accepted4/43ms3484 KiB
16Partially correct3/63ms3468 KiB
17Accepted6/63ms3464 KiB