39922023-03-07 19:09:51horvathabelKombináció (50)cpp17Wrong answer 27/503ms4136 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; 
	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; 
		}
	}
	if (!van2){
		v[m-1]++;
		for (int h:v) cout<<h<<" "; ; 
	}
}
SubtaskSumTestVerdictTimeMemory
base27/50
1Accepted0/03ms1812 KiB
2Wrong answer0/02ms2052 KiB
3Wrong answer0/23ms2304 KiB
4Accepted2/23ms2544 KiB
5Partially correct1/23ms2752 KiB
6Partially correct1/23ms3004 KiB
7Wrong answer0/22ms2992 KiB
8Wrong answer0/22ms3192 KiB
9Partially correct1/22ms3280 KiB
10Partially correct2/43ms3376 KiB
11Accepted4/43ms3616 KiB
12Accepted4/42ms3672 KiB
13Accepted4/43ms3800 KiB
14Wrong answer0/43ms3916 KiB
15Partially correct2/43ms3996 KiB
16Accepted6/63ms4024 KiB
17Wrong answer0/63ms4136 KiB