47182023-03-31 09:56:50csaron71Kombináció (50)cpp17Wrong answer 30/503ms4224 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> van(n+1, 0);
    vector<int> v(n+1);
    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
base30/50
1Wrong answer0/03ms1808 KiB
2Accepted0/03ms2060 KiB
3Wrong answer0/22ms2144 KiB
4Accepted2/23ms2212 KiB
5Partially correct1/23ms2432 KiB
6Partially correct1/23ms2636 KiB
7Accepted2/23ms2872 KiB
8Wrong answer0/23ms2988 KiB
9Partially correct1/23ms3176 KiB
10Partially correct2/42ms3232 KiB
11Partially correct2/43ms3472 KiB
12Partially correct2/42ms3440 KiB
13Accepted4/43ms3568 KiB
14Wrong answer0/43ms3656 KiB
15Accepted4/43ms3904 KiB
16Partially correct3/63ms4144 KiB
17Accepted6/62ms4224 KiB