1362021-01-26 19:59:14kidesoKombináció (50)cpp11Accepted 50/502ms1952 KiB
#include <iostream>
#include <vector>

using namespace std;

int N, M, i;
vector <int> x;

int main()
{
	cin >> N >> M;
	x.resize(M + 2);
	
	for (i = 1; i <= M; ++i)
		cin >> x[i];
	
	x[0] = 0;
	x[M + 1] = N + 1;

	i = M;
	while (i > 0 && x[i] == x[i - 1] + 1)
		--i;

	for (int j = 1; j <= i - 1; ++j)
		cout << x[j] << ' ';

	if (i != 0) cout << x[i] - 1 << ' ';

	for (int j = i + 1; j <= M; ++j)
		cout << N - M + j << ' ';

	cout << '\n';

	i = M;
	while (i > 0 && x[i] == x[i + 1] - 1)
		--i;

	for (int j = 1; j <= i - 1; ++j)
		cout << x[j] << ' ';

	int k = x[i] + 1;
	if (i == 0) ++i;

	for (int j = i; j <= M; ++j)
	{
		cout << k << ' ';
		++k;
	}

	cout << '\n';

	
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1812 KiB
2Accepted0/01ms1848 KiB
3Accepted2/21ms1896 KiB
4Accepted2/21ms1896 KiB
5Accepted2/21ms1904 KiB
6Accepted2/21ms1904 KiB
7Accepted2/21ms1908 KiB
8Accepted2/21ms1916 KiB
9Accepted2/21ms1920 KiB
10Accepted4/41ms1928 KiB
11Accepted4/41ms1924 KiB
12Accepted4/41ms1932 KiB
13Accepted4/41ms1932 KiB
14Accepted4/41ms1940 KiB
15Accepted4/41ms1944 KiB
16Accepted6/61ms1940 KiB
17Accepted6/61ms1952 KiB