QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#41374#4401. Prizedutinmeow100 ✓2902ms261748kbC++204.2kb2022-07-30 04:05:512022-07-30 04:08:25

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-07-30 04:08:25]
  • 评测
  • 测评结果:100
  • 用时:2902ms
  • 内存:261748kb
  • [2022-07-30 04:05:51]
  • 提交

answer

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

template<class Fun>
class y_combinator_result {
	Fun fun;
public:
	template<class T>
	explicit y_combinator_result(T &&_fun) : fun(forward<T>(_fun)) {}

	template<class ...Args>
	decltype(auto) operator()(Args &&...args) {
		return fun(ref(*this), forward<Args>(args)...);
	}
};

template<class Fun>
decltype(auto) y_combinator(Fun &&fun) {
	return y_combinator_result<decay_t<Fun>>(forward<Fun>(fun));
}

struct heavy_light_decomposition {
	vector<int> par, dep, hed, tin;

	heavy_light_decomposition(int R, vector<vector<int>> T) {
		int n = T.size(), time = 0;
		par.resize(n), dep.resize(n);
		hed.resize(n), tin.resize(n);
		par[R] = -1, dep[R] = 0, hed[R] = R;

		y_combinator([&](auto self, int u) -> int {
			int sub = 1, mxs = 0;
			for (int &v : T[u]) {
				par[v] = u;
				dep[v] = dep[u] + 1;
				int t = self(v);
				sub += t;
				if (mxs < t) {
					mxs = t;
					swap(T[u].front(), v);
				}
			}
			return sub;
		})(R);

		y_combinator([&](auto self, int u) -> void {
			tin[u] = time++;
			for (int v : T[u]) {
				hed[v] = v == T[u].front() ? hed[u] : v;
				self(v);
			}
		})(R);

		// for (int u = 0; u < n; u++) 
		// 	cerr << u << " : " << par[u] << ' ' << dep[u] << ' ' << hed[u] << ' ' << tin[u] << '\n';
		// cerr << "-------------------------\n";
	}

	int lowest_common_ancestor(int u, int v) {
		for (; hed[u] != hed[v]; u = par[hed[u]])
			if (dep[hed[u]] < dep[hed[v]])
				swap(u, v);
		return dep[u] < dep[v] ? u : v;
	}
};

struct virtual_tree {
	int n;
	heavy_light_decomposition &hld;
	pair<int, int> mnd = make_pair(1e9, -1);
	vector<vector<pair<int, int>>> vir;
	vector<int> dis;

	virtual_tree(int _n, heavy_light_decomposition &_hld) : n(_n), hld(_hld) {
		vir.resize(n);
		dis.resize(n);
	}

	void add_virtual_edge(int u, int v, int du, int dv) {
		int lca = hld.lowest_common_ancestor(u, v);
		// cerr << "lca of " << u << " and " << v << " = " << lca << '\n';
		mnd = min(mnd, make_pair(hld.dep[lca], lca));
		if (u != lca) {
			vir[lca].emplace_back(u, du);
			vir[u].emplace_back(lca, -du);
		}
		if (v != lca) {
			vir[lca].emplace_back(v, dv);
			vir[v].emplace_back(lca, -dv);
		}
	}

	void build_virtual_tree() {
		queue<int> que;
		vector<bool> vis(n, false);
		que.push(mnd.second);
		while (!que.empty()) {
			int u = que.front(); que.pop();
			for (auto [v, w] : vir[u]) {
				dis[v] = dis[u] + w;
				if (!vis[v]) {
					vis[v] = true;
					que.push(v);
				}
			}
		}
	}

	int query_distance(int u, int v) { return dis[u] + dis[v] - 2 * dis[hld.lowest_common_ancestor(u, v)]; }
};

int main() {
	int N, K, Q, T;
	cin >> N >> K >> Q >> T;
	int R1 = -1, R2 = -1;
	vector<vector<int>> T1(N), T2(N);
	for (int i = 0; i < N; i++) {
		int p;
		cin >> p;
		if (p == -1)
			R1 = i;
		else 
			T1[p - 1].push_back(i);
	}
	for (int i = 0; i < N; i++) {
		int p;
		cin >> p;
		if (p == -1)
			R2 = i;
		else 
			T2[p - 1].push_back(i);
	}

	heavy_light_decomposition hld1(R1, T1), hld2(R2, T2);
	virtual_tree vit1(N, hld1), vit2(N, hld2);

	vector<int> X;
	X.reserve(K);
	queue<int> que;
	que.push(R1);
	while (X.size() < K) {
		int u = que.front(); que.pop();
		X.push_back(u);
		for (int v : T1[u])
			que.push(v);
	}

	sort(X.begin(), X.end(), [&hld2](int u, int v) {
		return hld2.tin[u] < hld2.tin[v];
	});

	for (int i = 0; i < K; i++)
		cout << X[i] + 1 << ' ';
	cout << endl; cout.flush();
	for (int i = 0; i < K - 1; i++) 
		cout << "? " << X[i] + 1 << ' ' << X[i + 1] + 1 << '\n';
	cout << '!' << endl;
	cout.flush();

	for (int i = 0; i < K - 1; i++) {
		int f, g, p, q;
		cin >> f >> g >> p >> q;
		vit1.add_virtual_edge(X[i], X[i + 1], f, g);
		vit2.add_virtual_edge(X[i], X[i + 1], p, q);
	}

	vit1.build_virtual_tree();
	vit2.build_virtual_tree();

	vector<pair<int, int>> ans(T);
	for (int t = 0; t < T; t++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		ans[t] = {vit1.query_distance(u, v), vit2.query_distance(u, v)};
	}
	for (int t = 0; t < T; t++)
		cout << ans[t].first << ' ' << ans[t].second << '\n';
	cout.flush();
}

/*
9 3 2 3
2 -1 2 1 1 5 1 4 5
9 4 5 5 7 3 -1 3 7

10 0 0 1
0 3 13 5
*/

详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1462ms
memory: 134200kb

input:

500000 64682 64681 100000
46115
470589
209303
2979
473162
343535
79503
299539
404621
102085
237721
279170
392890
165201
441593
456314
218991
358478
86614
410800
159785
169761
95368
285837
297549
370283
378974
26449
444381
39320
149913
404523
144109
174828
263837
49847
468694
478535
152644
216598
301...

output:

422989 414496 290928 388223 160563 301045 470257 259625 222733 231286 345214 169817 435263 277447 386014 210139 455433 225855 264772 199736 355788 288506 233893 146148 454958 267562 498596 183745 352665 151125 266374 43142 9414 204593 212097 311775 25324 300764 6643 94847 396968 428563 311355 255767...

result:

ok good job!

