QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#291956#7410. Apollonian NetworkQAQQWQAC ✓77ms71300kbC++146.4kb2023-12-27 14:46:102023-12-27 14:46:10

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3772kb

input:

3
1 2 1
2 3 1
3 1 2

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 1ms
memory: 6256kb

input:

10
1 2 4
2 3 4
3 1 3
6 1 3
6 2 3
6 3 4
4 6 4
4 3 4
4 2 3
5 1 3
5 6 3
5 2 4
10 1 4
10 3 3
10 6 3
7 1 4
7 10 4
7 6 3
8 1 3
8 3 4
8 10 4
9 3 4
9 8 3
9 10 3

output:

35

result:

ok 1 number(s): "35"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

3
1 2 0
3 2 1
3 1 1

output:

2

result:

ok 1 number(s): "2"

Test #4:

score: 0
Accepted
time: 0ms
memory: 4044kb

input:

3
3 2 123
2 1 67
3 1 763

output:

886

result:

ok 1 number(s): "886"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

3
3 2 724482
2 1 326757
3 1 386076

output:

1110558

result:

ok 1 number(s): "1110558"

Test #6:

score: 0
Accepted
time: 1ms
memory: 6080kb

input:

4
4 2 1
2 3 0
3 4 1
1 4 1
1 2 1
1 3 1

output:

3

result:

ok 1 number(s): "3"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

4
3 4 831
4 2 412
3 2 641
1 3 756
1 4 909
2 1 254

output:

2381

result:

ok 1 number(s): "2381"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

4
2 4 381962
4 3 793293
2 3 408508
2 1 425132
1 4 774548
3 1 430802

output:

1992973

result:

ok 1 number(s): "1992973"

Test #9:

score: 0
Accepted
time: 1ms
memory: 5828kb

input:

5
2 5 1
3 5 1
2 3 1
4 2 1
4 5 1
3 4 0
1 2 1
4 1 0
1 3 0

output:

4

result:

ok 1 number(s): "4"

Test #10:

score: 0
Accepted
time: 1ms
memory: 7872kb

input:

5
2 5 595
5 4 813
4 2 828
2 1 852
5 1 959
1 4 816
3 2 112
3 1 252
3 4 424

output:

3063

result:

ok 1 number(s): "3063"

Test #11:

score: 0
Accepted
time: 1ms
memory: 7868kb

input:

5
4 3 200019
2 4 422357
3 2 853305
3 1 371136
4 1 358800
2 1 889385
3 5 390874
1 5 239492
4 5 317497

output:

2492364

result:

ok 1 number(s): "2492364"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

6
1 5 1
3 5 0
3 1 0
2 1 0
5 2 1
2 3 0
4 1 1
4 2 1
5 4 1
1 6 1
4 6 1
2 6 1

output:

4

result:

ok 1 number(s): "4"

Test #13:

score: 0
Accepted
time: 1ms
memory: 7888kb

input:

6
1 4 735
3 4 627
3 1 442
2 1 496
2 4 325
3 2 836
1 5 637
5 2 53
3 5 32
6 2 684
5 6 448
3 6 113

output:

3519

result:

ok 1 number(s): "3519"

Test #14:

score: 0
Accepted
time: 1ms
memory: 5884kb

input:

6
4 3 205961
5 4 30950
5 3 65968
2 3 303988
2 4 184729
2 5 843062
4 6 481378
6 2 664463
5 6 545405
1 3 383865
2 1 307891
4 1 669247

output:

3042015

result:

ok 1 number(s): "3042015"

Test #15:

score: 0
Accepted
time: 1ms
memory: 5836kb

input:

7
4 5 1
3 5 0
4 3 0
4 7 1
5 7 0
3 7 1
1 5 1
7 1 0
3 1 1
4 2 1
7 2 1
2 5 1
6 4 1
6 2 1
7 6 1

output:

6

result:

ok 1 number(s): "6"

Test #16:

score: 0
Accepted
time: 1ms
memory: 5936kb

input:

7
6 5 862
6 4 299
4 5 584
5 2 737
6 2 957
2 4 407
7 6 260
2 7 857
7 4 631
2 3 701
3 7 361
3 4 541
1 5 283
2 1 228
1 6 163

