39942023-03-07 19:16:35horvathabelKombináció (50)cpp17Wrong answer 34/503ms3688 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, m;
	cin>>n>>m;
	vector<int> v; 
	for (int i=0; i<m;i++){
		int x;
		 cin>>x;
		 v.push_back(x);
	}	
	vector<int> z=v;
	bool van=false; 
	for (int i=m-1;i>0;i--){
		if (v[i]-1!=v[i-1]){
			z[i]=z[i]-1;
			int cnt=n;
			for (int j=m-1; j>i;j--){
				z[j]=cnt;
				cnt--;
			}
			for (int h:z) cout<<h<<" "; 
			van=true;
			break;
		}
	}
	if (!van){
		z[0]=z[0]-1;
		for (int h:z) cout<<h<<" "; 

	}
	cout<<endl;
	bool van2=false;
	if (v[m-1]!=n){
		v[m-1]++;
		for (int h:v) cout<<h<<" "; ; 
	} 
	else {
		for (int i=m-2; i>=0;i--){
		if (v[i]+1!=v[i+1]){
			v[i]++;
			for (int h:v) cout<<h<<" "; 
			van2=true; 
			break; 
		}
	}
	
}
}
SubtaskSumTestVerdictTimeMemory
base34/50
1Accepted0/03ms1808 KiB
2Accepted0/03ms2004 KiB
3Wrong answer0/22ms2084 KiB
4Accepted2/23ms2216 KiB
5Partially correct1/22ms2300 KiB
6Wrong answer0/22ms2296 KiB
7Accepted2/23ms2428 KiB
8Wrong answer0/22ms2512 KiB
9Partially correct1/23ms2768 KiB
10Wrong answer0/42ms2976 KiB
11Accepted4/43ms3224 KiB
12Accepted4/42ms3308 KiB
13Accepted4/43ms3512 KiB
14Wrong answer0/43ms3492 KiB
15Accepted4/42ms3600 KiB
16Accepted6/62ms3572 KiB
17Accepted6/62ms3688 KiB