47242023-03-31 10:03:06csaron71Kombináció (50)cpp17Wrong answer 30/503ms3624 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 (v[hol]>0 && 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 (v[epp]<n+1 && 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/23ms2268 KiB
4Accepted2/23ms2484 KiB
5Partially correct1/23ms2636 KiB
6Partially correct1/23ms2724 KiB
7Accepted2/23ms2896 KiB
8Wrong answer0/23ms2820 KiB
9Partially correct1/23ms2816 KiB
10Partially correct2/43ms2976 KiB
11Partially correct2/42ms3044 KiB
12Partially correct2/43ms3296 KiB
13Accepted4/43ms3508 KiB
14Wrong answer0/43ms3620 KiB
15Accepted4/43ms3624 KiB
16Partially correct3/63ms3500 KiB
17Accepted6/63ms3600 KiB