output:

4131

result:

ok 1 number(s): "4131"

Test #17:

score: 0
Accepted
time: 1ms
memory: 5904kb

input:

7
5 2 459322
6 5 427540
6 2 187367
2 4 961056
5 4 103338
4 6 983153
2 1 771767
1 4 580227
6 1 371949
5 3 623838
4 3 208838
3 6 578640
4 7 222571
1 7 669259
7 6 53303

output:

4587713

result:

ok 1 number(s): "4587713"

Test #18:

score: 0
Accepted
time: 1ms
memory: 7832kb

input:

8
4 7 1
4 3 1
7 3 0
7 8 1
8 4 1
8 3 1
4 1 1
1 8 1
3 1 1
5 7 1
8 5 0
5 4 1
2 8 0
1 2 0
3 2 0
8 6 0
6 5 1
6 4 1

output:

6

result:

ok 1 number(s): "6"

Test #19:

score: 0
Accepted
time: 1ms
memory: 5856kb

input:

8
3 7 367
6 7 119
6 3 702
1 3 769
1 7 948
6 1 515
7 8 96
1 8 55
6 8 642
5 7 564
5 8 195
5 1 54
4 7 934
4 5 641
4 1 671
1 2 186
8 2 70
6 2 325

output:

4706

result:

ok 1 number(s): "4706"

Test #20:

score: 0
Accepted
time: 1ms
memory: 5948kb

input:

8
7 3 728075
1 3 669805
1 7 908111
7 2 901659
2 3 127509
2 1 48044
8 7 287910
2 8 584282
8 3 292959
6 2 641410
8 6 979321
6 3 136905
7 4 212548
2 4 489178
4 1 379769
7 5 350931
5 4 21571
1 5 597009

output:

4636063

result:

ok 1 number(s): "4636063"

Test #21:

score: 0
Accepted
time: 1ms
memory: 6280kb

input:

9
8 5 0
1 5 0
8 1 0
8 6 0
6 5 0
6 1 1
3 8 1
6 3 1
1 3 1
4 8 1
3 4 1
1 4 0
7 8 0
7 4 0
3 7 1
4 2 0
7 2 1
3 2 1
4 9 0
9 2 1
3 9 0

output:

6

result:

ok 1 number(s): "6"

Test #22:

score: 0
Accepted
time: 1ms
memory: 6204kb

input:

9
8 7 159
2 7 324
8 2 134
8 5 469
7 5 329
5 2 259
1 7 670
5 1 765
1 2 740
8 3 116
5 3 527
3 2 723
8 9 956
9 5 604
9 7 872
5 4 124
3 4 340
4 2 86
8 6 984
3 6 926
5 6 201

output:

6090

result:

ok 1 number(s): "6090"

Test #23:

score: 0
Accepted
time: 1ms
memory: 5996kb

input:

9
2 9 1776
8 2 965915
9 8 637994
5 9 391975
5 2 576116
5 8 303357
7 9 805273
5 7 721534
8 7 639873
9 3 249910
7 3 376286
3 5 819176
9 4 773174
4 3 172900
7 4 185855
6 9 268943
6 5 9090
2 6 187666
1 3 745755
1 4 911957
1 7 476567

output:

5848789

result:

ok 1 number(s): "5848789"

Test #24:

score: 0
Accepted
time: 1ms
memory: 5960kb

input:

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

output:

9

result:

ok 1 number(s): "9"

Test #25:

score: 0
Accepted
time: 1ms
memory: 5964kb

input:

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

output:

8

result:

ok 1 number(s): "8"

Test #26:

score: 0
Accepted
time: 1ms
memory: 5924kb

input:

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

output:

7

result:

ok 1 number(s): "7"

Test #27:

score: 0
Accepted
time: 1ms
memory: 6280kb

input:

10
5 8 771
9 5 728
9 8 240
2 8 815
2 5 118
9 2 988
10 8 513
2 10 949
10 5 513
6 8 746
6 2 478
9 6 332
7 5 754
7 2 817
9 7 354
2 4 196
10 4 904
5 4 794
8 1 153
10 1 339
1 5 410
3 8 256
10 3 155
2 3 770

