QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#38616#363. Arranging Ticketsqwq100 ✓3033ms15464kbC++203.9kb2022-07-06 14:58:382022-07-06 14:58:41

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 4ms
memory: 9896kb

input:

20 20
2 1 1
17 12 1
8 18 1
14 7 1
7 16 1
11 16 1
10 18 1
2 15 1
20 14 1
19 9 1
14 19 1
17 15 1
3 20 1
15 16 1
6 1 1
1 7 1
18 8 1
6 20 1
17 8 1
6 18 1

output:

9

result:

ok single line: '9'

Test #2:

score: 0
Accepted
time: 3ms
memory: 7776kb

input:

20 20
1 8 1
18 9 1
12 7 1
1 6 1
4 17 1
17 16 1
13 1 1
10 19 1
18 4 1
19 15 1
17 9 1
19 11 1
9 17 1
15 18 1
11 1 1
11 6 1
17 9 1
7 18 1
14 6 1
13 19 1

output:

9

result:

ok single line: '9'

Test #3:

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

input:

20 20
5 9 1
5 13 1
19 2 1
19 20 1
8 20 1
17 6 1
4 18 1
3 14 1
2 8 1
7 6 1
18 11 1
4 1 1
6 15 1
20 4 1
19 2 1
9 4 1
3 14 1
2 17 1
12 6 1
3 10 1

output:

9

result:

ok single line: '9'

Test #4:

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

input:

20 20
2 11 1
3 8 1
6 8 1
2 20 1
6 13 1
4 10 1
2 11 1
8 5 1
3 8 1
17 4 1
20 7 1
7 17 1
2 1 1
9 6 1
8 5 1
7 18 1
18 20 1
6 17 1
7 8 1
10 15 1

output:

9

result:

ok single line: '9'

Test #5:

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

input:

20 20
9 11 1
13 18 1
9 15 1
5 9 1
17 5 1
9 11 1
7 18 1
14 10 1
20 13 1
13 10 1
9 12 1
18 6 1
14 4 1
8 3 1
11 9 1
12 9 1
5 16 1
4 18 1
18 10 1
12 9 1

output:

9

result:

ok single line: '9'

Test #6:

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

input:

20 20
3 18 1
8 14 1
1 13 1
10 12 1
20 17 1
14 3 1
8 16 1
19 5 1
9 13 1
14 6 1
16 7 1
19 4 1
6 18 1
13 20 1
5 2 1
19 20 1
5 17 1
4 19 1
2 17 1
17 7 1

output:

10

result:

ok single line: '10'

Test #7:

score: 0
Accepted
time: 3ms
memory: 9924kb

input:

20 20
11 1 1
19 11 1
19 10 1
1 3 1
5 1 1
15 11 1
11 18 1
5 18 1
11 18 1
19 11 1
15 10 1
2 19 1
12 1 1
14 6 1
15 5 1
13 8 1
12 20 1
14 17 1
19 9 1
16 8 1

output:

10

result:

ok single line: '10'

Test #8:

score: 0
Accepted
time: 4ms
memory: 9916kb

input:

20 20
9 1 1
7 18 1
1 8 1
16 7 1
7 16 1
14 17 1
6 20 1
20 14 1
11 20 1
14 13 1
12 16 1
8 10 1
9 19 1
1 12 1
12 17 1
11 16 1
20 11 1
2 16 1
6 1 1
16 13 1

output:

9

result:

ok single line: '9'

Test #9:

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

input:

20 20
3 13 1
5 12 1
3 14 1
19 8 1
20 8 1
1 7 1
2 15 1
3 2 1
2 16 1
2 19 1
16 7 1
12 8 1
1 14 1
14 7 1
6 7 1
4 12 1
2 12 1
8 17 1
17 7 1
4 14 1

output:

9

result:

ok single line: '9'

Test #10:

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

input:

20 20
11 9 1
10 16 1
18 6 1
19 11 1
7 12 1
8 18 1
2 15 1
16 7 1
7 18 1
7 15 1
10 1 1
17 12 1
1 5 1
19 9 1
17 3 1
15 3 1
10 1 1
6 9 1
8 15 1
10 16 1

output:

9

result:

ok single line: '9'

Test #11:

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

input:

20 20
17 4 1
17 3 1
1 12 1
15 2 1
14 12 1
5 17 1
2 17 1
14 12 1
17 11 1
10 2 1
1 11 1
10 16 1
17 9 1
12 17 1
4 16 1
6 16 1
17 8 1
6 15 1
19 9 1
12 14 1

output:

10

result:

ok single line: '10'

Test #12:

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

input:

20 20
4 19 1
9 8 1
3 18 1
11 7 1
18 14 1
18 5 1
15 5 1
5 11 1
1 13 1
3 19 1
15 18 1
7 17 1
20 6 1
11 20 1
16 1 1
19 16 1
19 11 1
5 20 1
5 19 1
6 19 1

output:

8

result:

ok single line: '8'

Test #13:

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

input:

20 20
7 20 1
12 9 1
6 14 1
7 20 1
2 11 1
10 20 1
16 6 1
3 20 1
17 3 1
3 8 1
5 15 1
16 20 1
20 7 1
13 6 1
9 16 1
6 1 1
10 7 1
15 4 1
8 14 1
19 13 1

output:

9

result:

ok single line: '9'

Test #14:

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

input:

20 20
13 14 1
4 18 1
11 3 1
3 13 1
17 16 1
14 12 1
14 5 1
6 12 1
10 6 1
6 9 1
10 4 1
17 7 1
18 7 1
15 4 1
4 10 1
15 3 1
8 19 1
20 7 1
15 5 1
10 15 1

output:

8

result:

ok single line: '8'

Test #15:

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

input:

20 20
4 8 1
14 7 1
19 10 1
17 10 1
14 7 1
20 2 1
16 7 1
8 1 1
13 16 1
12 20 1
4 1 1
3 16 1
1 7 1
14 20 1
2 1 1
18 3 1
4 18 1
3 7 1
4 15 1
9 1 1

output:

9

result:

ok single line: '9'

Subtask #2:

score: 35
Accepted

Dependency #1:

100%
Accepted

Test #16:

score: 35
Accepted
time: 7ms
memory: 9868kb

input:

300 300
112 232 1
263 92 1
216 195 1
240 71 1
73 170 1
189 251 1
224 167 1
68 199 1
38 212 1
262 36 1
128 229 1
18 277 1
131 150 1
132 231 1
167 252 1
58 243 1
225 58 1
128 119 1
163 269 1
284 22 1
33 108 1
266 95 1
20 218 1
168 109 1
243 135 1
117 242 1
127 221 1
216 31 1
22 283 1
108 215 1
213 46 ...

output:

125

result:

ok single line: '125'

Test #17:

score: 0
Accepted
time: 3ms
memory: 9864kb

input:

300 300
21 289 1
276 196 1
210 200 1
177 287 1
155 64 1
300 170 1
2 247 1
233 47 1
116 267 1
273 157 1
106 189 1
41 244 1
286 98 1
255 71 1
20 114 1
97 298 1
100 212 1
119 263 1
96 203 1
70 293 1
233 104 1
215 83 1
146 207 1
291 175 1
274 144 1
253 131 1
255 41 1
218 30 1
1 118 1
43 249 1
114 273 1
...

output:

128

result:

ok single line: '128'

Test #18:

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

input:

300 300
27 43 1
60 207 1
77 276 1
138 292 1
7 295 1
289 88 1
150 86 1
42 277 1
216 94 1
33 258 1
164 238 1
53 261 1
45 236 1
281 67 1
161 229 1
42 275 1
242 297 1
27 296 1
138 239 1
244 131 1
69 252 1
294 42 1
152 243 1
239 300 1
60 238 1
220 112 1
242 164 1
216 13 1
285 66 1
65 218 1
281 125 1
119 ...

output:

123

result:

ok single line: '123'

Test #19:

score: 0
Accepted
time: 6ms
memory: 7752kb

input:

300 300
144 251 1
55 263 1
3 287 1
135 258 1
299 154 1
173 273 1
261 70 1
94 81 1
214 175 1
145 262 1
255 180 1
95 10 1
65 288 1
178 234 1
281 89 1
171 275 1
62 91 1
25 263 1
195 244 1
85 199 1
117 254 1
262 144 1
24 1 1
259 46 1
122 210 1
97 290 1
221 127 1
201 88 1
7 262 1
114 267 1
1 64 1
236 30 ...

output:

130

result:

ok single line: '130'

Test #20:

score: 0
Accepted
time: 3ms
memory: 9880kb

input:

300 300
245 42 1
227 29 1
150 185 1
237 40 1
299 12 1
233 67 1
1 123 1
190 296 1
293 103 1
50 231 1
83 233 1
261 109 1
94 262 1
242 172 1
8 1 1
118 230 1
132 196 1
276 87 1
117 277 1
77 198 1
165 1 1
10 146 1
212 10 1
215 69 1
276 174 1
34 188 1
140 177 1
65 141 1
66 208 1
205 120 1
84 229 1
118 239...

output:

133

result:

ok single line: '133'

Test #21:

score: 0
Accepted
time: 7ms
memory: 9932kb

input:

300 300
222 98 1
252 11 1
277 34 1
298 2 1
253 17 1
160 271 1
63 209 1
144 15 1
78 300 1
71 232 1
19 293 1
158 263 1
208 78 1
3 137 1
215 188 1
131 217 1
159 279 1
203 156 1
28 270 1
281 28 1
24 263 1
297 109 1
191 53 1
206 291 1
232 85 1
227 178 1
90 243 1
273 66 1
216 87 1
179 260 1
139 148 1
58 5...

output:

125

result:

ok single line: '125'

Test #22:

score: 0
Accepted
time: 7ms
memory: 9856kb

input:

300 300
239 111 1
129 300 1
237 124 1
111 247 1
275 17 1
115 273 1
263 239 1
130 238 1
239 121 1
206 39 1
57 252 1
200 14 1
175 210 1
168 194 1
159 201 1
107 240 1
271 124 1
192 287 1
49 3 1
159 206 1
212 174 1
130 270 1
203 35 1
241 73 1
36 1 1
255 98 1
148 1 1
192 26 1
275 182 1
148 282 1
289 21 1...

output:

128

result:

ok single line: '128'

Test #23:

score: 0
Accepted
time: 7ms
memory: 9904kb

input:

300 300
223 133 1
54 265 1
130 149 1
22 277 1
198 2 1
285 117 1
219 162 1
43 66 1
51 84 1
270 29 1
118 300 1
278 64 1
251 162 1
205 27 1
187 61 1
50 241 1
198 126 1
1 75 1
18 280 1
273 5 1
105 215 1
294 90 1
201 64 1
23 94 1
2 298 1
177 232 1
275 277 1
206 120 1
116 192 1
183 252 1
45 205 1
289 41 1...

output:

132

result:

ok single line: '132'

Test #24:

score: 0
Accepted
time: 7ms
memory: 7768kb

input:

300 300
90 170 1
149 88 1
2 53 1
72 128 1
215 158 1
77 134 1
102 87 1
110 72 1
109 91 1
91 208 1
87 237 1
175 34 1
97 81 1
202 214 1
118 55 1
263 289 1
109 77 1
37 253 1
87 171 1
295 2 1
103 77 1
154 84 1
155 63 1
65 89 1
20 256 1
161 72 1
89 110 1
181 74 1
215 65 1
132 45 1
91 287 1
121 61 1
89 142...

output:

125

result:

ok single line: '125'

Test #25:

score: 0
Accepted
time: 7ms
memory: 9864kb

input:

300 300
136 59 1
50 94 1
141 70 1
130 85 1
140 123 1
65 159 1
126 82 1
102 77 1
74 90 1
73 300 1
133 88 1
111 79 1
114 78 1
85 89 1
266 189 1
139 54 1
134 79 1
126 63 1
69 152 1
72 96 1
85 93 1
280 1 1
136 52 1
134 86 1
66 6 1
79 134 1
187 82 1
285 292 1
75 139 1
77 181 1
58 99 1
134 84 1
156 77 1
7...

output:

131

result:

ok single line: '131'

Test #26:

score: 0
Accepted
time: 3ms
memory: 7824kb

input:

300 279
23 180 1
38 173 1
63 257 1
44 114 1
227 79 1
140 51 1
10 94 1
35 138 1
89 84 1
290 25 1
101 67 1
177 47 1
290 51 1
212 106 1
166 1 1
249 58 1
100 12 1
25 100 1
224 23 1
135 9 1
75 157 1
55 143 1
205 86 1
230 251 1
233 3 1
144 39 1
147 248 1
279 25 1
164 28 1
278 16 1
140 32 1
56 216 1
225 23...

output:

124

result:

ok single line: '124'

Test #27:

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

input:

300 297
82 77 1
164 22 1
189 56 1
33 238 1
51 171 1
211 32 1
264 43 1
77 84 1
64 187 1
23 186 1
86 47 1
193 269 1
18 185 1
26 195 1
16 268 1
61 138 1
25 88 1
176 181 1
5 195 1
171 269 1
121 71 1
156 5 1
49 167 1
182 36 1
156 85 1
42 300 1
279 16 1
9 151 1
27 111 1
8 176 1
235 44 1
141 188 1
44 120 1...

output:

117

result:

ok single line: '117'

Subtask #3:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #28:

score: 20
Accepted
time: 50ms
memory: 7972kb

input:

3000 3000
749 353 1
727 2437 1
109 2772 1
2400 119 1
2300 43 1
2161 23 1
2648 900 1
1949 324 1
2561 335 1
2536 879 1
1403 763 1
1107 934 1
2303 1284 1
1552 2248 1
625 2410 1
735 2364 1
758 2100 1
1743 815 1
1590 420 1
2966 1316 1
1833 341 1
2626 1369 1
2326 1490 1
2533 1851 1
1784 529 1
1700 841 1
2...

output:

1219

result:

ok single line: '1219'

Test #29:

score: 0
Accepted
time: 52ms
memory: 9984kb

input:

3000 3000
2905 979 1
2707 580 1
2885 2949 1
2309 650 1
2352 703 1
32 546 1
2027 2205 1
2957 1107 1
2215 28 1
2257 63 1
2643 1373 1
308 466 1
2764 1650 1
1968 1916 1
660 2338 1
1851 2269 1
1328 1416 1
1227 1660 1
1381 2123 1
560 1284 1
2346 613 1
2553 1250 1
1858 1818 1
1970 2390 1
2717 2048 1
989 19...

output:

1193

result:

ok single line: '1193'

Test #30:

score: 0
Accepted
time: 54ms
memory: 9972kb

input:

3000 3000
2482 52 1
1639 8 1
672 2455 1
308 1016 1
1598 231 1
2807 583 1
493 1140 1
1764 271 1
1790 26 1
2683 752 1
1212 531 1
1999 1591 1
2932 1635 1
2104 1026 1
2817 587 1
708 2247 1
2960 703 1
1068 1667 1
2375 11 1
1392 450 1
1170 142 1
1938 58 1
324 1262 1
468 2463 1
157 1793 1
1487 689 1
1185 2...

output:

1222

result:

ok single line: '1222'

Test #31:

score: 0
Accepted
time: 53ms
memory: 9900kb

input:

3000 3000
1345 2132 1
1818 1259 1
1806 1220 1
2049 1326 1
1871 1290 1
1464 2046 1
1832 1021 1
1742 1476 1
1474 1884 1
1545 1731 1
2473 752 1
1788 1331 1
1913 1425 1
1229 1844 1
1529 1784 1
1227 1794 1
942 1854 1
2175 790 1
1083 2059 1
2980 2271 1
1419 1792 1
1871 1271 1
2796 2503 1
1979 1153 1
139 2...

