1372021-01-26 23:26:02kidesoKombináció (50)cpp11Accepted 50/501ms1908 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/01ms1800 KiB
2Accepted0/01ms1856 KiB
3Accepted2/21ms1904 KiB
4Accepted2/21ms1904 KiB
5Accepted2/21ms1900 KiB
6Accepted2/21ms1900 KiB
7Accepted2/21ms1796 KiB
8Accepted2/21ms1900 KiB
9Accepted2/21ms1796 KiB
10Accepted4/41ms1904 KiB
11Accepted4/41ms1796 KiB
12Accepted4/41ms1908 KiB
13Accepted4/41ms1796 KiB
14Accepted4/41ms1900 KiB
15Accepted4/41ms1900 KiB
16Accepted6/61ms1800 KiB
17Accepted6/61ms1796 KiB