output:

5930

result:

ok 1 number(s): "5930"

Test #28:

score: 0
Accepted
time: 1ms
memory: 5936kb

input:

10
7 2 535
4 2 494
7 4 642
3 7 446
2 3 339
3 4 949
1 7 644
1 3 810
1 2 466
8 7 42
8 1 297
8 2 118
9 7 947
8 9 647
2 9 855
7 10 758
8 10 193
10 1 56
5 8 185
10 5 699
5 1 483
7 6 593
6 1 415
3 6 553

output:

6288

result:

ok 1 number(s): "6288"

Test #29:

score: 0
Accepted
time: 1ms
memory: 5924kb

input:

10
3 8 760
3 10 881
10 8 600
7 8 732
3 7 773
10 7 567
9 3 192
9 7 798
9 10 427
3 6 38
9 6 562
10 6 757
4 9 325
6 4 748
4 10 427
5 6 883
5 4 532
5 10 90
1 4 618
5 1 447
1 10 117
4 2 989
2 1 923
10 2 578

output:

7255

result:

ok 1 number(s): "7255"

Test #30:

score: 0
Accepted
time: 1ms
memory: 5932kb

input:

10
9 3 532820
7 9 884172
3 7 990335
1 3 674226
1 9 748597
1 7 720815
3 2 852207
1 2 360164
9 2 939116
8 3 967366
1 8 714210
7 8 408588
9 10 789199
1 10 242778
10 7 442389
3 5 790845
5 2 622752
5 1 116990
3 4 904891
2 4 469074
9 4 646557
6 1 28022
6 2 348749
9 6 363364

output:

6100738

result:

ok 1 number(s): "6100738"

Test #31:

score: 0
Accepted
time: 1ms
memory: 6248kb

input:

10
1 5 91842
5 10 353811
10 1 62948
2 1 198100
2 5 513247
10 2 916235
4 1 783495
4 2 162627
5 4 778519
2 6 332497
6 4 592563
5 6 250810
3 1 392794
4 3 782688
3 5 722
7 2 123632
7 6 49788
4 7 765664
8 2 771323
7 8 937893
8 4 407488
9 5 772069
9 2 228947
10 9 514461

output:

6104744

result:

ok 1 number(s): "6104744"

Test #32:

score: 0
Accepted
time: 1ms
memory: 6280kb

input:

10
7 5 369618
5 2 111605
2 7 560430
7 1 53231
1 5 597492
2 1 656016
8 5 236755
1 8 146229
8 2 55028
1 3 955478
8 3 425707
2 3 342498
8 10 975337
3 10 483824
2 10 65867
9 8 412169
10 9 183571
3 9 646463
6 8 911293
6 9 178083
6 3 470761
8 4 493752
4 6 785212
4 3 821348

output:

6218303

result:

ok 1 number(s): "6218303"

Test #33:

score: 0
Accepted
time: 73ms
memory: 69184kb

input:

250
109 16 1
132 109 1
132 16 1
127 16 0
127 109 0
127 132 0
133 16 1
133 127 1
133 109 0
124 16 1
127 124 0
124 132 1
41 109 1
41 127 1
132 41 0
44 16 0
44 133 1
127 44 1
121 16 0
121 133 0
121 109 1
127 48 0
48 133 1
48 109 0
16 204 1
204 124 1
204 127 0
16 236 1
124 236 0
132 236 1
17 127 1
124 1...

output:

87

result:

ok 1 number(s): "87"

Test #34:

score: 0
Accepted
time: 77ms
memory: 69420kb

input:

250
21 37 0
1 37 0
21 1 0
147 21 1
37 147 1
1 147 0
118 21 1
147 118 1
37 118 0
21 105 1
147 105 1
105 1 1
155 37 0
155 147 0
155 1 1
202 21 0
202 118 1
202 147 0
21 109 0
118 109 1
109 37 1
146 147 0
118 146 0
146 37 0
21 128 1
128 105 1
147 128 0
206 21 1
206 105 0
206 1 1
129 147 1
105 129 1
129 ...

output:

87

result:

ok 1 number(s): "87"

Test #35:

score: 0
Accepted
time: 67ms
memory: 69356kb

input:

