QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#19526#2469. ParkoviQingyu✨110 ✓1316ms39528kbC++201.9kb2022-02-03 09:21:482022-05-06 05:41:33

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-06 05:41:33]
  • Judged
  • Verdict: 110
  • Time: 1316ms
  • Memory: 39528kb
  • [2022-02-03 09:21:48]
  • Submitted

answer

#include <bits/stdc++.h>
const int N = 2e5 + 50;
int n, k, tot = 0;
long long f[N], h[N];
bool g[N];
std::vector<std::pair<int, int>> G[N];
void dfs(long long mid, int x, int fa = -1) {
	long long e = 1e18;
	f[x] = 0; h[x] = 1e18;
	std::vector<std::pair<int, int>> son;
	for (auto [y, w] : G[x]) {
		if (y != fa) {
			dfs(mid, y, x);
			//printf("check y = %d, f[y] = %lld, w = %d, h[y] = %lld\n", y, f[y], w, h[y]);
			if (f[y] + w > mid) {
				// set y
				//printf("put %d\n", y);
				h[y] = 0;
				f[y] = -1e18;
				g[y] = 1;
				++tot;
				e = std::min(e, h[y] + w);
			}
			else {
				e = std::min(e, h[y] + w);
			}
		}
	}
	//printf("e = %lld\n", e);
	if (e <= mid) f[x] = -1e18;
	h[x] = e;
	for (auto [y, w] : G[x])
		if (y != fa && !g[y]) {
			if (f[y] + w + e > mid) {
				f[x] = std::max(f[x], f[y] + w);
			}
		}

	//printf("f[%d] = %lld, g[%d] = %d, h[%d] = %lld\n", x, f[x], x, g[x], x, h[x]);
}
bool check(long long mid) {
	memset(f, 0, sizeof f);
	memset(g, 0, sizeof g);
	tot = 0;
	dfs(mid, 1);
	if (f[1] >= 0) {
		assert(!g[1]);
		g[1] = true;
		++tot;
	}
	//printf("mid = %d, tot = %d\n", mid, tot);
	return tot <= k;
}
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	std::cin >> n >> k;
	long long L = 0, R = 0, ans = -1;
	for (int i = 1; i < n; ++i) {
		int x, y, z;
		std::cin >> x >> y >> z;
		G[x].emplace_back(y, z);
		G[y].emplace_back(x, z);
		R += z;
	}
	while (L <= R) {
		long long mid = L + R >> 1;
		if (check(mid)) ans = mid, R = mid - 1;
		else L = mid + 1;
	}
	std::cout << ans << '\n';
	check(ans);
	int tot = 0;
	for (int i = 1; i <= n; ++i)
		if (g[i])
			++tot;
	if (tot < k) {
		for (int i = 1; i <= n; ++i) {
			if (!g[i]) {
				g[i] = 1;
				++tot;
				if (tot == k) break;
			}
		}
	}
	for (int i = 1; i <= n; ++i)
		if (g[i])
			std::cout << i << " ";
	
	std::cout << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 11644kb

input:

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

output:

60
5 17 

result:

ok good plan!

Test #2:

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

input:

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

output:

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

result:

ok good plan!

Test #3:

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

input:

20 3
1 2 550803874
2 3 866769458
3 4 8
4 5 73
5 6 237552189
6 7 741604420
7 8 438142361
8 9 805264075
9 10 519768400
10 11 79
11 12 85
12 13 196686438
13 14 35
14 15 61
15 16 866072932
16 17 7
17 18 64
18 19 56
19 20 59576328

output:

925649387
2 7 15 

result:

ok good plan!

Test #4:

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

input:

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

output:

20
9 

result:

ok good plan!

Test #5:

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

input:

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

output:

17
1 6 

result:

ok good plan!

Test #6:

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

input:

20 5
4 20 184603160
5 20 137772914
18 20 92
11 20 100
1 20 626064537
17 20 69
15 20 638426634
16 20 250316406
3 20 4
8 20 891806319
14 20 52
12 20 553267405
9 20 760628102
7 20 83
2 20 464370262
10 20 633797674
19 20 179713149
13 20 28
6 20 170303371

output:

626064537
8 9 10 15 20 

result:

ok good plan!

Test #7:

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

input:

20 5
12 17 276497378
14 12 902713274
6 14 273033411
19 12 874331676
20 12 261482945
11 17 997789222
10 12 375792207
16 10 211092537
1 10 269599235
18 1 661472930
8 16 508190026
2 8 377591526
3 17 892095448
7 8 628422534
13 16 590261229
5 8 984829199
15 8 306917309
4 2 813037557
9 10 809310450

output:

1150829054
1 2 8 14 17 

result:

ok good plan!

Test #8:

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

input:

20 4
4 12 408500617
11 12 609693845
15 4 81447928
7 4 57928501
5 4 569939534
16 15 836624445
6 11 139485731
17 4 610769754
9 15 504004361
20 15 12779751
3 6 361982686
19 7 174141922
1 19 852856532
10 16 334164604
8 19 567508134
14 9 177863976
18 11 646373187
13 17 282363265
2 16 702312082

output:

893133019
1 4 11 16 

result:

ok good plan!

Test #9:

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

input:

20 7
10 4 740038433
15 10 803321654
12 15 483765359
17 15 90002520
13 17 245862148
19 12 980688525
14 12 163614651
3 17 886714225
7 17 578040786
8 13 480590093
20 4 917459762
9 13 648788617
11 10 535307745
16 11 4975963
2 4 832053776
18 2 877572655
1 19 932753840
6 9 90662304
5 19 429263347

output:

886714225
1 2 10 13 17 19 20 

result:

ok good plan!

Test #10:

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

input:

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

output:

21
1 8 11 19 

result:

ok good plan!

Test #11:

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

input:

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

output:

14
1 3 5 6 8 10 

result:

ok good plan!

Test #12:

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

input:

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

output:

17
1 5 6 8 11 12 17 

result:

ok good plan!

Test #13:

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

input:

20 3
16 18 37
1 18 74
13 16 885925489
15 13 97108262
14 16 502307484
20 15 61
7 13 477999775
3 13 90
11 20 62
12 16 432613987
19 14 887921244
9 15 994748022
10 3 416528844
5 16 224612023
4 7 386590547
17 4 267779776
6 5 4
2 11 78
8 19 640334604

output:

1132370098
1 13 19 

result:

ok good plan!

Test #14:

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

input:

20 6
10 17 42
18 10 61
15 17 95
8 15 47
2 17 961333405
7 10 89
19 10 30
6 10 48
11 18 477828062
16 8 63
13 17 702081050
4 2 208445139
3 19 790239381
9 3 71
12 7 129313491
5 13 52
14 18 82
20 18 492707276
1 8 9

output:

208445139
1 2 3 11 13 20 

result:

ok good plan!

Subtask #2:

score: 10
Accepted

Test #15:

score: 10
Accepted
time: 209ms
memory: 37984kb

input:

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

output:

982714
93789 

result:

ok good plan!

Test #16:

score: 0
Accepted
time: 354ms
memory: 38768kb

input:

192595 1
1 2 360994541
2 3 434246796
3 4 113501088
4 5 988422069
5 6 686457869
6 7 838921686
7 8 487466902
8 9 937777228
9 10 201767064
10 11 640305835
11 12 101268762
12 13 851508518
13 14 826525105
14 15 566385314
15 16 817653043
16 17 716656517
17 18 191326728
18 19 116409764
19 20 922345234
20 2...

output:

48219532145561
96321 

result:

ok good plan!

Test #17:

score: 0
Accepted
time: 314ms
memory: 19356kb

input:

198391 1
178193 171903 462740353
198284 171903 534140755
196705 171903 290330389
190267 171903 224260429
192270 171903 25583862
141802 171903 620045660
187875 171903 390894001
171035 171903 898753813
197838 171903 35857953
148080 171903 752682663
176675 171903 363558548
187840 171903 930208067
16461...

output:

999996622
171903 

result:

ok good plan!

Test #18:

score: 0
Accepted
time: 1139ms
memory: 18668kb

input:

187050 1
142437 141719 617051699
100571 141719 730152295
181476 141719 919156274
178500 141719 652692297
183489 141719 502747854
80367 141719 337684509
130100 100571 882721922
152553 141719 975814485
129098 141719 535468389
165982 142437 107375401
186220 100571 55707458
164663 186220 29810074
135631...

output:

13866761246
100571 

result:

ok good plan!

Test #19:

score: 0
Accepted
time: 1283ms
memory: 18376kb

input:

181083 1
151449 153579 224933141
161993 151449 567743501
174520 151449 499146297
177818 174520 79825306
151563 153579 672068802
167078 153579 420401807
125224 167078 175943683
145141 151449 81148098
161335 151449 249312067
141425 161335 188105328
140936 141425 687195622
166032 141425 96880419
137516...

output:

13050107689
141425 

result:

ok good plan!

Test #20:

score: 0
Accepted
time: 975ms
memory: 18396kb

input:

181350 1
143511 150046 749945996
179786 143511 997101646
177898 150046 782503657
162661 179786 73263805
158330 143511 820426258
165190 162661 539915310
177690 158330 691322021
90157 177898 560792091
127486 158330 644557362
138968 179786 698940150
175780 162661 411389394
175747 138968 752936706
16468...

output:

15409312185
143511 

result:

ok good plan!

Test #21:

score: 0
Accepted
time: 574ms
memory: 18512kb

input:

182826 1
161392 170644 16
154154 161392 15
119121 170644 14
144817 154154 4
174532 119121 20
172295 144817 7
148163 172295 10
159754 174532 20
149557 154154 17
159717 172295 1
134324 148163 5
147386 174532 12
166996 154154 16
176500 166996 1
176799 172295 18
177522 174532 4
176884 159717 17
153520 1...

output:

304
119121 

result:

ok good plan!

Test #22:

score: 0
Accepted
time: 588ms
memory: 18888kb

input:

192527 1
165412 116267 19
154300 116267 6
157993 116267 4
186594 116267 10
85125 165412 7
159614 165412 8
186364 154300 1
157372 186364 18
173851 85125 16
186854 173851 10
53035 85125 3
173392 186364 19
163003 173392 18
137380 173851 6
185733 137380 12
162761 186854 4
123161 163003 12
172882 185733 ...

output:

325
165412 

result:

ok good plan!

Test #23:

score: 0
Accepted
time: 833ms
memory: 18756kb

input:

187423 1
167849 183613 222694020
157764 167849 922100733
176387 157764 97
81234 167849 416689194
183531 176387 67
169270 157764 924710486
186288 169270 92
161240 157764 66
180777 157764 118102885
180725 176387 529170092
152907 176387 834708930
174699 186288 440235704
169140 180777 598069997
118117 1...

output:

9428366959
169140 

result:

ok good plan!

Test #24:

score: 0
Accepted
time: 1145ms
memory: 18784kb

input:

191973 1
190949 149956 35
149619 149956 44
175164 149956 32
160014 149619 54
111597 149619 544751540
93568 149956 507988498
171510 160014 95
137531 149619 40
187341 149619 793752556
165952 93568 11
165465 111597 775305786
172407 165952 30
175847 172407 62
185975 111597 22
177625 160014 61
188434 165...

output:

9899410246
149956 

result:

ok good plan!

Test #25:

score: 0
Accepted
time: 637ms
memory: 20324kb

input:

189158 1
172224 182134 381573055
137053 172224 528567414
176500 182134 609937546
118206 137053 247581670
185094 118206 478470414
183207 176500 815852059
172415 185094 174180784
181448 176500 181039339
164976 176500 539014702
188301 118206 880596232
157551 183207 861480611
170986 137053 350173735
150...

output:

7846716477995
75816 

result:

ok good plan!

Test #26:

score: 0
Accepted
time: 625ms
memory: 20732kb

input:

181844 1
170199 144015 815417169
103389 170199 377189576
175450 170199 400742591
181058 170199 983123431
179411 170199 839680010
158460 170199 528433606
174368 179411 506478871
178377 170199 791447506
149504 181058 644104869
181377 103389 949298908
159946 103389 807073186
112953 178377 336684757
178...

output:

7520424931341
90004 

result:

ok good plan!

Test #27:

score: 0
Accepted
time: 672ms
memory: 21684kb

input:

198509 1
193121 149405 991144749
125627 149405 65477043
176456 149405 601317568
191561 193121 323860723
173642 193121 659454967
181489 176456 493934335
188508 176456 238089275
179961 193121 920717686
186794 176456 730476638
195827 149405 410681009
175881 188508 344779086
189098 175881 323832445
1750...

output:

8245599699653
95267 

result:

ok good plan!

Test #28:

score: 0
Accepted
time: 289ms
memory: 20308kb

input:

181137 1
167343 169281 8
169364 169281 18
129740 167343 17
134442 169364 8
163521 134442 4
140053 167343 15
179312 140053 17
174703 163521 12
156461 167343 11
173176 163521 17
166820 179312 9
166968 129740 9
173982 174703 9
172643 174703 7
162196 156461 2
175581 166820 16
165063 174703 8
138754 1747...

output:

158985
8856 

result:

ok good plan!

Test #29:

score: 0
Accepted
time: 447ms
memory: 19972kb

input:

181188 1
162350 142561 8
175009 162350 10
154656 175009 10
108196 154656 16
143858 108196 15
180596 143858 20
166056 175009 3
135762 180596 12
180094 143858 6
148696 143858 20
117489 108196 6
91527 180094 12
132567 135762 14
174940 180596 2
115538 180596 8
24017 117489 12
142917 166056 7
178539 1155...

output:

158591
51676 

result:

ok good plan!

Test #30:

score: 0
Accepted
time: 800ms
memory: 20660kb

input:

184742 1
136916 61582 23
65397 61582 722989856
179096 136916 550975734
152377 136916 533814665
179237 65397 33
179757 65397 680253882
159174 61582 91
164189 65397 926629963
163288 159174 5
118484 163288 121439920
176002 152377 47
181880 179757 3
166985 179757 58
183719 179237 1
84814 118484 8
175192...

output:

3914331378792
78024 

result:

ok good plan!

Test #31:

score: 0
Accepted
time: 802ms
memory: 19940kb

input:

181663 1
172298 165725 910117257
161068 165725 86826154
146877 165725 19
172980 172298 58
145280 165725 88
145120 146877 513625641
157463 145280 93234767
142788 146877 256067622
139620 172980 18
160194 172980 92
179867 172980 721081853
115257 172298 34
107971 115257 2
93670 172980 74
150989 157463 5...

output:

3848891581430
86526 

result:

ok good plan!

Subtask #3:

score: 30
Accepted

Test #32:

score: 30
Accepted
time: 333ms
memory: 39192kb

input:

196048 16
1 2 978846016
2 3 740361125
3 4 865834368
4 5 370695600
5 6 899703051
6 7 109025897
7 8 986275973
8 9 632960850
9 10 312347681
10 11 833242253
11 12 254020422
12 13 366448326
13 14 889732662
14 15 567527246
15 16 666073849
16 17 11025926
17 18 464347287
18 19 190825890
19 20 693905943
20 2...

output:

3060205547451
6147 18408 30641 42908 55156 67405 79567 91855 104081 116465 128667 140956 153256 165491 177715 189967 

result:

ok good plan!

Test #33:

score: 0
Accepted
time: 358ms
memory: 38428kb

input:

190590 19
1 2 432810578
2 3 963215671
3 4 355790305
4 5 911948705
5 6 446235912
6 7 607923018
7 8 662438796
8 9 374975085
9 10 476878761
10 11 984267634
11 12 648159426
12 13 993847255
13 14 708186433
14 15 24613977
15 16 895240127
16 17 905313118
17 18 812425561
18 19 723072415
19 20 909213119
20 2...

