36782023-03-02 10:39:59gittyKombináció (50)cpp17Wrong answer 0/503ms4032 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 = x; j < n; j++){
                cout << j << " ";
            }

            break;

        }
    }*/


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1936 KiB
2Wrong answer0/03ms2184 KiB
3Wrong answer0/23ms2404 KiB
4Wrong answer0/22ms2516 KiB
5Wrong answer0/22ms2572 KiB
6Wrong answer0/22ms2776 KiB
7Wrong answer0/23ms3028 KiB
8Wrong answer0/22ms3108 KiB
9Wrong answer0/22ms3072 KiB
10Wrong answer0/43ms3200 KiB
11Wrong answer0/43ms3412 KiB
12Wrong answer0/42ms3500 KiB
13Wrong answer0/42ms3628 KiB
14Wrong answer0/43ms3864 KiB
15Wrong answer0/42ms3916 KiB
16Wrong answer0/62ms3920 KiB
17Wrong answer0/62ms4032 KiB