250
25 109 1
25 14 0
109 14 1
109 195 1
25 195 0
195 14 1
119 109 0
119 195 1
25 119 1
231 109 1
231 195 1
231 14 0
32 25 1
32 195 1
14 32 0
156 109 1
119 156 0
156 195 1
195 196 0
196 119 0
25 196 0
109 53 0
231 53 0
14 53 1
223 109 0
223 231 0
195 223 0
189 109 0
119 189 1
25 189 0
195 215 0
32 21...

output:

92

result:

ok 1 number(s): "92"

Test #36:

score: 0
Accepted
time: 45ms
memory: 71164kb

input:

250
130 100 0
108 130 1
108 100 0
96 100 0
96 130 1
96 108 0
100 155 1
155 96 1
108 155 1
100 218 0
155 218 1
218 96 0
100 159 0
159 96 1
159 130 0
130 40 0
96 40 1
40 108 1
136 100 0
218 136 0
96 136 0
100 137 1
137 136 1
218 137 1
208 100 1
208 137 0
208 218 1
155 177 0
218 177 0
177 96 0
235 218 ...

output:

150

result:

ok 1 number(s): "150"

Test #37:

score: 0
Accepted
time: 32ms
memory: 69240kb

input:

250
127 223 1
109 223 0
109 127 0
245 127 0
223 245 1
109 245 0
223 19 1
245 19 1
19 109 1
245 97 1
97 19 1
109 97 1
206 19 0
97 206 1
206 109 0
97 195 1
195 206 0
195 109 0
225 206 0
225 195 1
225 109 1
61 195 0
61 225 1
109 61 0
174 97 0
195 174 0
174 109 1
231 97 1
174 231 0
109 231 1
174 102 0
1...

output:

160

result:

ok 1 number(s): "160"

Test #38:

score: 0
Accepted
time: 27ms
memory: 71300kb

input:

250
20 75 1
103 20 1
75 103 0
196 75 1
20 196 1
196 103 0
20 223 1
196 223 1
223 103 0
196 55 0
55 223 0
103 55 1
223 158 0
158 55 0
158 103 0
198 55 1
198 158 1
103 198 0
93 158 0
198 93 1
93 103 0
66 198 1
66 93 1
103 66 1
93 9 1
66 9 1
103 9 1
23 66 0
9 23 0
103 23 0
56 9 1
56 23 0
103 56 1
23 53...

output:

192

result:

ok 1 number(s): "192"

Test #39:

score: 0
Accepted
time: 24ms
memory: 69612kb

input:

250
13 48 1
48 118 1
13 118 0
13 207 0
207 48 0
118 207 0
48 163 1
163 207 0
163 118 0
207 90 0
90 163 0
90 118 0
163 1 1
90 1 0
1 118 1
154 90 1
154 1 0
118 154 1
1 77 0
77 154 1
77 118 1
59 154 0
77 59 0
59 118 1
77 116 0
116 59 0
118 116 1
174 59 1
174 116 0
118 174 0
116 107 0
107 174 0
107 118 ...

output:

186

result:

ok 1 number(s): "186"

Test #40:

score: 0
Accepted
time: 65ms
memory: 69228kb

input:

250
72 47 317
47 181 260
72 181 242
72 84 332
84 47 320
84 181 866
188 72 974
188 84 677
47 188 686
72 133 916
84 133 103
181 133 965
221 47 947
221 84 312
181 221 530
72 67 547
188 67 747
67 84 397
72 171 571
171 188 984
47 171 397
23 84 72
23 188 459
47 23 266
72 228 693
228 133 329
84 228 963
19 ...

output:

69340

result:

ok 1 number(s): "69340"

Test #41:

score: 0
Accepted
time: 67ms
memory: 69252kb

input:

250
81 38 92
81 44 465
44 38 715
29 38 736
81 29 822
44 29 595
250 38 377
29 250 231
81 250 443
109 38 265
29 109 243
109 44 193
71 81 459
71 29 976
44 71 742
38 92 789
250 92 272
29 92 430
91 38 594
250 91 262
81 91 136
95 29 151
95 250 552
81 95 937
38 60 733
60 109 769
29 60 903
38 204 612
204 10...