output:

2509247728926
5051 15116 25136 35186 45163 55175 65129 75060 85028 95065 105175 115149 125150 135157 145169 155260 165377 175460 185585 

result:

ok good plan!

Test #34:

score: 0
Accepted
time: 301ms
memory: 36912kb

input:

180852 2
1 2 20238893
2 3 582569644
3 4 715436618
4 5 273623487
5 6 475900532
6 7 750942245
7 8 260783534
8 9 959516758
9 10 447281880
10 11 91928361
11 12 568159575
12 13 558661382
13 14 827759762
14 15 226937032
15 16 446294873
16 17 53154419
17 18 799628660
18 19 644222970
19 20 740553669
20 21 6...

output:

22568587375587
45287 135496 

result:

ok good plan!

Test #35:

score: 0
Accepted
time: 293ms
memory: 37060kb

input:

180435 1
1 2 725168740
2 3 801094460
3 4 211926261
4 5 728455393
5 6 787442218
6 7 851378256
7 8 466378228
8 9 720591486
9 10 154429096
10 11 776735794
11 12 368712837
12 13 172256515
13 14 62759743
14 15 9314804
15 16 462148790
16 17 461747880
17 18 182783034
18 19 305476929
19 20 160855646
20 21 6...

output:

45083010717826
90245 

result:

ok good plan!

Test #36:

score: 0
Accepted
time: 328ms
memory: 37936kb

input:

187094 187092
1 2 697089100
2 3 953792503
3 4 930809188
4 5 877668251
5 6 290091572
6 7 928000677
7 8 322766688
8 9 745059808
9 10 196346260
10 11 635484557
11 12 35503576
12 13 805814319
13 14 151075630
14 15 625080244
15 16 573433614
16 17 499380033
17 18 622509558
18 19 771303346
19 20 817154222
...

output:

7714
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

result:

ok good plan!

Test #37:

score: 0
Accepted
time: 360ms
memory: 38300kb

input:

189383 91060
1 2 78868937
2 3 379799617
3 4 255789622
4 5 430461357
5 6 918832571
6 7 792519010
7 8 371928174
8 9 627067213
9 10 643263080
10 11 559300213
11 12 274602588
12 13 914279588
13 14 586168182
14 15 985458816
15 16 272101442
16 17 529831818
17 18 153483201
18 19 737855077
19 20 518160413
2...

output:

577077016
1 4 6 7 9 11 13 14 15 17 19 21 22 24 28 29 30 32 36 40 43 44 45 47 50 51 53 55 56 57 59 60 62 64 66 68 70 73 76 77 79 81 82 83 85 87 89 93 97 99 104 106 108 109 110 113 114 115 116 121 124 125 128 129 131 132 134 135 137 139 142 145 148 151 154 156 157 158 160 162 163 167 170 171 172 174 1...

result:

ok good plan!

Test #38:

score: 0
Accepted
time: 381ms
memory: 39096kb

input:

195352 110563
1 2 911782976
2 3 905109583
3 4 232247396
4 5 863385007
5 6 667600451
6 7 520474437
7 8 780632568
8 9 385578090
9 10 556115308
10 11 165601463
11 12 688000843
12 13 832841687
13 14 583836985
14 15 168926278
15 16 97194912
16 17 292418675
17 18 599725999
18 19 949989960
19 20 890733464
...

output:

464950429
1 2 3 5 6 7 8 10 12 13 15 18 19 21 23 24 26 27 29 30 32 33 35 36 38 39 42 44 46 48 49 50 52 53 54 56 57 59 60 62 63 64 65 67 70 72 74 76 78 79 80 82 83 86 89 93 95 96 97 98 99 101 104 107 109 110 112 114 115 118 120 121 123 124 125 126 127 129 131 132 134 136 137 138 141 142 143 145 147 14...

result:

ok good plan!

Test #39:

score: 0
Accepted
time: 342ms
memory: 39308kb

input:

197271 20
1 2 715829925
2 3 346984672
3 4 498305645
4 5 456136025
5 6 978059480
6 7 90431856
7 8 99
8 9 138043632
9 10 24
10 11 53
11 12 542618416
12 13 63
13 14 657849010
14 15 88
15 16 85
16 17 995661461
17 18 304787411
18 19 859133914
19 20 64
20 21 83
21 22 339954139
22 23 679395670
23 24 88
24 ...

output:

1242267897088
4940 15021 24718 34656 44597 54449 64133 73936 83945 93740 103578 113363 123240 132946 142941 152776 162609 172461 182406 192310 

result:

ok good plan!

Test #40:

score: 0
Accepted
time: 351ms
memory: 39108kb

input:

195553 16
1 2 242284940
2 3 54
3 4 772113924
4 5 53
5 6 323134245
6 7 26
7 8 93
8 9 2
9 10 31
10 11 678644310
11 12 736180013
12 13 143288420
13 14 60
14 15 75
15 16 54
16 17 80
17 18 320071398
18 19 357523373
19 20 833026992
20 21 443380333
21 22 54
22 23 88374443
23 24 116397953
24 25 792192797
25...

output:

1550069706488
6060 18102 30412 42747 55053 67544 79863 92005 104151 116230 128441 140651 152961 165103 177339 189568 

