233522026-01-20 13:11:02mihalykocsisFagyasztócpp17Wrong answer 0/759ms580 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
	int n;cin>>n;int ans = 0;
    vector<pair<int,int>>kaja;
    vector<int>ansok;
    vector<bool>volt(n);
    for(int i = 0;i<n;i++){
        int x,y;cin>>x>>y;
        if(y >= 4){
            kaja.push_back(make_pair(x,y));
        }
    }
    for(int i = 0;i <kaja.size();i++){
        for(int j =0;j<kaja.size();j++){
            if(kaja[i].first >= ans&&kaja[j].first>=ans &&kaja[i].second +kaja[j].second>8 &&j!=i&&!volt[i]&&!volt[j]){
                ans++;ansok.push_back(i+1);ansok.push_back(j+1);
                volt[i]=true;volt[j]=true;
            }
        }
    }
    cout << ans<<"\n";
    for(int i = 0;i < ansok.size();i+=2){
        cout << ansok[i] << " "<<ansok[i+1]<<"\n";
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
subtask20/10
2Wrong answer2ms316 KiB
3Wrong answer1ms316 KiB
4Wrong answer2ms508 KiB
5Accepted1ms316 KiB
6Accepted1ms316 KiB
7Partially correct1ms316 KiB
8Accepted1ms316 KiB
9Partially correct1ms500 KiB
10Accepted1ms372 KiB
11Accepted1ms324 KiB
subtask30/20
12Accepted1ms316 KiB
13Accepted1ms316 KiB
14Partially correct1ms316 KiB
15Accepted1ms316 KiB
16Accepted1ms316 KiB
17Wrong answer1ms316 KiB
18Wrong answer1ms316 KiB
19Wrong answer1ms316 KiB
20Wrong answer2ms508 KiB
21Wrong answer2ms316 KiB
22Wrong answer1ms316 KiB
23Wrong answer6ms436 KiB
24Wrong answer4ms440 KiB
25Wrong answer3ms316 KiB
26Wrong answer1ms316 KiB
27Wrong answer7ms580 KiB
28Wrong answer9ms448 KiB
29Wrong answer1ms316 KiB
30Wrong answer3ms316 KiB
31Wrong answer6ms528 KiB
subtask40/15
32Partially correct1ms316 KiB
33Accepted1ms508 KiB
34Wrong answer1ms316 KiB
35Wrong answer1ms316 KiB
36Wrong answer1ms316 KiB
37Wrong answer2ms428 KiB
38Wrong answer1ms316 KiB
39Wrong answer1ms420 KiB
40Wrong answer1ms316 KiB
41Wrong answer3ms436 KiB
42Wrong answer2ms432 KiB
43Wrong answer4ms508 KiB
44Wrong answer1ms316 KiB
45Wrong answer2ms316 KiB
46Wrong answer4ms348 KiB
subtask50/15
47Wrong answer1ms568 KiB
48Wrong answer2ms316 KiB
49Wrong answer2ms316 KiB
50Wrong answer1ms316 KiB
51Wrong answer1ms552 KiB
52Wrong answer1ms316 KiB
53Wrong answer2ms316 KiB
54Wrong answer2ms316 KiB
55Partially correct1ms316 KiB
56Wrong answer2ms316 KiB
57Wrong answer1ms316 KiB
58Wrong answer1ms508 KiB
59Wrong answer1ms316 KiB
60Wrong answer1ms316 KiB
61Wrong answer1ms316 KiB
subtask60/15
62Wrong answer1ms508 KiB
63Wrong answer2ms316 KiB
64Wrong answer3ms316 KiB
65Wrong answer7ms448 KiB
66Wrong answer8ms316 KiB
67Wrong answer2ms508 KiB
68Wrong answer2ms316 KiB
69Wrong answer1ms316 KiB
70Wrong answer2ms316 KiB
71Wrong answer4ms316 KiB
72Wrong answer2ms316 KiB
73Wrong answer3ms316 KiB
74Wrong answer4ms500 KiB
75Wrong answer2ms384 KiB
76Wrong answer1ms316 KiB