output:

68209

result:

ok 1 number(s): "68209"

Test #42:

score: 0
Accepted
time: 65ms
memory: 69232kb

input:

250
156 184 875
229 184 42
229 156 543
238 156 570
238 184 946
238 229 612
1 156 343
238 1 903
184 1 556
184 49 705
49 238 814
49 229 160
156 217 74
217 238 775
217 229 439
156 33 837
33 1 566
33 238 577
35 156 625
1 35 0
184 35 729
238 11 69
11 1 298
11 184 216
201 184 95
201 49 433
238 201 525
241...

output:

77098

result:

ok 1 number(s): "77098"

Test #43:

score: 0
Accepted
time: 40ms
memory: 69208kb

input:

250
141 53 965
141 131 292
53 131 103
53 201 713
141 201 874
131 201 776
168 141 302
201 168 575
131 168 548
135 141 937
135 168 455
135 201 91
53 102 620
102 201 730
102 131 761
141 240 178
135 240 103
240 168 510
53 98 836
201 98 126
141 98 48
90 141 490
135 90 665
201 90 753
152 168 322
152 135 4...

output:

123435

result:

ok 1 number(s): "123435"

Test #44:

score: 0
Accepted
time: 33ms
memory: 69460kb

input:

250
244 93 170
32 244 680
93 32 457
34 93 414
244 34 127
32 34 902
244 125 437
125 34 347
32 125 975
137 34 326
137 125 446
137 32 903
139 125 643
137 139 918
139 32 294
137 55 168
139 55 458
55 32 707
110 139 402
110 55 902
110 32 836
84 137 589
55 84 275
84 32 764
28 55 420
84 28 663
28 32 37
124 ...

output:

147574

result:

ok 1 number(s): "147574"

Test #45:

score: 0
Accepted
time: 20ms
memory: 69224kb

input:

250
117 237 81
94 237 646
94 117 541
131 117 543
237 131 370
94 131 603
237 207 721
207 131 604
94 207 571
131 199 567
207 199 716
94 199 84
111 207 912
111 199 693
111 94 533
75 199 57
111 75 463
94 75 9
111 105 963
105 75 228
105 94 921
20 75 50
20 105 667
20 94 106
105 59 991
59 20 117
94 59 444
...

output:

158634

result:

ok 1 number(s): "158634"

Test #46:

score: 0
Accepted
time: 14ms
memory: 69504kb

input:

250
53 25 918
166 25 823
166 53 448
223 53 139
223 25 249
223 166 254
25 137 324
223 137 41
166 137 194
223 243 845
137 243 196
166 243 236
137 95 399
95 243 21
166 95 320
74 243 816
95 74 939
74 166 357
165 95 559
74 165 338
165 166 802
139 74 980
139 165 955
139 166 427
165 130 330
139 130 686
130...

output:

162976

result:

ok 1 number(s): "162976"

Test #47:

score: 0
Accepted
time: 68ms
memory: 69288kb

input:

250
167 59 3727
98 167 415377
98 59 367821
1 59 434763
167 1 759915
98 1 870438
127 59 521996
1 127 493689
167 127 805229
62 59 16384
1 62 83435
98 62 188092
167 146 222427
1 146 312488
146 98 671034
187 59 647673
187 127 798161
187 1 865936
59 46 147329
46 127 12140
167 46 547685
250 1 196742
127 2...

output:

68546516

result:

ok 1 number(s): "68546516"

Test #48:

score: 0
Accepted
time: 64ms
memory: 69276kb

input:

250
239 45 849626
35 239 18734
35 45 598913
122 45 524698
122 239 856901
35 122 580163
62 45 872015
62 122 194181
239 62 55074
45 229 455623
122 229 657467
229 35 761521
239 240 210328
122 240 597281
35 240 947297
23 45 749468
23 62 357993
23 122 859171
45 201 297289
62 201 422066
239 201 287210
16 ...

output:

69651831

result:

ok 1 number(s): "69651831"

Test #49:

score: 0
Accepted
time: 66ms
memory: 69200kb

input:

250
110 61 844342
61 11 239200
11 110 869967
190 110 770263
190 61 199804
190 11 176143
110 226 734643
226 190 849517
61 226 107970
110 218 59158
190 218 559122
11 218 651062
110 22 677008
22 226 796711
22 190 146902
210 61 969946
190 210 483902
210 11 599125
236 110 565411
226 236 814674
236 61 664...

output:

75589000

result:

ok 1 number(s): "75589000"

Test #50:

score: 0
Accepted
time: 46ms
memory: 69232kb

input:

250
176 152 156004
112 152 962004
176 112 214244
176 32 996641
152 32 616291
32 112 463361
195 176 712932
195 32 926096
195 112 851687
176 224 785426
195 224 890244
224 112 647116
152 52 701373
52 32 430404
112 52 543614
176 53 378901
53 224 932391
195 53 196420
176 218 970360
218 53 677517
224 218 ...

output:

126682427

result:

ok 1 number(s): "126682427"

Test #51:

score: 0
Accepted
time: 30ms
memory: 69540kb

input:

250
155 140 319733
140 97 351891
97 155 969156
155 130 680170
140 130 646528
130 97 740973
140 7 291681
7 130 687236
97 7 942380
20 130 731597
20 7 566763
20 97 468517
246 7 603355
246 20 188682
97 246 651296
234 7 650893
234 246 323315
97 234 475241
149 246 707282
149 234 817673
97 149 992185
234 4...

output:

149669431

result:

ok 1 number(s): "149669431"

Test #52:

score: 0
Accepted
time: 34ms
memory: 69344kb

input:

250
24 127 773254
127 151 206763
151 24 849913
24 144 732831
127 144 976946
144 151 531411
225 127 791443
225 144 168042
225 151 832138
144 88 483606
225 88 714791
151 88 962425
225 156 505980
156 88 718178
151 156 438750
88 94 439918
156 94 607010
94 151 445222
156 57 845937
94 57 543318
57 151 858...

output:

161833608

result:

ok 1 number(s): "161833608"

Test #53:

score: 0
Accepted
time: 20ms
memory: 69316kb

input:

250
197 24 964354
197 210 566406
24 210 655820
24 178 680581
197 178 916959
210 178 859370
156 197 440740
178 156 468234
156 210 582291
214 178 44368
156 214 140759
214 210 425996
157 156 517394
157 214 433385
210 157 161802
214 175 375122
157 175 10179
210 175 451302
157 112 695978
112 175 133392
1...

output:

158169479

result:

ok 1 number(s): "158169479"

Test #54:

score: 0
Accepted
time: 2ms
memory: 8036kb

input:

13
4 1 92
4 13 73
1 13 11
9 1 91
4 9 67
13 9 57
11 4 89
9 11 45
11 13 78
1 8 82
8 9 46
4 8 96
10 1 33
10 9 68
10 13 59
12 4 54
12 11 17
13 12 95
2 1 8
8 2 85
4 2 70
9 6 16
6 11 71
6 13 53
9 5 37
6 5 98
5 11 65
7 4 51
11 7 88
9 7 80
3 1 88
3 2 3
3 4 92

output:

960

result:

ok 1 number(s): "960"

Test #55:

score: 0
Accepted
time: 1ms
memory: 5924kb

input:

8
1 2 0
2 3 0
2 4 9
3 4 9
4 5 0
3 5 9
1 3 0
1 5 9
2 5 0
6 7 0
7 8 0
6 8 0
4 8 0
4 7 0
4 6 0
3 6 0
3 7 0
5 7 0

output:

36

result:

ok 1 number(s): "36"

Test #56:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

6
6 2 342868
6 3 164103
2 3 629720
1 6 977298
1 2 339017
1 3 978681
4 2 320998
4 3 192509
4 1 740435
5 2 445180
5 1 706218
5 4 186285

output:

3217164

result:

ok 1 number(s): "3217164"

Test #57:

score: 0
Accepted
time: 1ms
memory: 6160kb

input:

8
8 1 7
8 6 9
1 6 8
7 8 1
7 1 4
7 6 0
2 8 8
2 6 7
2 7 9
4 8 6
4 6 5
4 2 5
3 8 0
3 7 6
3 2 5
5 6 2
5 7 7
5 2 0

output:

46

result:

ok 1 number(s): "46"