Test #2:

score: 0
Accepted
time: 1443ms
memory: 135920kb

input:

500000 90967 90966 100000
122547
312039
290084
118442
352297
175176
294396
496975
127062
90539
132654
408480
493670
419897
53432
141795
264165
60368
473480
5634
253119
64236
85346
422987
28583
262389
111931
271291
13577
415079
132797
256502
76402
265607
11274
289667
398726
32021
302401
410650
369760...

output:

3090 193269 3028 186608 498475 64618 82114 231445 7541 329983 134623 235591 70401 18906 403427 280451 146897 355174 160090 144279 193430 332022 488244 228900 80781 84465 218682 27818 6035 368489 155673 440755 443926 241570 193717 143661 374105 56616 323329 95909 337798 20531 236329 28564 437244 4969...

result:

ok good job!

Test #3:

score: 0
Accepted
time: 1149ms
memory: 93304kb

input:

500000 68287 68286 100000
273928
229768
65518
144983
311611
494773
489379
439644
467893
456131
430188
247387
485565
272285
474827
476962
338340
365804
344570
390867
390170
456217
43185
447057
385874
305750
107742
230530
259907
252254
280920
16831
45761
185191
117450
55891
175190
255615
35904
14855
2...

output:

242387 339454 497922 201163 474669 26464 481148 316750 450339 71258 315452 330053 106092 420012 355363 493530 497790 24884 54655 8638 450106 99730 298743 102702 160390 266982 36727 412060 451419 477450 490178 495101 217041 350150 75810 78197 143612 176823 59955 434332 291430 132149 81318 225594 3738...

result:

ok good job!

Test #4:

score: 0
Accepted
time: 1074ms
memory: 92740kb

input:

500000 63976 63975 100000
230132
63748
303785
13497
431672
370351
360004
412191
378555
409703
485802
218204
475692
27602
220794
398856
89157
166559
116145
350738
277404
196706
40307
118602
171802
378360
389092
485168
224465
383516
33147
322617
254917
274019
57283
272241
216098
421952
489927
75641
40...

output:

210552 1449 320642 372383 262729 281250 39370 30507 7571 32979 305260 433331 39965 220803 336852 169518 123584 42633 497137 183387 393771 391451 402467 298184 355823 215893 326648 238876 403862 451933 413640 64966 174284 276932 286386 306005 376046 416656 463644 470690 74532 401095 354004 8771 48922...

result:

ok good job!

Test #5:

score: 0
Accepted
time: 1193ms
memory: 95116kb

input:

500000 87673 87672 100000
151599
456749
347511
703
348209
260440
488627
416030
419890
408089
83617
120781
133411
374231
460689
211838
137587
252914
392401
321583
55161
335205
334340
4527
14086
142229
197076
17695
262896
258702
273353
51181
10968
366799
324067
299421
281975
7236
420627
92324
299845
1...

output:

51300 74889 382285 63865 132781 53691 488798 168564 224453 362423 82639 157731 98561 261134 303438 176314 441193 476345 20192 471130 317253 115247 494397 80492 398390 202481 439811 156082 44615 76663 154436 158133 312643 167277 424873 9956 351816 61891 155317 97981 7099 127165 141544 260617 286554 2...

result:

ok good job!

Test #6:

score: 0
Accepted
time: 1273ms
memory: 102264kb

input:

500000 77912 77911 100000
270576
129318
366297
25873
179787
473782
221947
331327
209469
412992
410608
286179
37554
355546
297085
420463
496948
223036
122019
151250
478469
468136
19073
318549
398897
364415
23730
407160
26064
436939
30150
336421
375149
131841
58480
259944
117641
414831
64311
336164
31...

output:

210887 450513 372367 243217 17878 393825 463407 324697 246607 415699 193455 464346 34314 337722 389758 398573 961 150261 11366 431566 348482 426544 62168 402483 378539 193152 58656 464684 494519 390067 339840 385119 273679 473724 265624 54661 280376 405045 456676 370595 196033 263134 190021 243754 2...

result:

ok good job!

Test #7:

score: 0
Accepted
time: 1293ms
memory: 102160kb

input:

500000 77688 77687 100000
433011
472346
395389
187114
436024
138403
189990
398859
136147
195283
331183
46789
19828
335128
387768
442181
65556
72327
318927
462834
421288
227912
37067
387794
145879
258896
185861
356020
202881
490952
443694
95413
137215
137239
112863
481338
167802
304239
309781
391976
...

output:

176419 131882 35390 373863 204978 443479 492305 157831 85371 217598 310810 104348 344506 18218 34919 284048 375157 93215 437374 179027 246201 105486 90705 261692 432138 60063 214041 101698 415529 126781 367122 36224 346513 351518 104123 456286 93719 361257 433265 427613 233241 73489 455345 86243 286...

result:

ok good job!

Test #8:

score: 0
Accepted
time: 1209ms
memory: 102216kb

input:

500000 70973 70972 100000
449081
8094
7358
89457
426121
454508
470543
485236
63347
441977
422774
88672
243638
499709
170209
157788
229166
106888
228931
289706
435222
496384
381579
323479
499140
1511
385050
44171
413854
248273
352221
305112
24289
277461
391744
395003
85800
396455
355110
186446
285096...

output:

449195 359470 62857 516 49116 212775 238351 344036 287306 191612 27113 107127 151520 273425 250496 60335 369915 324800 64090 294847 116290 472262 346162 294387 394563 459841 489754 10232 282110 452952 212602 190468 18187 304310 65407 436452 81924 67075 130414 319607 304506 80799 215666 222467 329086...

result:

ok good job!

Test #9:

score: 0
Accepted
time: 1195ms
memory: 93056kb

input:

500000 66403 66402 100000
297237
432967
138046
88503
315699
372893
55309
335404
127581
165919
247543
254268
285147
289728
275281
44427
94393
302830
489861
429097
425153
11083
439096
414157
386411
152968
394984
46119
149177
369378
413029
198215
134317
366218
281170
465540
39702
367778
247925
64320
86...

output:

294428 473786 295516 356041 418380 409382 484446 470069 426742 3968 97410 101890 156452 38217 158317 228997 243634 283287 323725 189544 116905 187641 74576 163709 94730 361405 42582 360738 55631 148083 191969 3975 242835 431465 488704 211908 122831 282259 469284 237394 170610 9032 44959 11125 252362...

result:

ok good job!

Test #10:

score: 0
Accepted
time: 1184ms
memory: 94664kb

input:

500000 82328 82327 100000
280281
366446
183709
14447
442815
440473
121531
103568
472324
479656
337467
424742
474404
340302
269686
457628
230012
484228
422877
10759
156759
66102
130428
307888
123685
460634
235321
98667
93133
489886
479420
34961
352500
322001
129001
121871
135775
235639
100221
221760
...

