36842023-03-02 10:48:09gittyKombináció (50)cpp17Wrong answer 20/503ms3480 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    //ifstream cin("in.txt");

    int n, m;
    cin >> n >> m;

    vector<int> v(m + 1, 0);

    for(int i = 1; i <= m; i++){
        cin >> v[i];
    }

    /// lefele:

    for(int i = m; i >= 0; i--){
        if(i == 0){
            for(int j = n - m + 1; j <= n; j++){
                cout << j << " ";
            }
        }
        else if(v[i] - 1 != v[i - 1]){

            int x = m - i + 1;

            int a = v[i] - 1;

            for(int j = 1; j < i; j++){
                cout << v[j] << " ";
            }

            for(int j = 0; j < x; j++){
                cout << a + j << " ";
            }

            break;
        }
    }

    cout << "\n";

    /// felfele:
    for(int i = m; i >= 0; i--){

        if(i == 0){
            for(int j = 1; j <= m; j++){
                cout << j << " ";
            }
        }
        else if(v[i] + 1 <= n - m + i){
            int x = v[i] + 1;

            for(int j = 1; j < i; j++){
                cout << v[j] << " ";
            }

            for(int j = i+1; j < n; j++){
                cout << j + 1 << " ";
            }

            break;

        }
    }

    /*cout << "\n";

    for(int i = 1; i <= m; i++){
        cout << i << " ";
    }*/


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base20/50
1Accepted0/03ms1808 KiB
2Wrong answer0/03ms2060 KiB
3Accepted2/23ms2308 KiB
4Partially correct1/22ms2352 KiB
5Partially correct1/22ms2552 KiB
6Partially correct1/22ms2632 KiB
7Wrong answer0/22ms2628 KiB
8Accepted2/23ms2784 KiB
9Partially correct1/22ms2728 KiB
10Partially correct2/42ms2620 KiB
11Wrong answer0/43ms2888 KiB
12Partially correct2/42ms3020 KiB
13Partially correct2/42ms3088 KiB
14Accepted4/42ms3184 KiB
15Partially correct2/42ms3400 KiB
16Wrong answer0/62ms3480 KiB
17Wrong answer0/62ms3476 KiB