result:

ok good plan!

Test #41:

score: 0
Accepted
time: 324ms
memory: 38560kb

input:

191608 2
1 2 630970075
2 3 76
3 4 678602313
4 5 19
5 6 27
6 7 47
7 8 232619510
8 9 75
9 10 47
10 11 73
11 12 874510878
12 13 85
13 14 97
14 15 637401673
15 16 183941588
16 17 36
17 18 882819954
18 19 500789157
19 20 8
20 21 500627949
21 22 47
22 23 76
23 24 5
24 25 474175264
25 26 14
26 27 2
27 28 7...

output:

12151315765206
47759 143774 

result:

ok good plan!

Test #42:

score: 0
Accepted
time: 306ms
memory: 37544kb

input:

184518 1
1 2 33
2 3 12
3 4 67
4 5 846296351
5 6 38
6 7 309398672
7 8 11
8 9 82
9 10 430243211
10 11 633697393
11 12 32
12 13 359245893
13 14 92
14 15 99
15 16 768825893
16 17 71483034
17 18 106677685
18 19 100
19 20 90
20 21 839084567
21 22 75
22 23 83
23 24 734827035
24 25 698588915
25 26 90
26 27 ...

output:

23292589077136
92444 

result:

ok good plan!

Test #43:

score: 0
Accepted
time: 354ms
memory: 38860kb

input:

193873 193871
1 2 40
2 3 494384716
3 4 86
4 5 363806713
5 6 759690676
6 7 28
7 8 955846367
8 9 304853712
9 10 54
10 11 91
11 12 48
12 13 613650010
13 14 519331290
14 15 45
15 16 68
16 17 399348148
17 18 255860048
18 19 32
19 20 833568709
20 21 55
21 22 92
22 23 528577499
23 24 109783288
24 25 925012...

output:

1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok good plan!

Test #44:

score: 0
Accepted
time: 385ms
memory: 39296kb

input:

197252 139268
1 2 875704412
2 3 195588816
3 4 744350976
4 5 60
5 6 960298671
6 7 875659030
7 8 296211605
8 9 426698874
9 10 34
10 11 125889971
11 12 54
12 13 22
13 14 3
14 15 266262810
15 16 888756396
16 17 55
17 18 5
18 19 20
19 20 720293987
20 21 149527407
21 22 277989298
22 23 912798956
23 24 922...

output:

62
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 1...

result:

ok good plan!

Test #45:

score: 0
Accepted
time: 350ms
memory: 38972kb

input:

194702 85037
1 2 54
2 3 564614430
3 4 76
4 5 496740996
5 6 90
6 7 151526871
7 8 97
8 9 556803101
9 10 95
10 11 285587071
11 12 20
12 13 255586137
13 14 64
14 15 6
15 16 483361661
16 17 80
17 18 273912818
18 19 12
19 20 677280030
20 21 195243520
21 22 28
22 23 26
23 24 37
24 25 84
25 26 385712280
26 ...

output:

134451571
1 3 5 7 9 11 13 16 18 20 21 26 27 30 32 34 36 37 39 44 46 47 48 52 53 58 61 62 63 67 68 70 71 73 75 79 80 82 85 86 89 90 91 94 100 101 102 105 111 115 116 117 119 120 121 123 124 128 129 132 135 139 142 143 144 151 152 153 157 159 160 162 164 165 168 172 173 174 175 176 178 182 185 186 189...

result:

ok good plan!

Test #46:

score: 0
Accepted
time: 175ms
memory: 38588kb

input:

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

output:

62838
5948 17965 29843 41848 53887 65843 77787 89730 101719 113655 125638 137618 149694 161600 173504 185469 

result:

ok good plan!

Test #47:

score: 0
Accepted
time: 169ms
memory: 37436kb

input:

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

output:

53528
5086 15281 25503 35631 45821 56031 66293 76517 86621 96775 107036 117309 127450 137670 147906 158116 168263 178481 

result:

ok good plan!

Test #48:

score: 0
Accepted
time: 207ms
memory: 37128kb

input:

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

output:

479568
45645 136982 

result:

ok good plan!

Test #49:

score: 0
Accepted
time: 217ms
memory: 38716kb

input:

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

output:

1012182
96405 

result:

ok good plan!

Test #50:

score: 0
Accepted
time: 206ms
memory: 37208kb

input:

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

output:

1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok good plan!

Test #51:

score: 0
Accepted
time: 217ms
memory: 38140kb

input:

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

output:

6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok good plan!

Test #52:

score: 0
Accepted
time: 197ms
memory: 37728kb

input:

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

output:

10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 1...

result:

ok good plan!

Subtask #4:

score: 60
Accepted

Test #53:

score: 60
Accepted
time: 1250ms
memory: 18532kb

input:

185461 15
182882 106231 818799491
145993 182882 259201333
23956 106231 562144843
67210 106231 588237180
182452 106231 228487955
111020 106231 16086118
129402 23956 167707562
180267 67210 995923293
162359 180267 258763062
135245 180267 580722661
117070 111020 263990279
159188 180267 875020546
122243 ...

output:

10452752809
69893 85731 106231 135245 138106 139028 143867 156030 159188 164782 166697 169630 174483 184347 185031 

result:

ok good plan!

Test #54:

score: 0
Accepted
time: 1316ms
memory: 18828kb

input:

190981 19
174778 186776 516888315
129209 186776 329745618
185289 174778 639949049
165931 129209 285239202
140456 186776 619530033
129664 185289 696634376
185739 174778 763298617
127518 129209 771672690
138411 129664 689726422
91210 127518 392830028
185430 174778 995672205
141447 174778 317862250
176...

output:

10848262984
94342 108438 125878 128284 129664 141447 141661 165760 166678 167405 168413 172945 173295 178411 180621 186728 187116 188767 189433 

result:

ok good plan!

Test #55:

score: 0
Accepted
time: 1088ms
memory: 19132kb

input:

199304 17
192056 151010 883678992
164820 151010 371744107
126522 151010 858070085
197310 192056 133941562
191675 126522 880736943
160274 191675 720021152
196812 192056 370544028
163417 164820 665322406
191701 196812 666126674
189405 196812 788658873
199036 189405 446243161
187051 126522 245503398
19...

output:

10833054678
91809 120278 122455 126522 164429 164820 165348 178385 187058 188667 189405 191560 192056 194119 194345 198829 199036 

result:

ok good plan!

Test #56:

score: 0
Accepted
time: 1042ms
memory: 18844kb

input:

193848 11744
177565 181315 776942740
152290 181315 254727201
154509 152290 719313371
165162 152290 863310380
183813 181315 537913000
139654 181315 792440525
123385 154509 79969572
181020 181315 82108020
130093 139654 770691461
119885 183813 639092994
31853 139654 754647837
123844 154509 752373209
17...

output:

2411841329
7 12 22 25 35 41 51 54 55 70 79 110 124 157 163 190 232 246 301 303 315 316 325 329 334 357 363 385 405 408 477 478 504 512 541 583 612 613 616 620 625 629 661 684 700 701 726 730 732 733 735 757 792 793 816 826 830 836 850 853 854 869 899 931 942 954 962 977 1044 1049 1054 1065 1071 1076...

result:

ok good plan!

Test #57:

score: 0
Accepted
time: 1025ms
memory: 18780kb

input:

192896 75052
186618 186211 309324364
174223 186211 727705156
109654 186211 358741934
186399 109654 174910135
149432 109654 859091875
26999 109654 681333743
185155 186399 761535848
157091 149432 458604437
157571 157091 467956963
148196 186618 698945319
175400 148196 733799739
186513 157571 693036138
...

output:

753137091
4 9 10 14 18 21 26 30 36 38 39 40 42 43 48 51 52 54 55 56 60 62 64 65 66 67 70 72 74 78 82 84 85 92 95 96 97 99 101 102 107 111 113 114 116 117 119 120 123 124 126 127 128 131 132 133 134 135 137 140 149 150 154 156 157 158 159 161 163 164 165 168 174 177 179 180 181 182 184 185 186 188 18...

result:

ok good plan!

Test #58:

score: 0
Accepted
time: 820ms
memory: 18452kb

input:

187151 2
182120 172131 693728619
179884 182120 957298173
180096 182120 798499820
126854 172131 684319695
98378 182120 337675752
182971 180096 961283684
157556 180096 405790956
184928 157556 834497920
164465 126854 702263971
158546 126854 257264005
149485 182971 669177462
97949 180096 786144541
16681...

output:

14251095305
97949 182120 

result:

ok good plan!

Test #59:

score: 0
Accepted
time: 872ms
memory: 18916kb

input:

194517 194515
183847 109231 34655521
132447 109231 262401468
192509 132447 101956937
155025 183847 267867243
181394 192509 244741058
128148 109231 710814141
176651 183847 740384833
184470 155025 381402985
181476 132447 467301728
194012 155025 551586780
116459 109231 674038698
143624 181476 679180850...

output:

10333
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

result:

ok good plan!

Test #60:

score: 0
Accepted
time: 410ms
memory: 19068kb

input:

198766 19
118485 170757 13
181183 170757 8
189136 118485 4
166427 118485 15
170111 166427 15
189559 118485 7
185752 189559 1
198592 170757 15
119825 181183 20
196481 119825 20
105946 170757 1
168836 170757 9
197439 196481 5
168374 105946 8
192044 181183 10
158018 166427 2
157918 158018 4
164193 1985...

output:

233
116795 118485 119825 124529 124869 132221 135886 136917 160732 171764 182997 183088 184197 189559 190376 193233 193779 196481 196893 

result:

ok good plan!

Test #61:

score: 0
Accepted
time: 414ms
memory: 18388kb

input:

180945 18
176902 172172 3
126064 176902 20
161169 126064 5
169156 161169 1
137302 126064 14
150735 176902 12
168600 150735 19
149662 168600 16
159424 149662 17
161626 176902 20
180716 176902 19
149136 150735 4
152752 150735 16
99431 161626 6
167069 169156 20
177506 149662 9
151373 159424 16
154438 1...

output:

227
97006 99672 117765 120003 122330 130720 133415 152991 153580 159424 159618 159741 160212 161169 161626 172852 174830 176272 

result:

ok good plan!

Test #62:

score: 0
Accepted
time: 402ms
memory: 18332kb

input:

180043 95528
168622 170132 1
120729 168622 3
176819 120729 16
169880 170132 12
179637 170132 2
159908 176819 7
165776 120729 8
173189 176819 20
161050 176819 17
164088 176819 16
174649 176819 19
135112 176819 8
165990 176819 19
81350 174649 13
123563 173189 18
132721 81350 3
124189 168622 7
143301 1...

output:

11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 17 18 20 21 22 23 25 26 27 28 29 31 32 34 35 37 38 39 40 43 44 45 46 50 51 55 57 58 62 64 65 67 68 70 73 74 75 76 77 78 80 81 82 83 85 87 89 90 96 97 98 99 104 105 106 109 111 112 114 116 117 118 121 123 125 127 128 132 134 137 138 139 142 143 144 148 150 153 154 ...

result:

ok good plan!

Test #63:

score: 0
Accepted
time: 485ms
memory: 19060kb

input:

199611 2
193852 180877 6
155863 180877 12
196115 155863 13
134698 193852 19
152788 155863 17
138639 152788 19
189476 138639 17
198899 138639 10
141737 180877 11
188731 141737 20
157643 196115 9
195763 141737 9
156761 193852 2
185341 156761 4
161043 152788 11
183091 157643 5
189272 141737 17
195139 1...

output:

291
138639 141737 

result:

ok good plan!

Test #64:

score: 0
Accepted
time: 405ms
memory: 18680kb

input:

186927 186925
169357 178830 4
150699 178830 11
184861 169357 13
32715 178830 12
182824 178830 15
183226 169357 4
183443 178830 16
184563 182824 10
137945 178830 9
147640 183226 18
163735 183226 1
164883 137945 17
96389 182824 6
174317 183226 4
146134 96389 7
172840 184563 8
167182 137945 19
171384 3...

output:

1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok good plan!

Test #65:

score: 0
Accepted
time: 842ms
memory: 18844kb

input:

193560 17
164568 188376 112715646
176708 188376 27
170749 164568 70565140
172140 164568 15
188494 176708 253187145
167450 170749 59
192292 188376 69
130130 188376 812906692
190481 188376 363255219
143931 167450 83
143002 188376 162992325
181206 143931 753929063
181322 143931 9
176994 172140 86
17942...

output:

7033515519
106070 114433 130130 143367 155188 159793 167980 170749 181206 182776 182879 183484 187758 188376 189683 191608 192530 

result:

ok good plan!

Test #66:

score: 0
Accepted
time: 1027ms
memory: 18536kb

input:

186282 89560
178298 162296 819399660
156147 162296 3
135303 162296 44
166185 162296 309109510
138804 166185 71
177681 156147 651389903
185443 138804 914476293
179868 162296 20
176580 162296 14
159571 185443 42
170912 185443 725502746
114376 176580 312634833
153923 177681 718731204
176135 185443 5465...

output:

48162964
1 2 4 12 16 19 20 21 22 23 24 25 26 28 30 31 32 34 38 41 44 46 48 49 50 51 53 55 57 58 60 62 64 66 68 71 72 73 74 75 76 78 79 81 83 84 86 87 88 89 91 93 96 97 100 101 102 104 106 108 110 115 116 118 121 124 129 133 137 138 140 141 142 147 148 149 150 153 154 155 156 157 162 163 166 167 169 ...

result:

ok good plan!

Test #67:

score: 0
Accepted
time: 1033ms
memory: 18348kb

input:

182319 2
163862 179355 21
140420 163862 851608779
100562 179355 56
165585 163862 42
180310 165585 15231526
166965 100562 786216707
155145 100562 67
124079 140420 62
128434 165585 13
149044 128434 881645659
170958 155145 59
180658 128434 7
137616 179355 604252537
163844 149044 91
159169 128434 66
126...

output:

9566033676
140420 166965 

result:

ok good plan!

Test #68:

score: 0
Accepted
time: 1162ms
memory: 18916kb

input:

195662 195660
121899 189567 73
166088 189567 14
170348 121899 26
193073 170348 58180196
141764 170348 603768851
187797 193073 500125354
183613 121899 615767183
166597 121899 35
177994 183613 78861930
148178 170348 18
148954 193073 58
191754 177994 349373078
169923 177994 206277713
140739 121899 10
1...

output:

1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok good plan!

Test #69:

score: 0
Accepted
time: 364ms
memory: 38680kb

input:

192111 18
1 2 748399182
2 3 310046822
3 4 788030864
4 5 952339966
5 6 293701258
6 7 41962289
7 8 789066036
8 9 665500852
9 10 211473235
10 11 210325375
11 12 527085239
12 13 680145292
13 14 104700151
14 15 589238419
15 16 97300469
16 17 592000690
17 18 237684923
18 19 86286725
19 20 244001918
20 21 ...

output:

2660470048850
5395 16038 26795 37480 48081 58744 69450 80151 90833 101499 112165 122830 133480 144207 154772 165501 176204 186813 

result:

ok good plan!

Test #70:

score: 0
Accepted
time: 279ms
memory: 37224kb

input:

182241 17
1 2 41486483
2 3 264127449
3 4 73
4 5 416952697
5 6 75
6 7 355054791
7 8 63
8 9 357069955
9 10 757718644
10 11 328639843
11 12 679836651
12 13 3
13 14 80
14 15 27
15 16 74
16 17 28141822
17 18 4
18 19 93
19 20 976095140
20 21 13
21 22 98
22 23 55831011
23 24 966366319
24 25 623245756
25 26...

