252422026-02-18 19:12:20algoproFagyasztócpp17Wrong answer 0/753ms560 KiB
// UUID: dc6b3b04-6484-47fb-94df-4d5240432608
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
    vector<vector<int>> etel(n, vector<int>(2));
    vector<bool> used(n);
    for (int i = 0; i < n; i++) cin >> etel[i][0] >> etel[i][1];
    sort(etel.begin(), etel.end());

    int nap = 0;
    int i = 0;
    vector<pair<int, int>> inds;
    while (true) {
        while (i < n && (used[i] || nap > etel[i][0] || 4 > etel[i][1])) {
            i++;
        }
        //cout << i << " ";
        if (i == n) break;
        used[i] = true;

        int j = i + 1;
        while (j < n && (used[j] || 4 > etel[j][1] || etel[i][1] + etel[j][1] < 9)) {
            j++;
        }
        //cout << j << "\n";
        if (j == n) break;
        used[j] = true;
        inds.push_back({i+1, j+1});
        i++;
        nap++;
    }

    cout << nap << "\n";
    for (auto [a, b] : inds) {
        cout << a << " " << b << "\n";
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
subtask20/10
2Wrong answer1ms508 KiB
3Wrong answer1ms316 KiB
4Wrong answer1ms316 KiB
5Accepted1ms316 KiB
6Partially correct1ms316 KiB
7Partially correct1ms316 KiB
8Partially correct1ms508 KiB
9Accepted1ms316 KiB
10Partially correct1ms316 KiB
11Accepted1ms400 KiB
subtask30/20
12Accepted1ms316 KiB
13Accepted1ms316 KiB
14Partially correct1ms560 KiB
15Accepted1ms316 KiB
16Accepted1ms316 KiB
17Wrong answer1ms316 KiB
18Wrong answer1ms316 KiB
19Wrong answer1ms316 KiB
20Wrong answer1ms316 KiB
21Wrong answer1ms316 KiB
22Wrong answer1ms316 KiB
23Wrong answer2ms332 KiB
24Wrong answer2ms316 KiB
25Wrong answer1ms316 KiB
26Wrong answer2ms528 KiB
27Wrong answer3ms316 KiB
28Wrong answer2ms344 KiB
29Wrong answer1ms316 KiB
30Wrong answer2ms464 KiB
31Wrong answer2ms508 KiB
subtask40/15
32Accepted2ms512 KiB
33Accepted2ms500 KiB
34Wrong answer2ms500 KiB
35Wrong answer2ms316 KiB
36Wrong answer1ms316 KiB
37Wrong answer1ms316 KiB
38Wrong answer1ms316 KiB
39Wrong answer1ms316 KiB
40Wrong answer1ms544 KiB
41Wrong answer2ms508 KiB
42Wrong answer2ms316 KiB
43Wrong answer2ms316 KiB
44Wrong answer1ms316 KiB
45Wrong answer1ms424 KiB
46Wrong answer2ms316 KiB
subtask50/15
47Wrong answer1ms316 KiB
48Wrong answer2ms316 KiB
49Wrong answer1ms500 KiB
50Wrong answer1ms316 KiB
51Wrong answer1ms316 KiB
52Wrong answer1ms500 KiB
53Wrong answer1ms316 KiB
54Wrong answer1ms316 KiB
55Partially correct1ms316 KiB
56Wrong answer1ms500 KiB
57Wrong answer1ms404 KiB
58Wrong answer1ms316 KiB
59Wrong answer1ms316 KiB
60Wrong answer1ms316 KiB
61Wrong answer1ms552 KiB
subtask60/15
62Wrong answer1ms316 KiB
63Wrong answer1ms316 KiB
64Wrong answer2ms316 KiB
65Wrong answer2ms316 KiB
66Wrong answer3ms316 KiB
67Wrong answer2ms316 KiB
68Wrong answer2ms316 KiB
69Wrong answer1ms512 KiB
70Wrong answer1ms316 KiB
71Wrong answer2ms316 KiB
72Wrong answer1ms316 KiB
73Wrong answer2ms448 KiB
74Wrong answer2ms316 KiB
75Wrong answer1ms316 KiB
76Wrong answer1ms316 KiB