output:

185494 187429 377218 243873 267775 178621 184766 4349 195440 99828 10982 99867 133073 208841 230896 246423 248092 305784 364762 367652 424224 450388 470232 60972 354863 151496 333667 132512 343219 63534 138598 105640 217782 385801 399543 477529 495705 179562 130184 39700 122202 88320 170991 240905 2...

result:

ok good job!

Test #11:

score: 0
Accepted
time: 1062ms
memory: 91920kb

input:

500000 53948 53947 100000
287984
258934
272973
481182
131565
217198
34714
463056
337977
495727
310042
26372
320480
231799
249741
340990
365501
267377
460708
248843
285777
172137
492784
201463
213559
259528
461602
235849
398717
25475
241699
451061
188952
251790
83551
169967
335575
209367
55705
6381
2...

output:

490646 220299 110592 14671 171220 242764 176269 161808 463889 328060 14265 31219 45630 81432 110571 167971 225799 241651 260969 32235 339201 345779 132900 263810 24711 342732 159009 360492 244977 335193 284465 423855 444609 4566 410029 400872 19888 254887 383833 168400 116874 19590 16373 101049 2900...

result:

ok good job!

Test #12:

score: 0
Accepted
time: 1114ms
memory: 94136kb

input:

500000 77935 77934 100000
38748
422564
39441
105430
38474
225464
237519
121832
72613
477531
321661
29181
307418
314049
120252
261006
88761
17726
492112
460837
55199
354114
417097
133271
231933
436973
110894
478550
291976
50101
38774
316091
306160
121826
315769
361823
82990
188508
124574
13093
235123...

output:

423149 432427 271601 403524 194295 171107 323540 222391 289224 289983 22716 199530 15564 442581 446252 456110 115524 107428 48943 240808 486311 241659 309231 257027 199799 373144 405787 412680 17927 448032 73476 165176 258148 446838 86190 144 85075 128951 146177 123392 397061 182004 185621 105571 11...

result:

ok good job!

Subtask #2:

score: 25
Accepted

Test #13:

score: 25
Accepted
time: 1464ms
memory: 135780kb

input:

500000 88721 177440 100000
30974
23891
211201
125199
180489
387190
218020
498838
230147
307989
484136
257785
353027
304420
311738
169842
334090
486070
126212
328609
174959
368840
238722
418092
488389
226349
427271
457322
332454
12958
197530
264474
355717
482774
221286
282148
216441
266659
213750
628...

output:

299348 225578 286701 388703 273711 466172 478011 490391 462013 126494 92677 182472 13812 107732 303666 361862 256289 91025 389690 156797 268792 434419 208299 409874 319842 64913 385537 136511 498213 255392 208598 45196 97386 482069 290480 370649 225780 380585 84550 485237 301855 494683 414740 107270...

result:

ok good job!

Test #14:

score: 0
Accepted
time: 1359ms
memory: 133136kb

input:

500000 50267 100532 100000
68723
142685
445548
215087
478634
201362
177405
373123
227456
161487
276716
452818
230715
466238
250886
368974
77152
493722
129115
154402
319190
170867
27898
338290
170229
428001
62611
19188
164329
435154
128
358453
137653
430592
160391
407392
125236
320137
27945
393135
17...

output:

180276 246334 495583 402629 160081 135829 437502 411046 380530 139431 365266 373213 304147 83868 82333 429663 60973 379653 172399 163454 32708 375362 151036 335442 305087 243402 252686 172089 94334 222818 22129 288097 54119 315516 305714 257805 486465 169334 213035 447566 446068 161042 183900 97933 ...

result:

ok good job!

Test #15:

score: 0
Accepted
time: 1196ms
memory: 94184kb

input:

500000 67604 135206 100000
269046
235003
144646
314602
323547
204450
484229
26672
78499
602
110738
117079
125630
408912
188317
256853
71590
365703
370008
194267
342683
400737
369194
127912
96314
269751
219125
431887
398790
200053
279314
365797
187505
75025
48264
492515
387506
13267
80948
378737
1106...

output:

76341 472454 272918 153908 174102 496654 498003 66778 17882 451185 496223 110417 219207 73845 302082 257757 249649 327852 156137 285688 306191 395185 287586 401922 349427 497462 444065 273435 389455 288939 226820 464589 383976 117970 195620 377862 80808 225041 251222 226976 13094 76271 312015 318601...

result:

ok good job!

Test #16:

score: 0
Accepted
time: 1223ms
memory: 96516kb

input:

500000 90109 180216 100000
153893
273609
184853
157428
466683
457867
343783
259618
87262
260826
466902
41972
482221
496695
293976
300490
455874
320279
314574
128316
280220
2566
383716
351629
219577
29212
26631
73182
458601
318651
105942
60715
392339
265615
387177
110713
319395
336826
483543
70790
36...

output:

438284 230909 310592 123189 326897 356782 273195 447510 102696 386259 36045 205818 491250 456198 4908 302959 389141 55228 227504 361513 485321 428172 349106 343580 299988 184924 186743 417730 433797 47647 96615 368962 477606 492115 133399 17645 155416 267858 129021 348459 400522 126230 337134 221870...

result:

ok good job!

Test #17:

score: 0
Accepted
time: 1127ms
memory: 94884kb

input:

500000 74321 148640 100000
477030
412534
57969
357009
116485
327483
437765
67781
471780
418080
308252
138279
338053
95055
275789
97204
386829
122048
57181
436136
222481
395950
352928
73438
250800
184259
16097
398913
456107
105407
39764
116186
80552
65160
316601
284871
313136
414498
414938
343247
310...

output:

169468 324879 43342 497375 466883 196060 313097 318536 82502 63398 109572 64084 435207 426318 152241 200689 46737 402911 134787 394761 445424 358411 320027 18885 7406 68297 175617 408003 93991 89006 167490 20164 386810 175675 452348 449156 271858 70777 355286 123033 486206 161191 488677 357122 10615...

result:

ok good job!

Test #18:

score: 0
Accepted
time: 1244ms
memory: 102248kb

input:

500000 54262 108522 100000
150680
169780
208423
114492
398775
47217
58682
258733
452080
54148
451364
196867
75350
134397
51280
339529
475503
166592
224426
358444
423175
366761
49422
400504
398619
18773
429051
59685
291626
145365
261042
445752
234123
21931
318295
94503
388014
414710
346782
466751
205...

output:

162530 156560 48857 103595 402625 421334 489622 45626 170651 379880 13770 364744 422537 383178 370244 98841 19494 221196 307456 379420 346799 299978 380581 416015 367460 337175 205933 71206 192247 302410 450663 234890 38354 60399 160799 428730 429267 439917 93033 275450 59816 312830 16038 228684 432...