output:

1353730542507
5362 15852 26541 37133 47911 58577 69482 80285 91099 101737 112218 123057 133800 144586 155353 165968 176862 

result:

ok good plan!

Test #71:

score: 0
Accepted
time: 363ms
memory: 39528kb

input:

197738 90774
1 2 913268863
2 3 393573805
3 4 32
4 5 238605198
5 6 6
6 7 33
7 8 375822657
8 9 87
9 10 16
10 11 82
11 12 94
12 13 751341715
13 14 792853118
14 15 210366690
15 16 16
16 17 11
17 18 531731955
18 19 30097340
19 20 74
20 21 904101562
21 22 50
22 23 292717426
23 24 147457488
24 25 1
25 26 2...

output:

90871959
1 2 3 5 8 13 14 15 18 21 23 24 26 27 28 30 34 36 37 38 44 47 49 50 52 53 54 56 57 60 62 63 66 67 69 70 71 72 73 74 76 80 81 82 87 88 90 94 95 97 99 101 102 103 104 109 110 111 114 119 120 122 125 126 128 133 137 139 140 141 143 145 146 147 148 149 151 153 154 155 156 158 168 169 170 171 178...

result:

ok good plan!

Test #72:

score: 0
Accepted
time: 219ms
memory: 18368kb

input:

186844 20
4732 184051 973274979
182929 184051 123965861
146378 184051 312314364
183334 184051 562012251
161522 184051 752553089
163790 184051 404801852
172240 184051 131283915
154769 184051 547837480
125586 184051 12616455
81139 184051 197289688
150380 184051 759623273
167157 184051 430794375
132408...

output:

999896777
4261 6869 13786 18401 29352 45316 47567 57605 85937 100661 104658 115347 129507 135282 153011 156218 157907 160462 166365 184051 

result:

ok good plan!

Test #73:

score: 0
Accepted
time: 146ms
memory: 18832kb

input:

195474 2
193556 183561 15
194285 183561 9
31627 183561 8
179792 183561 18
175779 183561 20
180988 183561 3
143150 183561 16
156137 183561 5
191734 183561 13
161420 183561 20
194658 183561 12
125563 183561 2
136072 183561 15
182623 183561 9
194159 183561 7
186805 183561 5
188651 183561 6
185560 18356...

output:

20
1 183561 

result:

ok good plan!

Test #74:

score: 0
Accepted
time: 176ms
memory: 18964kb

input:

196309 103701
190304 179935 17
195577 179935 15
156368 179935 18
160763 179935 10
61642 179935 1
186507 179935 4
181206 179935 13
181826 179935 12
178192 179935 16
159267 179935 11
147404 179935 15
195732 179935 2
180939 179935 9
155352 179935 5
132457 179935 7
142061 179935 6
188360 179935 1
148684...

output:

10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 1...

result:

ok good plan!

Test #75:

score: 0
Accepted
time: 640ms
memory: 20992kb

input:

185718 19
150952 157722 336927220
181548 157722 803065906
179202 150952 115444357
94972 179202 342492949
86121 150952 38704645
120929 86121 486240350
179382 86121 166207705
175744 94972 694237139
143977 157722 21538887
175258 86121 222781395
167840 157722 17515371
171893 120929 110312346
147297 1792...

output:

411891454012
4421 6865 9310 19255 19999 33245 40990 54134 56267 56433 79917 96754 109204 117062 127764 129311 136904 162328 162532 

result:

ok good plan!

Test #76:

score: 0
Accepted
time: 286ms
memory: 21252kb

input:

198627 20
178608 197487 15
179892 178608 4
162960 197487 4
150943 197487 13
193799 179892 18
188236 179892 16
148111 179892 3
181074 188236 10
80697 162960 1
198371 188236 15
188160 181074 1
194856 148111 1
169518 80697 16
197578 80697 9
87488 148111 13
170552 87488 16
156496 181074 15
186969 148111...

output:

8824
7259 7958 13151 22216 34797 41195 49212 56098 76345 81596 114858 117144 122218 135864 151031 156402 165209 179242 194501 197147 

result:

ok good plan!

Test #77:

score: 0
Accepted
time: 596ms
memory: 20772kb

input:

187587 18
156200 176620 561564394
181250 156200 59
164155 176620 2
176567 176620 32
110724 164155 138249876
152854 176567 90
150005 156200 24
162879 110724 68
160485 176620 17
143447 110724 433883840
118899 150005 961337262
156836 110724 975730879
179389 162879 681429421
162514 179389 17
186451 1793...

output:

224566896486
1310 16419 41094 54558 60442 63372 65601 73873 75219 87781 103645 116582 151275 162755 166495 175482 182259 184011 

result:

ok good plan!

Test #78:

score: 0
Accepted
time: 317ms
memory: 20724kb

input:

188220 35414
179921 156251 6
144719 156251 12
83856 179921 3
162941 156251 18
127786 83856 9
173158 156251 18
186663 144719 14
153494 156251 7
166388 144719 16
148865 144719 8
162312 153494 14
161112 144719 10
182765 166388 10
171207 127786 2
183546 166388 3
146739 127786 4
135802 171207 3
61252 186...

output:

28
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 1...

result:

ok good plan!

Extra Test:

score: 0
Extra Test Passed