248132026-02-15 20:17:52ProgramozoRokaMegrendelésekcpp17Wrong answer 0/504ms820 KiB
#include <iostream>
#include <vector>
#include<algorithm>
#include <cstdio>

using namespace std;
inline int r() {
	int x = 0;
	char c = getchar(); // Windows-on getchar(), Linux-on getchar_unlocked() még gyorsabb

	while (c < '0' || c > '9') {
		c = getchar();
	}

	while (c >= '0' && c <= '9') {
		x = (x << 3) + (x << 1) + (c - '0');
		c = getchar();
	}
	return x;
}

struct tomb
{
	int a;
	int b;
};
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n, m, k;
	n = r(); m = r(); k = r();
	tomb x;
	vector<tomb> t;
	vector<tomb> meg;
	for (int i = 0; i < m; ++i)
	{
		x.b = r();
		x.a = i + 1;
		t.push_back(x);
	}
	sort(t.begin(), t.end(), [](const tomb& g, const tomb& h) { return g.b < h.b; });
	int szam = 0;
	for (int nap = 1; nap <= n; ++nap)
	{
		for (int i = 0; i < k and szam < m; ++i)
		{
			if (t[szam].b >= nap)
			{
				t[szam].b = nap;
				meg.push_back(t[szam]);
				++szam;
			}
			else
			{
				while (!(t[szam].b >= nap) and szam < m) ++szam;
				if (szam < m)
				{
					t[szam].b = nap;
					meg.push_back(t[szam]);
					++szam;
				}
			}
		}
	}
	cout << meg.size() << endl;
	printf("%d\n", (int)meg.size());
	for (const auto& m : meg) {
		printf("%d %d\n", m.a, m.b);
	}
	return 0;
}


SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer1ms316 KiB
2Wrong answer4ms820 KiB
subtask20/5
3Wrong answer1ms324 KiB
4Wrong answer1ms316 KiB
5Wrong answer1ms508 KiB
6Wrong answer1ms316 KiB
7Wrong answer1ms316 KiB
subtask30/5
8Wrong answer1ms316 KiB
9Wrong answer1ms316 KiB
10Wrong answer1ms316 KiB
11Wrong answer1ms316 KiB
12Wrong answer1ms316 KiB
subtask40/5
13Wrong answer1ms316 KiB
14Wrong answer3ms564 KiB
15Wrong answer2ms520 KiB
16Wrong answer2ms564 KiB
17Wrong answer2ms316 KiB
subtask50/10
18Wrong answer1ms532 KiB
19Wrong answer1ms316 KiB
20Wrong answer1ms316 KiB
21Wrong answer1ms316 KiB
22Wrong answer1ms316 KiB
23Wrong answer1ms500 KiB
24Wrong answer1ms316 KiB
25Wrong answer2ms564 KiB
26Wrong answer2ms564 KiB
27Wrong answer2ms564 KiB
subtask60/25
28Wrong answer1ms500 KiB
29Wrong answer1ms508 KiB
30Wrong answer1ms316 KiB
31Wrong answer3ms564 KiB
32Wrong answer4ms564 KiB
33Wrong answer3ms564 KiB
34Wrong answer4ms748 KiB
35Wrong answer4ms564 KiB
36Wrong answer4ms628 KiB
37Wrong answer4ms564 KiB
38Wrong answer3ms428 KiB
39Wrong answer1ms316 KiB
40Wrong answer2ms316 KiB
41Wrong answer3ms652 KiB
42Wrong answer1ms316 KiB
43Wrong answer2ms564 KiB
44Wrong answer4ms568 KiB
45Wrong answer2ms396 KiB
46Wrong answer3ms316 KiB
47Wrong answer3ms580 KiB
48Wrong answer4ms564 KiB
49Wrong answer4ms564 KiB
50Wrong answer4ms756 KiB
51Wrong answer4ms780 KiB
52Wrong answer4ms564 KiB