output:

1240

result:

ok single line: '1240'

Test #32:

score: 0
Accepted
time: 48ms
memory: 9880kb

input:

3000 3000
1089 2095 1
104 1304 1
781 1077 1
630 539 1
1267 773 1
1499 1791 1
1288 786 1
664 1322 1
1055 813 1
1430 1613 1
837 1480 1
840 879 1
1165 851 1
426 301 1
994 696 1
2074 1842 1
595 1767 1
2215 1978 1
1260 682 1
855 1307 1
665 1226 1
798 1601 1
933 856 1
1911 1896 1
481 1717 1
857 1134 1
100...

output:

1295

result:

ok single line: '1295'

Test #33:

score: 0
Accepted
time: 49ms
memory: 9964kb

input:

3000 2961
1357 1612 1
2856 590 1
1103 771 1
1920 1101 1
2351 1058 1
582 1413 1
1375 1232 1
1471 2753 1
1769 184 1
69 1399 1
1815 2915 1
462 1966 1
367 2083 1
185 386 1
632 2521 1
2602 240 1
1232 1269 1
292 1934 1
666 786 1
2205 505 1
287 2565 1
429 2250 1
308 2776 1
2068 336 1
1215 2956 1
1245 1232 ...

output:

1233

result:

ok single line: '1233'

Test #34:

score: 0
Accepted
time: 44ms
memory: 14088kb

input:

3000 2849
1622 2140 1
2436 1442 1
2253 853 1
758 1222 1
2661 1509 1
2817 1346 1
166 2333 1
2938 119 1
1503 2656 1
528 2069 1
2726 986 1
1072 934 1
1061 2708 1
136 2018 1
2307 1668 1
2629 700 1
579 1932 1
1654 2284 1
1825 1770 1
467 704 1
862 2283 1
2689 1660 1
1810 2329 1
407 1986 1
1904 929 1
820 2...

output:

1240

result:

ok single line: '1240'

Test #35:

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

input:

3000 3000
35 1590 1
736 876 1
215 1627 1
851 736 1
41 1463 1
661 2002 1
859 1729 1
736 849 1
287 2964 1
2394 480 1
2754 749 1
2058 596 1
2130 26 1
1643 2557 1
800 736 1
1049 675 1
600 1815 1
543 2660 1
794 736 1
2959 672 1
1587 187 1
723 2187 1
190 2932 1
2114 502 1
387 2694 1
2084 542 1
2003 708 1
...

output:

1185

result:

ok single line: '1185'

Test #36:

score: 0
Accepted
time: 52ms
memory: 7924kb

input:

3000 2963
1307 1237 1
306 1724 1
1237 1323 1
1545 844 1
349 2892 1
2965 1311 1
723 2359 1
2397 2538 1
2930 925 1
927 2563 1
1507 1823 1
2257 555 1
2077 805 1
2047 2739 1
1009 1476 1
1237 1262 1
1125 2310 1
2967 1001 1
2114 899 1
382 2272 1
1508 1323 1
1770 1222 1
1338 1237 1
1237 1264 1
992 150 1
23...

output:

1205

result:

ok single line: '1205'

Test #37:

score: 0
Accepted
time: 50ms
memory: 9852kb

input:

3000 3000
1415 2616 1
2087 288 1
1384 2585 1
776 2575 1
2207 408 1
1182 2383 1
1315 114 1
2158 957 1
1790 2991 1
156 1357 1
313 1514 1
340 2139 1
704 2503 1
1968 169 1
646 2445 1
2745 946 1
679 2478 1
2641 1440 1
2037 836 1
751 2550 1
2921 1720 1
827 2028 1
235 1436 1
2328 529 1
2321 1120 1
2713 151...

output:

1201

result:

ok single line: '1201'

Test #38:

score: 0
Accepted
time: 49ms
memory: 7952kb

input:

3000 3000
1895 1848 1
2520 2567 1
2787 2740 1
301 348 1
1841 1794 1
2896 2849 1
1289 1242 1
540 587 1
2995 2948 1
1263 1216 1
2004 2051 1
2975 22 1
2882 2835 1
7 54 1
425 472 1
2728 2681 1
2598 2645 1
2011 2058 1
1913 1866 1
2435 2388 1
2492 2539 1
2323 2276 1
2367 2414 1
2784 2737 1
1510 1463 1
642...

output:

47

result:

ok single line: '47'

Test #39:

score: 0
Accepted
time: 52ms
memory: 14012kb

input:

3000 3000
457 947 1
2013 2503 1
356 2866 1
2931 421 1
2559 2069 1
397 2907 1
888 398 1
2131 2621 1
872 382 1
247 737 1
2797 287 1
2824 314 1
846 1336 1
1480 1970 1
116 2626 1
2733 223 1
2306 2796 1
2170 2660 1
1623 2113 1
83 573 1
2624 114 1
2657 147 1
1605 1115 1
2676 2186 1
912 422 1
2749 2259 1
8...

output:

490

result:

ok single line: '490'

Subtask #4:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #40:

score: 20
Accepted
time: 2882ms
memory: 15376kb

input:

200000 100000
20687 112655 1
96495 4855 1
1160 120122 1
111849 60542 1
42031 129003 1
179611 16220 1
33513 155327 1
187753 3371 1
56812 176672 1
183181 34085 1
185968 20278 1
103685 70800 1
45946 183198 1
16650 193175 1
82845 89575 1
101545 18413 1
22814 84401 1
171003 27651 1
46628 115349 1
21094 9...

output:

40873

result:

ok single line: '40873'

Test #41:

score: 0
Accepted
time: 2908ms
memory: 15328kb

input:

200000 100000
29826 171969 1
188392 75778 1
105882 40199 1
157829 11056 1
71311 177950 1
41749 147558 1
165293 79354 1
174720 72281 1
42688 33343 1
3429 156894 1
166482 80849 1
36149 146528 1
149304 135588 1
117200 12484 1
1876 33478 1
197600 43157 1
97352 142259 1
100033 129537 1
24682 24395 1
3965...

output:

42391

result:

ok single line: '42391'

Test #42:

score: 0
Accepted
time: 2842ms
memory: 15440kb

input:

200000 100000
165719 29236 1
39954 191417 1
139232 29932 1
29183 139686 1
187793 33379 1
38174 54037 1
158176 150171 1
13550 72815 1
19801 155252 1
114464 41304 1
70512 1159 1
155229 42924 1
114060 10179 1
84 195066 1
9706 58267 1
137667 130870 1
144461 16849 1
28642 164720 1
29375 159111 1
148204 4...

output:

42589

result:

ok single line: '42589'

Test #43:

score: 0
Accepted
time: 2831ms
memory: 15348kb

input:

200000 100000
72585 112395 1
85468 123531 1
138945 171152 1
115281 82506 1
79972 115766 1
99846 21719 1
80035 90614 1
79063 114886 1
190874 174017 1
54735 41954 1
99461 189216 1
79613 98224 1
107452 21333 1
65129 88267 1
104130 82887 1
136415 25010 1
78814 114311 1
158076 176638 1
91551 68353 1
7037...

output:

40317

result:

ok single line: '40317'

Test #44:

score: 0
Accepted
time: 2832ms
memory: 15404kb

input:

200000 100000
95065 65104 1
117525 137612 1
91758 144076 1
141703 120007 1
89512 161437 1
114490 135870 1
128718 84748 1
91243 145289 1
3293 60350 1
90484 64667 1
91129 168558 1
127003 118748 1
26634 6735 1
95086 125382 1
71829 23536 1
82905 123931 1
81684 121514 1
103877 128398 1
92995 135583 1
134...

output:

40647

result:

ok single line: '40647'

Test #45:

score: 0
Accepted
time: 2804ms
memory: 15324kb

input:

200000 100000
144043 64254 1
77230 136710 1
84605 47193 1
32429 137236 1
49831 88328 1
63888 136803 1
85129 49621 1
188352 111048 1
82979 181447 1
63380 42432 1
115312 50927 1
115299 51559 1
65919 22429 1
63245 32629 1
44408 87560 1
100227 49670 1
60434 39665 1
47720 83869 1
126683 53394 1
46910 738...

output:

42063

result:

ok single line: '42063'

Test #46:

score: 0
Accepted
time: 2620ms
memory: 15316kb

input:

200000 90717
179507 34728 1
112471 101435 1
110889 183710 1
181541 35492 1
91886 1687 1
49072 123790 1
148063 87441 1
199495 4712 1
146240 59034 1
56148 114073 1
145913 9332 1
32012 98083 1
100929 31933 1
125006 22954 1
22041 168640 1
165697 106063 1
12573 174532 1
56955 135603 1
192456 3232 1
11930...

output:

40869

result:

ok single line: '40869'

Test #47:

score: 0
Accepted
time: 2586ms
memory: 15344kb

input:

200000 90443
174302 8914 1
178772 25030 1
161027 49423 1
87756 161206 1
161634 88159 1
152765 9911 1
173520 44371 1
132584 65620 1
126571 51626 1
33629 159130 1
105178 133457 1
93071 82796 1
190734 81538 1
54773 180252 1
9728 132472 1
35335 195902 1
41282 173934 1
195563 39353 1
51556 173074 1
19391...

output:

42165

result:

ok single line: '42165'

Test #48:

score: 0
Accepted
time: 2625ms
memory: 15364kb

input:

200000 91014
116382 36570 1
132297 109279 1
111953 33521 1
175229 21789 1
78793 120887 1
85099 2640 1
151572 183299 1
168913 24484 1
10954 194299 1
127213 20191 1
56656 125786 1
36547 64890 1
40991 158803 1
75827 154587 1
46514 139193 1
104104 34005 1
32994 143898 1
103964 162491 1
188333 27019 1
51...

output:

38888

result:

ok single line: '38888'

Test #49:

score: 0
Accepted
time: 2335ms
memory: 15148kb

input:

100000 100000
52302 86870 1
35888 70456 1
46383 80951 1
94315 59747 1
84579 19147 1
3061 68493 1
38899 73467 1
2949 37517 1
12706 78138 1
91235 56667 1
48311 13743 1
26158 60726 1
97159 62591 1
28513 93945 1
64455 29887 1
89618 24186 1
44965 10397 1
77680 43112 1
91354 56786 1
25383 90815 1
61029 95...

output:

34568

result:

ok single line: '34568'

Test #50:

score: 0
Accepted
time: 2500ms
memory: 15432kb

input:

100000 100000
76821 70993 1
19725 25553 1
728 6556 1
77610 71782 1
4819 10647 1
91606 97434 1
47681 53509 1
70087 64259 1
88925 94753 1
17172 23000 1
66178 72006 1
72759 66931 1
13749 7921 1
19459 13631 1
83378 89206 1
84708 90536 1
40787 46615 1
42965 48793 1
46591 40763 1
46991 52819 1
4788 98960 ...

output:

5828

result:

ok single line: '5828'

Test #51:

score: 0
Accepted
time: 2419ms
memory: 15456kb

input:

100000 100000
6639 78002 1
43432 72069 1
7358 78721 1
98285 26922 1
91671 63034 1
45174 73811 1
93582 22219 1
46271 17634 1
23917 52554 1
47820 19183 1
6234 34871 1
36767 8130 1
64542 35905 1
95554 66917 1
61785 33148 1
35441 6804 1
92094 63457 1
82839 11476 1
61231 89868 1
74282 2919 1
99952 71315 ...

output:

28637

result:

ok single line: '28637'

Subtask #5:

score: 15
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #52:

score: 15
Accepted
time: 3033ms
memory: 15404kb

input:

200000 100000
127301 145091 497592954
18993 190499 724788224
116698 147468 824133320
194477 48572 608421032
74468 82200 635042395
4301 151714 292923299
147776 102803 277247038
172555 100861 273737872
147921 21685 528567821
181806 19602 505075242
100050 180326 123610641
195501 86827 191259062
167627 ...

output:

20399439858976

result:

ok single line: '20399439858976'

Test #53:

score: 0
Accepted
time: 2921ms
memory: 15420kb

input:

200000 100000
105692 44582 229346443
6308 157595 601563886
158394 65397 727984680
120423 54255 840282355
90295 25651 231917123
56589 79464 462445710
21662 180393 759072965
179004 19388 207487149
158580 52914 390545712
16568 103091 249520249
5204 66184 529162467
26452 138994 476311332
78512 10770 851...

output:

20969482806334

result:

ok single line: '20969482806334'

Test #54:

score: 0
Accepted
time: 2986ms
memory: 15464kb

input:

200000 100000
186383 83616 163390182
96971 144463 810103223
74906 34563 357285648
78406 159520 309908449
14958 192075 433052502
21841 119818 889315770
169232 118860 619332380
43237 191460 581049314
104755 9989 907415491
172401 66437 946698554
198296 89030 521519119
160723 65611 712677289
81622 16077...

output:

19609822973211

result:

ok single line: '19609822973211'

Test #55:

score: 0
Accepted
time: 2823ms
memory: 15444kb

input:

200000 100000
14375 18594 540173443
123590 148916 148267244
133873 33760 165770480
128668 139425 201504140
113717 163119 749658794
141411 85431 973288369
132611 147130 39739503
135109 126677 613576601
117262 158996 203916455
192354 7940 396112928
116557 140235 985467978
112428 150409 622566713
14331...

output:

20264337522312

result:

ok single line: '20264337522312'

Test #56:

score: 0
Accepted
time: 2914ms
memory: 15416kb

input:

200000 100000
24210 82046 259825816
58085 199607 125992407
16078 64863 521997843
41771 119781 418484138
63493 89243 483522289
102427 110625 145066034
189786 103353 819332582
90110 47479 54068812
131690 58293 291139087
68559 66216 612993977
65916 92950 846146006
59457 90002 994857859
26488 169824 283...

output:

18986211725141

result:

ok single line: '18986211725141'

Test #57:

score: 0
Accepted
time: 2593ms
memory: 15436kb

input:

200000 90639
14557 27733 395098591
103520 99884 765920812
110381 74879 950533042
38883 192306 30607437
49973 53865 495732514
198570 59064 59589868
101251 101250 1
101823 14643 462270028
197592 79460 67670821
132531 153295 713795448
22083 155084 50929455
41570 174968 745996847
60332 182086 137785544
...

output:

18495358725642

result:

ok single line: '18495358725642'

Test #58:

score: 0
Accepted
time: 2592ms
memory: 15304kb

input:

200000 90271
4638 122222 191640751
194299 22081 553322753
189086 26918 237636826
113361 166628 277711704
55696 180638 735567652
100893 196276 693090210
81601 30240 800603090
30963 161390 293709712
162476 995 437729138
148213 19893 266535124
42214 142605 299543235
157910 19792 735505386
118265 158054...

output:

18901049207772

result:

ok single line: '18901049207772'

Test #59:

score: 0
Accepted
time: 2192ms
memory: 15184kb

input:

100000 100000
12342 66663 449055108
97173 42852 449055108
37896 92217 449055108
28071 73750 449055108
74804 20483 449055108
31866 77545 449055108
31793 86114 449055108
73998 28319 449055108
25526 79847 449055108
52184 97863 449055108
70349 16028 449055108
15376 61055 449055108
7159 61480 449055108
2...

output:

20512388278332

result:

ok single line: '20512388278332'

Extra Test:

score: 0
Extra Test Passed