150662025-02-12 07:15:24BencuKombináció (50)cpp17Hibás válasz 37/501ms584 KiB
#include <bits/stdc++.h>

using namespace std;
int n,m,a[101];
ifstream f("be.in");

int main()
{
    cin>>n>>m;
    for (int i=1; i<=m; i++) cin>>a[i];
    //elozo
    if (a[m]==m) {
        for (int i=1; i<=m; i++) cout<<n-m+i<<" ";
        cout<<endl;
    }
    else {
        int j=1;
        while (a[j]==j) {
            cout<<a[j]<<" ";
            j++;
        }
        cout<<a[j]-1<<" ";
        j++;
        for (j; j<=m; j++) cout<<n-m+j<<" ";
        cout<<endl;
    }
    //kovetkezo
    if (a[1]==n-m+1) {
        for (int i=1; i<=m; i++) cout<<i<<" ";
    }
    else {
        int j=m,b[101];
        while (a[j]==n-m+j) j--;
        //cout<<j<<endl;
        a[j]=a[j]+1;
        for (int t=1; t<=j; t++) cout<<a[t]<<" ";
        for (int t=j+1; t<=m; t++) {
            a[t]=a[t-1]+1;
            cout<<a[t]<<" ";
        }
    }
    return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base37/50
1Hibás válasz0/01ms316 KiB
2Hibás válasz0/01ms316 KiB
3Elfogadva2/21ms500 KiB
4Elfogadva2/21ms316 KiB
5Elfogadva2/21ms316 KiB
6Elfogadva2/21ms584 KiB
7Részben helyes1/21ms316 KiB
8Elfogadva2/21ms576 KiB
9Elfogadva2/21ms316 KiB
10Elfogadva4/41ms316 KiB
11Részben helyes2/41ms316 KiB
12Részben helyes2/41ms316 KiB
13Elfogadva4/41ms316 KiB
14Elfogadva4/41ms316 KiB
15Részben helyes2/41ms316 KiB
16Részben helyes3/61ms316 KiB
17Részben helyes3/61ms316 KiB