248102026-02-15 20:11:12ProgramozoRokaMegrendelésekcpp17Wrong answer 0/504ms820 KiB
#include <iostream>
#include <vector>
#include<algorithm>

using namespace std;

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

	int n, m, k;
	cin >> n >> m >> k;
	tomb x;
	vector<tomb> t;
	vector<tomb> meg;
	for (int i = 0; i < m; ++i)
	{
		cin >> x.b;
		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();
	for (int i = 0 ; i < meg.size(); ++i) cout << meg[i].a << " " << meg[i].b << "\n";
	return 0;
}


SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer1ms316 KiB
2Wrong answer4ms820 KiB
subtask20/5
3Wrong answer1ms316 KiB
4Wrong answer1ms316 KiB
5Wrong answer1ms316 KiB
6Wrong answer1ms316 KiB
7Wrong answer1ms500 KiB
subtask30/5
8Wrong answer1ms316 KiB
9Wrong answer1ms408 KiB
10Wrong answer1ms316 KiB
11Wrong answer1ms508 KiB
12Wrong answer1ms316 KiB
subtask40/5
13Wrong answer1ms316 KiB
14Wrong answer3ms564 KiB
15Wrong answer2ms316 KiB
16Wrong answer2ms564 KiB
17Wrong answer1ms316 KiB
subtask50/10
18Wrong answer1ms316 KiB
19Wrong answer1ms316 KiB
20Wrong answer1ms316 KiB
21Wrong answer1ms316 KiB
22Wrong answer1ms344 KiB
23Wrong answer1ms316 KiB
24Wrong answer1ms316 KiB
25Wrong answer3ms564 KiB
26Wrong answer3ms564 KiB
27Wrong answer3ms568 KiB
subtask60/25
28Wrong answer2ms316 KiB
29Wrong answer1ms316 KiB
30Wrong answer2ms316 KiB
31Wrong answer3ms564 KiB
32Wrong answer4ms564 KiB
33Wrong answer3ms564 KiB
34Wrong answer4ms564 KiB
35Wrong answer4ms760 KiB
36Wrong answer4ms568 KiB
37Wrong answer4ms636 KiB
38Wrong answer3ms484 KiB
39Wrong answer1ms316 KiB
40Wrong answer2ms316 KiB
41Wrong answer4ms564 KiB
42Wrong answer2ms508 KiB
43Wrong answer3ms564 KiB
44Wrong answer4ms712 KiB
45Wrong answer2ms316 KiB
46Wrong answer2ms316 KiB
47Wrong answer3ms628 KiB
48Wrong answer4ms748 KiB
49Wrong answer4ms756 KiB
50Wrong answer4ms564 KiB
51Wrong answer4ms568 KiB
52Wrong answer4ms820 KiB