QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#815097#8921. Интерактивные переходыucup-team0046 45ms12860kbC++231.8kb2024-12-15 03:46:032024-12-15 03:46:03

Judging History

你现在查看的是最新测评结果

  • [2024-12-15 03:46:03]
  • 评测
  • 测评结果:6
  • 用时:45ms
  • 内存:12860kb
  • [2024-12-15 03:46:03]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;

void solve() {
    int n, m;
    std::cin >> n >> m;
    
    std::vector<int> a(m), b(m), c(m);
    for (int i = 0; i < m; i++) {
        std::cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
    }
    
    std::vector<int> d(n);
    for (int i = 0; i < n; i++) {
        std::cin >> d[i];
    }
    
    std::vector<std::array<int, 2>> ans;
    for (int i = 0; i < n; i++) {
        if (d[i] == 0) {
            ans.push_back({i + 1, 1});
        }
    }
    std::vector<std::vector<int>> adj(n);
    std::vector<int> deg(n);
    for (int i = 0; i < m; i++) {
        if (d[a[i]] != d[b[i]]) {
            if (c[i] == d[a[i]]) {
                adj[a[i]].push_back(b[i]);
                deg[b[i]]++;
            } else {
                adj[b[i]].push_back(a[i]);
                deg[a[i]]++;
            }
        }
    }
    
    std::vector<int> q;
    for (int i = 0; i < n; i++) {
        if (deg[i] == 0) {
            q.push_back(i);
        }
    }
    for (int i = 0; i < q.size(); i++) {
        int x = q[i];
        for (auto y : adj[x]) {
            if (--deg[y] == 0) {
                q.push_back(y);
            }
        }
    }
    if (q.size() != n) {
        std::cout << "NO\n";
        return;
    }
    for (auto i : q) {
        ans.push_back({i + 1, d[i]});
    }
    
    std::cout << "YES\n";
    std::cout << ans.size() << "\n";
    for (auto [x, y] : ans) {
        std::cout << x << " " << y << "\n";
    }
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3568kb

input:

230
1 0
0
1 0
1
2 0
0 0
2 0
1 0
2 0
0 1
2 0
1 1
2 1
1 2 1
0 0
2 1
1 2 1
1 0
2 1
1 2 1
0 1
2 1
1 2 1
1 1
2 1
1 2 0
0 0
2 1
1 2 0
1 0
2 1
1 2 0
0 1
2 1
1 2 0
1 1
3 0
0 0 0
3 0
1 0 0
3 0
0 1 0
3 0
1 1 0
3 0
0 0 1
3 0
1 0 1
3 0
0 1 1
3 0
1 1 1
3 1
1 2 1
0 0 0
3 1
1 2 1
1 0 0
3 1
1 2 1
0 1 0
3 1
1 2 1
1 ...

output:

YES
2
1 1
1 0
YES
1
1 1
YES
4
1 1
2 1
1 0
2 0
YES
3
2 1
1 1
2 0
YES
3
1 1
1 0
2 1
YES
2
1 1
2 1
YES
4
1 1
2 1
1 0
2 0
YES
3
2 1
1 1
2 0
YES
3
1 1
2 1
1 0
YES
2
1 1
2 1
YES
4
1 1
2 1
1 0
2 0
YES
3
2 1
2 0
1 1
YES
3
1 1
1 0
2 1
YES
2
1 1
2 1
YES
6
1 1
2 1
3 1
1 0
2 0
3 0
YES
5
2 1
3 1
1 1
2 0
3 0
YES
...

result:

wrong answer incorrect edge color (test case 7)

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 3556kb

input:

222
5 9
1 2 1
2 4 1
3 5 0
4 5 1
2 3 0
3 4 0
1 3 0
2 5 1
1 4 1
1 0 0 1 1
5 9
2 5 0
1 2 0
2 3 0
1 4 0
3 5 1
3 4 0
2 4 0
1 5 0
1 3 0
0 0 1 0 0
5 9
3 4 0
1 2 0
3 5 1
2 4 0
1 3 0
2 5 0
2 3 0
1 4 0
4 5 1
0 0 0 0 1
5 9
3 5 0
2 3 0
1 2 0
3 4 0
1 3 0
2 4 1
4 5 1
1 5 0
2 5 0
0 0 0 1 0
5 9
1 3 0
2 4 1
1 2 0
4 ...

output:

YES
7
2 1
3 1
3 0
5 1
4 1
1 1
2 0
YES
9
1 1
2 1
4 1
5 1
1 0
2 0
4 0
3 1
5 0
YES
9
1 1
2 1
3 1
4 1
1 0
2 0
5 1
3 0
4 0
YES
9
1 1
2 1
3 1
5 1
1 0
3 0
4 1
2 0
5 0
YES
7
1 1
5 1
1 0
4 1
5 0
3 1
2 1
YES
7
3 1
5 1
3 0
5 0
4 1
2 1
1 1
YES
7
3 1
5 1
2 1
4 1
5 0
3 0
1 1
YES
7
1 1
5 1
2 1
3 1
5 0
1 0
4 1
YES
...

result:

wrong answer incorrect edge color (test case 57)

Subtask #3:

score: 0
Wrong Answer

Test #6:

score: 8
Accepted
time: 27ms
memory: 3560kb

input:

4000
20 25
14 18 1
14 16 1
2 18 1
2 3 1
11 17 1
4 17 1
10 14 1
2 7 1
11 12 1
6 8 1
15 20 1
6 17 1
7 8 1
7 9 1
7 16 1
17 19 1
1 17 1
12 17 1
2 17 1
11 20 1
3 8 1
11 19 1
5 14 1
2 13 1
3 16 1
1 1 0 1 1 1 1 1 0 1 1 0 0 0 1 1 1 1 1 1
20 25
3 15 1
12 17 1
5 12 1
9 14 1
15 17 1
9 10 1
5 14 1
7 20 1
10 18 ...

output:

YES
25
3 1
9 1
12 1
13 1
14 1
1 1
2 1
4 1
5 1
6 1
7 1
8 1
10 1
11 1
15 1
16 1
17 1
18 1
19 1
20 1
13 0
9 0
3 0
12 0
14 0
YES
28
1 1
2 1
3 1
5 1
11 1
13 1
18 1
20 1
1 0
4 1
6 1
7 1
8 1
9 1
10 1
12 1
14 1
15 1
16 1
17 1
19 1
13 0
2 0
18 0
20 0
3 0
11 0
5 0
YES
27
4 1
8 1
9 1
10 1
11 1
12 1
20 1
1 1
2 ...

result:

ok ok (4000 test cases)

Test #7:

score: 0
Wrong Answer
time: 32ms
memory: 10968kb

input:

1
100000 99999
1 87012 1
1 87571 1
2 73382 1
3 3711 1
3 15350 1
3 46773 1
3 56986 1
5 38515 1
5 70500 1
5 85371 1
6 7257 1
6 16656 1
6 47387 1
6 72385 1
6 90108 1
7 14999 1
7 61148 1
7 75467 1
7 87271 1
9 65212 1
9 67960 1
10 7122 1
10 21728 1
11 5206 1
11 24063 1
11 32274 1
12 69255 1
13 48758 1
13...

output:

YES
150134
2 1
4 1
7 1
10 1
11 1
12 1
13 1
14 1
15 1
18 1
21 1
24 1
25 1
28 1
30 1
32 1
34 1
36 1
37 1
38 1
41 1
45 1
46 1
49 1
50 1
55 1
56 1
58 1
59 1
61 1
62 1
63 1
64 1
65 1
68 1
69 1
70 1
73 1
74 1
77 1
81 1
82 1
83 1
84 1
85 1
87 1
88 1
91 1
93 1
96 1
99 1
101 1
102 1
103 1
107 1
109 1
110 1
1...

result:

wrong answer incorrect edge color (test case 1)

Subtask #4:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 29ms
memory: 3568kb

input:

10000
10 9
1 2 0
1 3 0
1 4 0
1 5 0
1 6 0
1 7 0
1 8 0
1 9 0
1 10 0
0 0 0 0 0 0 1 1 0 0
10 9
1 2 1
1 3 0
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 0
1 1 0 0 1 1 1 0 1 0
10 9
1 2 1
1 3 1
1 4 1
1 5 1
1 6 1
1 7 1
1 8 1
1 9 1
1 10 1
1 0 0 0 1 1 0 0 1 0
10 9
1 2 0
1 3 0
1 4 1
1 5 1
1 6 0
1 7 1
1 8 1
1 9 1
1...

output:

YES
18
1 1
2 1
3 1
4 1
5 1
6 1
9 1
10 1
1 0
2 0
3 0
4 0
5 0
6 0
9 0
10 0
7 1
8 1
YES
14
3 1
4 1
8 1
10 1
2 1
3 0
5 1
6 1
7 1
9 1
10 0
1 1
4 0
8 0
YES
16
2 1
3 1
4 1
7 1
8 1
10 1
1 1
5 1
6 1
9 1
2 0
3 0
4 0
7 0
8 0
10 0
YES
14
1 1
2 1
3 1
6 1
2 0
3 0
4 1
5 1
6 0
7 1
8 1
9 1
10 1
1 0
YES
12
8 1
10 1
2...

result:

wrong answer incorrect edge color (test case 708)

Subtask #5:

score: 6
Accepted

Test #14:

score: 6
Accepted
time: 45ms
memory: 12860kb

input:

1
100000 199997
1 19238 0
1 42340 0
1 50103 0
1 72140 0
1 94374 0
2 918 1
2 30562 1
2 48451 1
2 53070 1
2 77905 1
3 56418 0
3 61803 0
4 19423 0
4 33995 0
4 64168 0
4 83220 0
4 87239 0
5 24531 1
5 45512 1
6 23321 1
6 34013 1
6 36584 1
6 37278 1
7 16740 1
7 23485 1
7 63378 1
7 71568 1
7 80434 1
7 8103...

output:

YES
149880
1 1
3 1
4 1
14 1
16 1
21 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
32 1
36 1
37 1
38 1
40 1
41 1
44 1
46 1
47 1
48 1
49 1
50 1
52 1
54 1
55 1
59 1
60 1
62 1
66 1
67 1
69 1
71 1
72 1
73 1
75 1
76 1
77 1
78 1
79 1
80 1
82 1
84 1
87 1
88 1
91 1
95 1
96 1
100 1
102 1
103 1
105 1
108 1
109 1
113 1
...

result:

ok ok (1 test case)

Test #15:

score: 6
Accepted
time: 44ms
memory: 12152kb

input:

1
100000 199990
1 12954 0
1 34837 0
1 56925 0
2 2727 0
2 23291 0
2 34498 0
2 83496 0
3 18494 0
3 38160 0
3 95686 0
4 4643 0
4 42952 0
4 60758 0
4 74112 0
5 5226 0
5 99964 0
6 25938 0
6 29934 0
6 95643 0
7 12538 0
7 15788 0
7 36142 0
7 83988 0
7 87408 0
8 51940 0
8 89269 0
8 95253 0
9 8664 0
9 46696 ...

output:

YES
189929
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
40 1
41 1
42 1
43 1
44 1
45 1
47 1
49 1
50 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
61 1
62 1
63 1
64 1
65 1
66 1
67 1
68 ...

result:

ok ok (1 test case)

Test #16:

score: 6
Accepted
time: 33ms
memory: 11200kb

input:

1
100000 199993
1 35659 1
1 40405 1
1 42576 1
1 59472 1
1 93456 1
2 5554 1
2 13807 1
2 16320 1
2 72601 1
2 89825 1
4 39136 1
4 56509 1
4 91423 1
5 8219 1
5 38830 1
5 42490 1
5 85394 1
5 99701 1
6 9204 0
6 25338 0
6 33566 0
6 56606 0
6 63549 0
7 3241 1
7 52579 1
7 75681 1
7 97174 1
8 18865 1
8 30353 ...

output:

YES
109833
3 1
6 1
17 1
18 1
44 1
48 1
49 1
50 1
63 1
73 1
79 1
85 1
120 1
125 1
129 1
147 1
154 1
164 1
168 1
169 1
181 1
188 1
193 1
208 1
211 1
226 1
237 1
253 1
261 1
265 1
267 1
277 1
285 1
293 1
302 1
303 1
312 1
358 1
359 1
386 1
389 1
396 1
416 1
422 1
430 1
441 1
461 1
476 1
481 1
482 1
484...

result:

ok ok (1 test case)

Test #17:

score: 6
Accepted
time: 38ms
memory: 9664kb

input:

1
50000 199980
1 5699 0
1 7972 0
1 12001 0
1 21408 0
1 22748 0
1 23379 0
1 28184 0
1 34803 0
1 36835 0
1 47782 0
2 4067 1
2 4247 1
2 5958 1
2 10022 1
2 13882 1
2 18781 1
2 22215 1
2 29259 1
2 40478 1
2 47186 1
3 10820 0
3 11187 0
3 13770 0
3 14191 0
3 31138 0
3 32240 0
3 41566 0
3 46910 0
3 46981 0
...

output:

YES
74849
1 1
3 1
4 1
13 1
17 1
20 1
23 1
24 1
25 1
26 1
28 1
29 1
35 1
36 1
37 1
38 1
39 1
40 1
43 1
44 1
45 1
49 1
51 1
52 1
55 1
56 1
59 1
60 1
63 1
64 1
65 1
67 1
69 1
70 1
72 1
74 1
75 1
76 1
77 1
81 1
82 1
85 1
86 1
87 1
88 1
91 1
92 1
98 1
100 1
101 1
102 1
105 1
106 1
107 1
109 1
110 1
112 1...

result:

ok ok (1 test case)

Test #18:

score: 6
Accepted
time: 29ms
memory: 9048kb

input:

1
50000 199984
1 25616 0
1 28351 0
1 32669 0
1 39879 0
1 40034 0
1 46455 0
2 3271 0
2 6427 0
2 14884 0
2 16854 0
2 17651 0
2 32673 0
2 41393 0
2 43967 0
2 44086 0
2 44357 0
3 2536 1
3 7684 1
3 12630 1
3 15608 1
3 17831 1
3 18085 1
3 18694 1
3 18753 1
3 26697 1
3 31231 1
3 41382 1
3 41549 1
3 43442 1...

output:

YES
95146
1 1
2 1
4 1
5 1
6 1
8 1
10 1
11 1
13 1
14 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
44 1
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 1
62 1
63 1
64 1
66 1
6...

result:

ok ok (1 test case)

Test #19:

score: 6
Accepted
time: 34ms
memory: 8532kb

input:

1
50000 199987
1 7346 1
1 9333 1
1 10752 1
1 22449 1
1 26223 1
1 31067 1
1 36063 1
1 39164 1
2 26857 1
2 27426 1
2 45924 1
2 49776 1
3 3534 1
3 4872 1
3 11112 1
3 18587 1
3 19344 1
3 46857 1
4 5591 1
4 10896 1
4 28314 1
4 32866 1
4 36674 1
4 42045 1
5 2392 1
5 17180 1
5 31349 1
5 34495 1
5 40344 1
5...

output:

YES
55003
12 1
32 1
34 1
43 1
44 1
46 1
47 1
48 1
56 1
62 1
73 1
75 1
86 1
97 1
104 1
110 1
121 1
148 1
164 1
167 1
190 1
214 1
231 1
277 1
289 1
292 1
301 1
318 1
333 1
337 1
339 1
343 1
348 1
351 1
392 1
394 1
402 1
404 1
412 1
427 1
436 1
441 1
446 1
452 1
453 1
455 1
498 1
515 1
539 1
545 1
552 ...

result:

ok ok (1 test case)

Test #20:

score: 6
Accepted
time: 32ms
memory: 10096kb

input:

1
100000 199995
1 11260 1
1 36669 1
1 65689 1
2 40027 1
3 11510 1
3 22649 1
3 41557 1
3 55383 1
3 94145 1
4 29777 1
4 34184 1
4 82941 1
4 98660 1
5 70248 1
6 1352 1
6 41406 1
6 50445 1
6 61232 1
6 67229 1
7 24577 1
7 36777 1
7 54446 1
8 5817 1
8 48484 1
9 37743 1
9 41038 1
9 57888 1
9 91818 1
10 708...

output:

YES
100000
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
44 1
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 ...

result:

ok ok (1 test case)

Test #21:

score: 6
Accepted
time: 43ms
memory: 11560kb

input:

1
100000 199997
1 5769 0
1 6630 0
1 16266 0
1 87415 0
2 23456 0
2 34333 0
2 56018 0
2 58848 0
3 958 0
4 19451 0
4 40396 0
5 23284 0
5 37108 0
6 40220 0
6 53501 0
6 66616 0
6 78456 0
6 98427 0
7 15922 0
7 63343 0
7 73387 0
7 89652 0
8 20051 0
8 39219 0
8 75071 0
9 2884 0
9 53733 0
9 54398 0
9 68547 0...

output:

YES
200000
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
27 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
44 1
45 1
46 1
47 1
48 1
49 1
50 1
51 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 ...

result:

ok ok (1 test case)

Subtask #6:

score: 0
Wrong Answer

Test #22:

score: 0
Wrong Answer
time: 1ms
memory: 4032kb

input:

1
2000 1999
1 2 0
2 3 0
3 4 0
4 5 1
5 6 0
6 7 0
7 8 0
8 9 1
9 10 1
10 11 1
11 12 0
12 13 0
13 14 0
14 15 0
15 16 0
16 17 0
17 18 0
18 19 1
19 20 1
20 21 1
21 22 1
22 23 0
23 24 1
24 25 1
25 26 1
26 27 1
27 28 0
28 29 1
29 30 0
30 31 1
31 32 0
32 33 0
33 34 1
34 35 0
35 36 1
36 37 0
37 38 0
38 39 1
3...

output:

YES
2986
1 1
3 1
4 1
5 1
6 1
7 1
8 1
12 1
13 1
16 1
17 1
18 1
19 1
21 1
22 1
25 1
27 1
28 1
30 1
34 1
37 1
38 1
40 1
44 1
50 1
52 1
54 1
58 1
60 1
64 1
66 1
69 1
70 1
72 1
73 1
76 1
80 1
83 1
84 1
85 1
86 1
88 1
90 1
91 1
92 1
94 1
95 1
97 1
98 1
99 1
101 1
102 1
110 1
111 1
112 1
113 1
117 1
118 1
...

result:

wrong answer incorrect edge color (test case 1)

Subtask #7:

score: 0
Skipped

Dependency #6:

0%

Subtask #8:

score: 0
Skipped

Dependency #6:

0%

Subtask #9:

score: 0
Skipped

Dependency #4:

0%

Subtask #10:

score: 0
Wrong Answer

Test #50:

score: 6
Accepted
time: 16ms
memory: 11044kb

input:

1
100000 100000
1 2 0
2 3 1
3 4 0
4 5 1
5 6 0
6 7 1
7 8 0
8 9 1
9 10 0
10 11 1
11 12 0
12 13 1
13 14 0
14 15 1
15 16 0
16 17 1
17 18 0
18 19 1
19 20 0
20 21 1
21 22 0
22 23 1
23 24 0
24 25 1
25 26 0
26 27 1
27 28 0
28 29 1
29 30 0
30 31 1
31 32 0
32 33 1
33 34 0
34 35 1
35 36 0
36 37 1
37 38 0
38 39...

output:

NO

result:

ok ok (1 test case)

Test #51:

score: 6
Accepted
time: 16ms
memory: 10984kb

input:

1
100000 100000
1 2 0
2 3 1
3 4 0
4 5 1
5 6 0
6 7 1
7 8 0
8 9 1
9 10 0
10 11 1
11 12 0
12 13 1
13 14 0
14 15 1
15 16 0
16 17 1
17 18 0
18 19 1
19 20 0
20 21 1
21 22 0
22 23 1
23 24 0
24 25 1
25 26 0
26 27 1
27 28 0
28 29 1
29 30 0
30 31 1
31 32 0
32 33 1
33 34 0
34 35 1
35 36 0
36 37 1
37 38 0
38 39...

output:

NO

result:

ok ok (1 test case)

Test #52:

score: 6
Accepted
time: 20ms
memory: 10984kb

input:

1
100000 100000
1 2 1
2 3 0
3 4 1
4 5 0
5 6 1
6 7 0
7 8 1
8 9 0
9 10 1
10 11 0
11 12 1
12 13 0
13 14 1
14 15 0
15 16 1
16 17 0
17 18 1
18 19 0
19 20 1
20 21 0
21 22 1
22 23 0
23 24 1
24 25 0
25 26 1
26 27 0
27 28 1
28 29 0
29 30 1
30 31 0
31 32 1
32 33 0
33 34 1
34 35 0
35 36 1
36 37 0
37 38 1
38 39...

output:

NO

result:

ok ok (1 test case)

Test #53:

score: 6
Accepted
time: 15ms
memory: 10952kb

input:

1
100000 100000
1 2 1
2 3 0
3 4 1
4 5 0
5 6 1
6 7 0
7 8 1
8 9 0
9 10 1
10 11 0
11 12 1
12 13 0
13 14 1
14 15 0
15 16 1
16 17 0
17 18 1
18 19 0
19 20 1
20 21 0
21 22 1
22 23 0
23 24 1
24 25 0
25 26 1
26 27 0
27 28 1
28 29 0
29 30 1
30 31 0
31 32 1
32 33 0
33 34 1
34 35 0
35 36 1
36 37 0
37 38 1
38 39...

output:

NO

result:

ok ok (1 test case)

Test #54:

score: 0
Wrong Answer
time: 32ms
memory: 11280kb

input:

1
100000 100000
1 2 1
2 3 0
3 4 0
4 5 0
5 6 1
6 7 1
7 8 0
8 9 1
9 10 1
10 11 0
11 12 1
12 13 0
13 14 0
14 15 0
15 16 1
16 17 1
17 18 0
18 19 1
19 20 1
20 21 0
21 22 1
22 23 0
23 24 1
24 25 1
25 26 1
26 27 0
27 28 0
28 29 1
29 30 1
30 31 0
31 32 1
32 33 1
33 34 1
34 35 0
35 36 1
36 37 1
37 38 0
38 39...

output:

YES
149854
2 1
6 1
12 1
15 1
19 1
21 1
22 1
24 1
27 1
28 1
29 1
30 1
31 1
34 1
35 1
37 1
41 1
44 1
47 1
48 1
49 1
57 1
58 1
60 1
62 1
63 1
64 1
66 1
68 1
69 1
70 1
71 1
72 1
73 1
74 1
76 1
77 1
84 1
85 1
86 1
88 1
89 1
90 1
91 1
94 1
98 1
99 1
100 1
101 1
103 1
106 1
109 1
110 1
113 1
114 1
119 1
12...

result:

wrong answer incorrect edge color (test case 1)

Subtask #11:

score: 0
Skipped

Dependency #2:

0%

Subtask #12:

score: 0
Skipped

Dependency #1:

0%