result:

ok good job!

Test #19:

score: 0
Accepted
time: 1336ms
memory: 104348kb

input:

500000 81364 162726 100000
321857
75911
117294
148668
322025
103777
419430
187082
374875
230927
338513
433399
305556
363405
457801
70917
297078
386374
322110
76493
189187
21851
453679
296595
389232
386129
310835
432013
450769
74142
284176
90713
430145
142503
212302
384600
157386
490862
201498
415387...

output:

499141 30061 18728 380934 39564 45182 385001 175629 49348 60210 278392 441460 146084 157753 149930 379265 207015 54194 370393 48684 92026 66584 116646 104633 381923 50435 303049 250828 299384 24660 187310 482703 213165 283694 163253 300670 102549 139571 392732 488558 11355 369264 195243 163743 43025...

result:

ok good job!

Test #20:

score: 0
Accepted
time: 1290ms
memory: 104636kb

input:

500000 84343 168684 100000
92159
3025
19095
171545
269452
230103
428411
105653
130154
107687
352956
242321
444883
277419
59579
326919
4318
292812
326242
108917
253600
261383
320680
353469
283662
437811
470379
170617
46289
454830
253014
4165
381169
328908
493243
143442
265851
59330
347945
264421
2460...

output:

384672 307256 108948 376886 479100 352235 201834 282516 361836 335244 442222 77841 315038 194455 258517 44417 168666 355888 461300 413781 106122 478726 73393 482483 459139 275508 409223 392929 178395 59951 394532 469128 485595 253069 230069 288948 394047 474819 337639 358660 411824 23639 110566 9239...

result:

ok good job!

Test #21:

score: 0
Accepted
time: 1257ms
memory: 102680kb

input:

500000 88757 177512 100000
445069
77200
391318
333565
435416
362966
141662
45522
355791
256039
214614
450379
170016
467327
282215
243533
183175
463770
163579
461662
317411
261187
253905
468654
231023
3749
90566
45210
343865
165800
136852
383910
367984
413623
325053
41177
298566
351228
15540
262375
2...

output:

140447 409997 42225 120130 54655 418267 125642 403319 3065 21489 239664 146351 339287 71184 387781 409854 107938 181199 111519 426203 252874 394558 254574 496844 252810 271630 241856 71385 190957 132556 271026 298964 10062 95042 350074 157983 446645 25500 479195 391914 86414 279425 79627 247267 3497...

result:

ok good job!

Test #22:

score: 0
Accepted
time: 1359ms
memory: 103684kb

input:

500000 96344 192686 100000
195205
422258
407338
9779
476600
35329
336839
237680
366318
378932
386654
353800
118734
312717
156858
133692
72221
189109
391324
145763
38629
330117
404936
68820
255606
431020
392503
176884
178395
275064
488090
130311
314587
217628
462496
28966
425413
116762
437176
468713
...

output:

421581 306819 123777 33887 434995 411410 389551 449012 251450 472251 232767 360863 199389 174638 69812 39057 442842 200759 342672 189885 93090 329763 420426 81337 371158 484858 334922 154400 117156 380401 333488 85333 26173 141574 155006 386800 124154 429688 434318 214336 345792 209706 59183 486015 ...

result:

ok good job!

Test #23:

score: 0
Accepted
time: 1313ms
memory: 100548kb

input:

500000 62967 125932 100000
228958
294130
161634
80333
361275
345422
393334
286611
311452
453264
275215
289266
452502
447517
458518
295775
420774
426985
410788
79249
309720
61573
250760
5587
481312
161015
303445
8961
463259
24340
331413
237498
488929
475822
425952
251105
487129
230062
368282
264038
1...

output:

241585 130251 30939 296624 164299 171199 135870 183580 60428 240171 334200 227074 130801 477207 223206 300243 482358 23745 300608 15679 124530 84486 381568 94341 272446 206755 315403 125866 325419 396175 476694 52100 208029 203761 315953 224524 110965 451123 82952 269860 361352 476404 482695 413102 ...

result:

ok good job!

Test #24:

score: 0
Accepted
time: 1360ms
memory: 103820kb

input:

500000 94830 189658 100000
104237
453576
334546
43320
88991
174623
80118
405142
341990
225030
164655
136865
106241
208562
67332
289772
379828
245569
190369
136859
196296
376390
298773
202031
129266
220643
477229
76909
267607
412545
178338
100575
280161
390719
280691
294766
490870
175723
312546
47683...

output:

344584 459624 172197 332130 317144 15121 367501 445987 26112 43380 420293 448803 317604 345462 468336 437503 384153 210484 441188 99853 386646 395465 69861 119006 351563 375221 442887 401988 388123 338097 347647 398545 413209 27608 284334 180083 151012 335581 349753 84570 269525 223765 460857 333260...

result:

ok good job!

Subtask #3:

score: 19
Accepted

Test #25:

score: 19
Accepted
time: 1257ms
memory: 131024kb

input:

500000 200 199 40000
76296
130139
291501
292412
139543
433345
372726
451574
18315
465578
324564
477223
237354
81532
65170
465332
342130
9670
193303
193680
129668
149532
268907
89969
398275
356210
324593
433492
482232
466692
135343
433758
102545
287283
432859
351864
305769
489532
101532
450535
295762...

output:

12225 329473 124294 112780 478338 445039 249189 32330 65783 179054 497476 452979 319006 30813 48206 427935 466790 486377 109196 200837 164218 45188 487722 282259 229713 367076 188057 187010 232559 151913 348461 116954 20242 322713 185020 157495 443679 326708 325415 391214 266949 457474 3735 299220 2...

result:

ok good job!

Test #26:

score: 0
Accepted
time: 1182ms
memory: 130904kb

input:

500000 200 199 40000
83785
150667
304961
267635
97760
385201
77226
6522
352645
72592
427133
30755
100574
359648
403948
394809
425453
115868
11287
351385
494434
245106
58157
395180
326236
277135
359592
13569
76251
45366
172378
122783
216597
466130
284420
342613
471698
380682
92490
79264
241049
54038
...

output:

455890 309275 63656 335800 292806 9763 489623 63346 86191 446791 183068 362736 197911 107095 211424 101597 145440 202553 8696 425553 151090 60540 369501 412878 462364 222 148686 133609 158102 107714 270626 112101 244973 133381 421561 462192 28928 193698 101629 183699 205161 304190 364442 409432 4207...

result:

ok good job!

Test #27:

score: 0
Accepted
time: 823ms
memory: 91564kb

input:

500000 200 199 40000
94863
498513
460682
411416
360517
309831
253717
325019
496632
255803
130770
289206
181204
74729
481723
293737
94126
307214
342974
448321
17084
433126
387809
279606
251781
65795
125269
129465
433572
219622
11806
179248
367117
84640
114067
122590
4140
116015
77759
392439
408930
10...

output:

343625 280120 477003 404323 253769 286122 372684 224921 251549 407169 175798 165077 316824 214939 265132 435414 38524 28833 313318 142356 35769 391557 40145 209089 240998 423277 74048 175122 38573 307415 270672 476929 479167 40727 442992 455204 30220 128707 135238 428369 408160 367224 463237 19326 1...

result:

ok good job!

Test #28:

score: 0
Accepted
time: 885ms
memory: 89720kb

input:

500000 200 199 40000
460896
356428
214577
150748
16877
1635
258267
370689
262538
369939
466845
415822
304104
329494
6035
489031
48344
181107
61121
4048
156120
273134
234110
418870
101454
330401
45460
74853
175589
44170
192108
214802
482345
120910
76381
307448
204387
170471
187255
20694
494550
351800...

output:

495416 316808 29345 341272 110132 277921 201248 468517 199799 33465 362070 486160 467219 153052 278055 385797 466561 382809 136456 68995 182398 366136 11741 99645 227228 440553 189947 434778 35934 26846 253871 264929 353095 308168 73797 108679 454310 268791 439876 424117 135661 268641 114874 197457 ...

result:

ok good job!

Test #29:

score: 0
Accepted
time: 863ms
memory: 89908kb

input:

500000 200 199 40000
472275
149661
377034
488618
186507
171592
345983
124571
76807
5855
300138
80553
340257
185587
378146
311401
334561
194922
182638
104826
420776
448537
393232
195734
347470
219413
82586
185915
58528
404731
329285
300479
342445
115864
230618
360114
281628
86760
203158
212935
376440...

output:

325240 161239 362871 106571 112786 299387 64780 319007 310403 49056 86987 355985 145693 447782 160424 430710 356081 176269 264055 197733 194558 368239 126996 65180 404982 221053 165803 121863 287629 208497 379978 343962 65325 340616 213566 240157 222656 72441 392581 33367 488917 319967 412827 352097...

result:

ok good job!

Test #30:

score: 0
Accepted
time: 1007ms
memory: 101444kb

input:

500000 200 199 40000
457235
436089
312892
490957
247950
207946
50653
437012
325088
141386
319878
207087
398253
383132
11996
402164
409233
443227
294400
242006
327126
10129
244769
232885
165818
291514
332036
352883
406737
63191
380159
208131
327008
61194
18237
223687
413010
160943
426911
162568
18875...

output:

280018 464515 385839 288089 422572 324681 343344 131115 302345 471908 335318 12323 436271 338102 94095 273141 399174 398381 282732 178662 265591 341215 368057 367193 449256 291204 248083 237315 115359 130574 253935 171959 233562 357232 404170 95434 288257 7330 494304 379130 125707 15907 238090 26543...

result:

ok good job!

Test #31:

score: 0
Accepted
time: 955ms
memory: 101596kb

input:

500000 200 199 40000
498222
451076
484997
74171
344510
119552
181399
378715
468521
103237
143923
10760
103036
353626
331913
232159
181090
14984
85005
467731
200014
74750
304897
488094
80862
428792
303440
325833
70112
301252
111208
109820
23216
97480
361786
424164
357979
22040
249278
329701
472798
13...

output:

440095 397399 276419 262919 363405 66381 64749 171779 202564 472619 71655 404133 325652 479126 241825 38225 227567 460324 136855 338308 160052 27854 164425 265076 415706 162619 104270 218019 195482 242991 383106 111690 225588 47890 191160 46831 257752 89956 450735 28020 290575 447732 441105 13467 12...

result:

ok good job!

Test #32:

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

input:

500000 200 199 40000
235229
335906
185851
155252
476682
68595
44502
499901
403010
120212
365527
365904
165512
445297
44401
416812
282314
301556
484290
469265
250037
184042
387456
226812
371932
410610
263086
279108
442354
371814
37100
77190
202799
118817
250469
478086
307786
11617
132836
304380
25170...

output:

39341 361970 209197 240655 312104 497662 306267 234899 454301 166568 369615 341600 427091 464630 305703 333664 166733 485551 414027 424709 77165 294845 120530 474057 180360 415023 433385 277783 420741 79102 250427 348991 257112 167129 404621 164955 345805 322894 470005 205861 215704 415641 56900 256...

result:

ok good job!

Test #33:

score: 0
Accepted
time: 919ms
memory: 99412kb

input:

500000 200 199 40000
27113
326978
70968
474916
390195
217639
467929
292659
58323
454399
169213
185253
114409
287912
251420
281315
94695
326310
237316
424237
79688
285918
43312
65978
450176
255930
425562
242907
198847
77977
135410
122795
349710
416624
428899
314932
135513
464911
286182
28508
268649
1...

output:

144381 404382 397249 200252 301986 315557 10659 298766 407014 23883 141753 186455 401545 241632 363001 337049 352945 276602 151656 388894 212804 223484 302895 156418 449218 51799 342728 439773 89701 429813 311163 129365 2770 133486 100174 347093 355004 302048 350945 458326 483775 377801 225095 38589...

result:

ok good job!

Test #34:

score: 0
Accepted
time: 869ms
memory: 99176kb

input:

500000 200 199 40000
158367
3349
98725
462635
71709
384166
328253
132679
334131
433401
352051
9045
188775
366068
218093
90403
193264
359869
432442
263881
154277
470908
470355
200679
36628
399310
359036
163322
404722
42891
12614
147023
421373
479199
71619
182994
443724
120532
217367
134309
221302
310...

output:

124479 104300 275139 19313 256445 58235 233556 458816 200053 17982 211448 334718 195068 348327 377885 350465 258598 417380 461451 151644 101022 40938 184763 475690 359291 47455 476876 338740 490312 200178 360395 282144 320722 408424 295895 50662 328702 179295 239904 184569 383306 494660 9341 372889 ...

result:

ok good job!

Test #35:

score: 0
Accepted
time: 879ms
memory: 99356kb

input:

500000 200 199 40000
487441
36354
395955
6882
385179
368092
7896
377902
329818
287628
224290
27427
439352
326593
43030
180557
361665
163
8128
233496
22632
367138
126510
64436
351877
190302
145137
17783
209795
411209
255585
72497
161599
407307
216969
128706
67358
261184
268088
304573
63115
386332
827...

output:

260785 262432 483321 190094 252661 31459 351912 301903 485685 182006 444034 191387 418741 167449 298251 309400 38107 482776 75759 100899 46664 443717 72101 465926 415606 304574 5761 391057 168470 472802 465898 464217 185726 215877 93759 243595 308652 96942 228826 308515 176259 104502 97965 79483 205...

result:

ok good job!

Test #36:

score: 0
Accepted
time: 885ms
memory: 99232kb

input:

500000 200 199 40000
234051
59729
19849
414190
183195
238559
189881
256369
97803
379735
363604
391055
490274
186114
46653
230044
14075
437112
279313
141334
478372
146753
310018
305921
464449
475813
132149
290804
21707
51493
249658
15019
151386
494305
468781
444714
318658
179510
283604
351846
110675
...

output:

233322 335435 397058 232566 228268 45068 466024 304657 273657 238514 47945 210034 492937 77308 145344 268723 31343 139282 96199 176973 463877 277942 193850 82386 144915 33996 294491 322014 64241 361656 368057 37855 110210 293237 51214 239156 172096 6941 135535 207420 199079 229313 23801 444932 13785...

result:

ok good job!

Subtask #4:

score: 22
Accepted

Test #37:

score: 22
Accepted
time: 2852ms
memory: 258664kb

input:

1000000 1000 999 100000
678746
439069
32542
85937
936926
284219
461661
203235
533462
940676
230275
621140
780674
254931
562355
229273
201341
493976
358955
963527
880412
91220
474599
160086
698841
591551
718276
844558
39859
765917
34722
401724
219774
443004
682244
545401
968419
968020
354030
411187
1...

output:

927453 737189 653885 840772 346403 780854 103601 49131 439139 486132 820231 177271 826206 982104 499097 409243 194435 293457 172618 662161 236859 473531 81188 533335 712368 462084 777243 239386 911529 829354 62098 492333 390487 523069 358162 163042 451543 653539 717744 885154 584533 11086 661366 952...

result:

ok good job!

Test #38:

score: 0
Accepted
time: 2700ms
memory: 258708kb

input:

1000000 1000 999 100000
530144
36744
762893
712555
181981
816257
634992
419372
362279
817260
80801
697008
163211
900947
207310
862766
871091
388529
304808
574011
609949
509094
682125
781230
431445
517909
578411
288003
874415
410542
327673
607230
278208
956997
60166
842448
708661
562761
996349
382922...

output:

70930 162711 104847 600658 547594 219142 447597 811056 140247 502224 659605 421892 389493 152949 636421 692108 137214 372169 804489 399568 586198 152111 43257 899797 878142 278025 996438 364577 750352 580921 589621 139136 802259 100210 987920 563289 985356 224651 422771 630597 972354 915562 97459 56...

result:

ok good job!

Test #39:

score: 0
Accepted
time: 2107ms
memory: 176416kb

input:

1000000 1000 999 100000
184414
849676
938006
927343
390133
327580
229110
507237
712311
8816
414520
114671
637641
82050
586607
523821
775429
139792
129360
175687
202474
801377
53523
281419
268534
488983
371227
294280
754555
448802
474939
391153
68307
762784
972243
245396
471656
982894
891252
945526
5...

output:

57218 699115 546443 260107 310090 904396 365156 920606 401816 859617 693213 728316 959331 24411 197456 405907 572639 547582 109311 396380 405880 242018 671117 956950 811504 154461 551198 578818 853211 317916 336370 416899 821896 933005 860021 667833 592379 171579 803512 514708 415096 494934 757862 7...

result:

ok good job!

Test #40:

score: 0
Accepted
time: 2117ms
memory: 176280kb

input:

1000000 1000 999 100000
279950
249721
597292
449885
16559
173928
771422
461514
392390
935006
401814
270115
877076
38286
665465
238399
632929
179581
685305
910549
211998
608701
352060
872741
888320
701449
144650
551823
899287
53420
994085
608934
941044
730655
818001
379877
176374
592364
165476
704855...

output:

486320 422305 846542 282610 681955 284177 867450 823875 651130 885871 616108 606062 836694 95106 294284 926803 672446 720717 873724 610837 202042 918192 936090 680196 994485 356034 144131 915012 633657 611747 506177 459773 154048 517831 550369 298090 155752 276205 342165 482636 300483 868578 157426 ...

result:

ok good job!

Test #41:

score: 0
Accepted
time: 1984ms
memory: 180220kb

input:

1000000 1000 999 100000
20291
14699
561360
480484
286821
851537
642046
340254
362763
85475
567413
791788
145352
893579
253840
568256
281056
600506
834619
722257
570033
739505
158527
142792
475867
834583
85573
692242
107763
238427
749609
945275
238413
468714
75532
903433
452471
189579
134021
196949
2...

output:

408415 608333 884789 48017 508860 707268 726223 922089 98733 945271 355018 710086 148539 601304 970800 295246 1990 27499 542681 185132 188065 501765 500148 452324 926693 562308 341004 765333 137204 189629 945539 451110 971120 651586 516394 637836 116076 514268 108640 497330 444618 102021 900016 1627...

result:

ok good job!

Test #42:

score: 0
Accepted
time: 2327ms
memory: 203580kb

input:

1000000 1000 999 100000
79586
680985
105418
485822
250996
367398
927624
781485
911744
133593
352104
588258
914821
421528
538901
315958
275633
856427
5509
935195
913751
92920
619111
848814
663965
45219
344279
165968
865619
154854
900710
774023
872807
340764
497215
631438
911663
879056
918477
890010
3...

output:

746532 353160 736674 224629 806197 961301 318576 886092 225601 229664 519118 658492 233912 52363 570874 244780 84008 61253 198150 354421 6613 252538 417978 417631 482372 346487 625728 378883 546800 602562 649320 152120 357069 866709 632702 6081 550198 419634 405757 511597 509719 909131 88359 664733 ...

result:

ok good job!

Test #43:

score: 0
Accepted
time: 2376ms
memory: 199492kb

input:

1000000 1000 999 100000
864268
381722
137834
585983
418961
493735
111546
74594
3531
508504
383125
609419
708077
928352
762197
141167
174341
418962
107812
631708
84967
770802
568509
276991
376328
909246
85244
453348
203444
298108
478742
824330
149959
297025
840543
296938
691263
894733
491791
319919
8...

output:

679669 79234 828674 328601 100623 486686 894194 409360 592343 78773 810275 811846 44434 99142 468660 800075 854479 436946 709282 125362 253964 925146 434688 318278 334142 355277 818225 524339 940461 45280 341606 924497 639148 833544 459401 163359 963938 807812 376124 679979 505263 27992 388458 41154...

result:

ok good job!

Test #44:

score: 0
Accepted
time: 2319ms
memory: 199436kb

input:

1000000 1000 999 100000
845169
885017
493118
865999
3330
999692
653381
608408
419452
799529
98306
295418
755923
442503
85146
52116
980435
452773
633069
998249
788034
527181
418057
380217
158464
23015
364569
275325
675030
381121
889352
891866
203541
14657
69958
428476
4927
853670
908949
664221
936648...

output:

144027 442434 476465 247487 368163 294928 554926 725764 882329 716564 218405 531171 314424 129480 736273 297575 129794 861073 539839 304398 475064 620933 139893 241201 945397 548332 41977 599409 23291 765122 236242 946112 826377 90569 282196 991950 805038 72367 304316 453114 542662 357110 693047 124...

result:

ok good job!

Test #45:

score: 0
Accepted
time: 2149ms
memory: 195332kb

input:

1000000 1000 999 100000
582602
618937
427880
217239
896256
608317
42018
91716
145269
277504
94008
601157
503365
892936
294525
477654
286441
721652
14541
805171
315688
615193
950960
232416
430226
299443
690527
317106
303199
277200
283069
268869
650167
725195
788623
817992
647261
671722
426903
453937
...

output:

607360 601711 97216 895725 195309 78747 781468 303289 870153 2618 70555 641783 209437 836106 123315 954399 887956 439052 258185 307524 249328 751041 201118 964653 755108 363879 183353 316577 711238 352689 620353 616747 668903 830769 479091 437126 368915 670219 351899 565447 231763 323831 390423 1856...

result:

ok good job!

Test #46:

score: 0
Accepted
time: 2199ms
memory: 195620kb

input:

1000000 1000 999 100000
761086
125560
807519
496861
197173
671162
286468
361527
420830
337089
99902
928320
527383
162932
540385
255275
952224
668471
897966
186547
575192
315130
399856
441499
876295
462690
556218
167574
711101
146911
914260
296451
432034
722939
27102
687771
200204
636114
525983
59197...

output:

386004 336380 984156 236686 619775 662718 374344 746913 250727 974358 238460 435334 309432 572041 697612 439427 605523 477927 796474 396489 395795 880926 804277 432345 656307 17225 759286 683317 198289 884634 808824 979645 287733 473468 417654 658405 796879 22954 391082 688897 2784 549687 59629 4834...

result:

ok good job!

Test #47:

score: 0
Accepted
time: 2173ms
memory: 195340kb

input:

1000000 1000 999 100000
700422
705984
742655
297368
991331
273447
971924
235042
288410
226105
751213
71757
552545
234328
777224
460184
747354
483278
77275
960232
145343
677496
979573
598317
294693
762557
214101
155814
368037
345816
214266
272277
6667
461234
109578
330628
355557
16281
696921
633114
6...

output:

123170 267158 702425 81455 577977 539740 917266 950490 598245 762562 652056 760731 523052 576445 884079 437143 848712 156639 832273 932423 993279 540810 42692 259082 796910 40699 363173 72694 133649 597707 483745 813815 23144 133177 425889 507255 595934 3087 536005 851827 526244 550527 822352 805847...

result:

ok good job!

Test #48:

score: 0
Accepted
time: 2172ms
memory: 195644kb

input:

1000000 1000 999 100000
294979
912636
954626
984835
432393
676651
323592
496950
442003
287176
988897
310588
517194
868410
42913
165122
231552
13998
103334
502710
396538
590023
630061
530055
980426
628250
446184
451072
276133
424200
328584
26687
392134
766381
197139
174221
564083
149136
481705
457343...

output:

861412 888566 783619 634266 721067 23225 622310 317294 913687 272627 75643 470344 894726 355461 652570 973192 889578 559151 607583 970503 945108 550797 404733 467780 12635 322430 592678 369958 763108 966950 234090 37456 183205 20659 742346 556671 394341 409126 191798 931757 791129 197856 486413 5146...

result:

ok good job!

Subtask #5:

score: 24
Accepted

Test #49:

score: 24
Accepted
time: 2902ms
memory: 261748kb

input:

1000000 91074 91073 100000
844855
360256
604500
520288
3402
603913
199722
732526
574997
429775
182518
190073
386932
693624
254661
333433
557929
350362
247817
201441
960948
519977
461212
493412
852908
455639
732827
432452
320916
223796
413293
969300
617038
438432
2369
51283
908991
374139
410798
19612...

output:

104349 170744 322298 943785 796710 500874 79937 976772 191057 27689 906009 603418 442795 561154 796064 292228 504787 249824 525843 435036 271618 183442 461251 6332 765553 582250 226179 860734 445334 729051 457570 772087 147634 119269 85940 899087 838934 714547 249430 419834 488759 535606 70064 74100...

result:

ok good job!

Test #50:

score: 0
Accepted
time: 2892ms
memory: 261344kb

input:

1000000 85406 85405 100000
243967
952129
483179
427670
241063
673465
936850
819488
932267
432087
168570
75516
427761
708350
579841
56944
327580
291932
619630
977053
424711
862203
360360
723933
64552
550800
399697
549936
425473
413499
431310
248361
149311
199196
247552
227202
676100
694069
347994
988...

output:

600691 665700 394186 920033 67110 282228 422563 424839 65617 886450 197532 463926 711771 581926 743376 860065 363944 619369 548813 448810 333494 514122 109376 269392 289634 194364 244306 322851 208595 223144 694693 3079 572346 25709 765912 66723 337394 544324 945673 108504 78758 851948 167958 84801 ...

result:

ok good job!

Test #51:

score: 0
Accepted
time: 2337ms
memory: 180328kb

input:

1000000 62028 62027 100000
354774
944572
228278
449941
359325
57969
43031
616490
898916
61312
768136
892022
42765
227563
373737
241400
671641
155600
137082
803792
95473
30579
438130
496747
204238
57940
100124
47370
141803
745731
687568
952816
518284
677981
803613
28392
918299
517226
69867
69501
8590...

output:

680102 509069 371414 425300 485364 937441 256555 922148 480575 109849 990045 608402 355237 805028 890250 719517 514592 501948 112901 542839 291828 649742 172374 88805 697984 590282 654824 177465 873997 766414 844714 726897 965474 226169 488953 827881 220672 262083 885118 768491 753586 298416 533104 ...

result:

ok good job!

Test #52:

score: 0
Accepted
time: 2429ms
memory: 180492kb

input:

1000000 97415 97414 100000
453981
477203
689925
857434
241949
91494
993077
34954
605245
874902
893112
881129
576016
404784
870963
602740
1572
569897
624684
792962
189914
558522
191463
49120
326617
360379
162970
903046
277880
985508
419832
756246
978897
958038
74713
370260
67182
710992
829080
535448
...

output:

814592 794137 932783 311207 539900 919466 62200 865286 161441 435459 707681 228513 556233 269452 987825 347810 547292 755295 198296 887069 584504 726461 283275 997002 394282 282895 763002 979463 212872 517143 656578 719702 197245 714362 90150 994142 59188 120628 385160 417089 116130 320184 792581 75...

result:

ok good job!

Test #53:

score: 0
Accepted
time: 2256ms
memory: 180168kb

input:

1000000 54975 54974 100000
96952
319199
205229
785476
392425
909864
205985
81504
109636
164519
589106
373513
308062
898520
41603
88922
939415
189814
67267
237546
983306
247777
949797
339161
315551
248540
137128
344060
336465
199815
730843
44931
403415
657739
689755
660391
67077
940902
804294
104482
...

output:

223287 644192 754275 159661 517810 65753 910619 380713 820288 27363 631683 19999 908645 2419 64888 546539 829655 552213 451086 134534 160034 27575 830398 60803 695797 500387 144821 167558 865947 287891 542565 310443 707968 365812 55727 431108 734917 864313 209134 627737 961623 96869 678071 27910 585...

result:

ok good job!

Test #54:

score: 0
Accepted
time: 2651ms
memory: 199544kb

input:

1000000 93603 93602 100000
590581
384770
986471
380567
941542
676443
800265
713198
618948
485196
793122
992449
102071
504074
882555
246256
810300
783699
191498
938198
981235
862324
82689
856318
830003
553359
194501
448504
13262
81426
659762
358904
334920
884736
624654
360241
520224
491932
756589
684...

output:

206872 765529 873828 564386 548575 902206 604617 72129 974201 674578 522475 211545 57457 940023 322844 105808 371435 316421 267107 951928 338697 629517 271539 743867 305828 318367 762372 839599 737149 679422 317592 545314 828546 840267 449029 673958 35150 459645 95995 851377 742409 994991 478542 665...

result:

ok good job!

Test #55:

score: 0
Accepted
time: 2464ms
memory: 199516kb

input:

1000000 56476 56475 100000
321806
617064
56801
469913
349501
226853
982685
953768
950260
773865
850920
494648
347845
472357
967459
307312
410773
669459
406948
398239
680315
58721
209614
422608
265050
904778
804303
548987
718504
941419
213137
647451
595973
781907
716699
248913
465529
100816
289739
43...

output:

8278 866997 712099 871954 809059 234549 18938 313156 167741 306044 357119 59626 727910 104572 285611 400508 723800 346888 822006 558486 340198 608043 108711 491289 497911 6576 526678 353152 230721 339580 955376 35456 92628 619710 782188 654187 535719 71340 349962 523268 185732 849807 22332 327776 39...

result:

ok good job!

Test #56:

score: 0
Accepted
time: 2605ms
memory: 199584kb

input:

1000000 77761 77760 100000
102141
89521
32208
995357
946428
638388
994079
200096
759506
415117
989818
157285
145299
619468
947456
343707
49714
479293
934090
399241
209616
459583
232400
34280
269169
429394
513182
447184
603
473746
92149
723284
310077
518197
800474
506674
796719
151664
380675
374791
4...

output:

623411 631501 583671 838619 4616 968045 624464 821942 665693 402808 431305 813168 645740 59664 429668 113694 521182 420262 606259 443772 695302 977089 638197 144454 49853 509307 71931 214358 411887 142468 719064 584731 557227 517183 21454 220112 170225 991942 90669 440333 825109 7223 523172 461173 5...

result:

ok good job!

Test #57:

score: 0
Accepted
time: 2408ms
memory: 195320kb

input:

1000000 74966 74965 100000
683534
239091
842267
16017
468005
568280
573610
693011
161069
706082
795227
151601
934006
479774
513858
109101
851525
331377
875016
70381
299813
706417
753015
505672
720335
650876
915187
738727
132896
784656
425639
867644
376143
733308
245383
783527
550113
526907
856694
48...

output:

442790 618805 984594 193618 805423 857737 318276 528125 149807 346 852252 639620 764093 247663 746019 13486 879842 481646 197579 867132 790487 40371 597776 30533 303504 998491 928979 427853 819486 290888 746549 929991 26399 597799 160959 617558 304445 887010 369725 399789 221266 239271 187358 592569...

result:

ok good job!

Test #58:

score: 0
Accepted
time: 2418ms
memory: 195304kb

input:

1000000 65730 65729 100000
389535
782666
938044
721678
849220
701060
181030
52406
234247
790969
174777
437888
55263
195566
435426
928800
69026
168462
766751
672961
454375
175149
710125
383627
736135
711434
433482
836973
541367
953192
986804
693441
444489
287176
517890
131648
879596
119420
264712
351...

output:

300264 967146 436648 981132 788619 604448 263889 316316 66975 672607 33759 603530 537028 604666 4479 118561 422689 125352 502473 23847 334050 71294 670928 74228 734467 257702 828628 993206 855537 991076 273040 889753 301316 196684 323820 370982 236772 12518 658768 351375 451814 894364 9773 603252 43...

result:

ok good job!

Test #59:

score: 0
Accepted
time: 2399ms
memory: 195212kb

input:

1000000 65817 65816 100000
51488
844164
68841
411983
904138
407472
718044
583532
651150
806564
830599
283691
887913
521795
183797
959816
140200
768090
936924
842275
478523
522794
333465
184430
825549
711686
617264
901453
971141
487698
621032
169621
843824
122780
528194
237041
140546
980298
46138
984...

output:

857632 188608 362994 948179 859469 169852 486700 649412 675722 197544 520622 566029 633528 553937 706889 103149 569478 12383 865348 827933 298757 598499 782077 541829 654836 628930 880757 77967 513272 339513 374610 71268 897480 304007 67685 563578 96827 548189 941127 550553 612010 254295 64164 65232...

result:

ok good job!

Test #60:

score: 0
Accepted
time: 2519ms
memory: 195540kb

input:

1000000 84524 84523 100000
518841
510059
160070
674927
130615
180721
695363
700479
501744
933738
820766
543469
600830
488190
995734
515877
169413
488120
455582
27902
410480
323699
99289
522373
351735
903291
250384
153
678098
186046
396071
639296
608479
651025
672719
494101
85372
331436
954731
79292
...

output:

526667 697629 187941 79547 472865 605885 455114 663827 820699 813916 904041 629948 334035 135983 704816 377641 616201 237092 466963 109388 198062 9509 364330 580393 858941 877513 110117 235786 551126 83098 819917 517156 254924 327436 359354 125841 931999 480967 672062 683142 142324 392443 677837 167...

result:

ok good job!

Extra Test:

score: 0
Extra Test Passed