39932023-03-07 19:15:09horvathabelKombináció (50)cpp17Wrong answer 30/503ms4492 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;
			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
base30/50
1Accepted0/03ms1948 KiB
2Wrong answer0/03ms2016 KiB
3Wrong answer0/22ms2256 KiB
4Accepted2/23ms2620 KiB
5Partially correct1/22ms2508 KiB
6Wrong answer0/23ms2812 KiB
7Partially correct1/23ms2812 KiB
8Wrong answer0/23ms2980 KiB
9Partially correct1/23ms3224 KiB
10Wrong answer0/43ms3308 KiB
11Accepted4/43ms3456 KiB
12Accepted4/42ms3540 KiB
13Accepted4/43ms3784 KiB
14Wrong answer0/43ms3876 KiB
15Accepted4/43ms4016 KiB
16Accepted6/62ms4096 KiB
17Partially correct3/63ms4492 KiB