36932023-03-02 10:57:56gittyKombináció (50)cpp17Wrong answer 38/503ms4120 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 = i; j <= m; j++){
                cout << a + j - i << " ";
            }

            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 - 1; j <= x-1+m-i; j++){
                cout << j + 1 << " ";
            }

//            for(int j = i; j <= m; j++){
//                cout << x + j - i << " ";
//            }

            break;

        }
    }

    /*cout << "\n";

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


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/03ms1808 KiB
2Wrong answer0/02ms2056 KiB
3Accepted2/23ms2276 KiB
4Accepted2/22ms2356 KiB
5Accepted2/22ms2440 KiB
6Partially correct1/22ms2524 KiB
7Partially correct1/22ms2644 KiB
8Accepted2/22ms2732 KiB
9Accepted2/22ms2860 KiB
10Partially correct2/42ms3076 KiB
11Partially correct2/42ms3304 KiB
12Accepted4/43ms3424 KiB
13Accepted4/42ms3660 KiB
14Accepted4/43ms3820 KiB
15Accepted4/43ms3916 KiB
16Partially correct3/62ms3996 KiB
17Partially correct3/63ms4120 KiB