QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#785794#4401. Prizeliuziao100 ✓1721ms411556kbC++233.7kb2024-11-26 19:14:022024-11-26 19:14:08

Judging History

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

  • [2024-11-26 19:14:08]
  • 评测
  • 测评结果:100
  • 用时:1721ms
  • 内存:411556kb
  • [2024-11-26 19:14:02]
  • 提交

answer

#include <bits/stdc++.h>

// #define int int64_t

const int kMaxN = 1e6 + 5;

int n, k, q, t, rt1, rt2;
int p1[kMaxN], p2[kMaxN], dfn1[kMaxN], dfn2[kMaxN], idx1[kMaxN], idx2[kMaxN];
int lg[kMaxN], st1[kMaxN][20], st2[kMaxN][20], id[kMaxN];
int dis1[kMaxN], dis2[kMaxN];
std::vector<int> G1[kMaxN], G2[kMaxN];
std::vector<std::pair<int, int>> T1[kMaxN], T2[kMaxN];

int get(int *dfn, int x, int y) { return dfn[x] < dfn[y] ? x : y; }

void dfs1(int u, int fa) {
  static int cnt = 0;
  st1[dfn1[u] = ++cnt][0] = fa, idx1[cnt] = u;
  for (auto v : G1[u]) {
    if (v == fa) continue;
    dfs1(v, u);
  }
}

void dfs2(int u, int fa) {
  static int cnt = 0;
  st2[dfn2[u] = ++cnt][0] = fa, idx2[cnt] = u;
  for (auto v : G2[u]) {
    if (v == fa) continue;
    dfs2(v, u);
  }
}

int LCA1(int x, int y) {
  if (x == y) return x;
  if (dfn1[x] > dfn1[y]) std::swap(x, y);
  int k = lg[dfn1[y] - dfn1[x]];
  return get(dfn1, st1[dfn1[x] + 1][k], st1[dfn1[y] - (1 << k) + 1][k]);
}

int LCA2(int x, int y) {
  if (x == y) return x;
  if (dfn2[x] > dfn2[y]) std::swap(x, y);
  int k = lg[dfn2[y] - dfn2[x]];
  return get(dfn2, st2[dfn2[x] + 1][k], st2[dfn2[y] - (1 << k) + 1][k]);
}

void dfs3(int u) {
  static bool vis[kMaxN] = {0};
  vis[u] = 1;
  for (auto [v, w] : T1[u]) {
    if (vis[v]) continue;
    dis1[v] = dis1[u] + w;
    dfs3(v);
  }
}

void dfs4(int u) {
  static bool vis[kMaxN] = {0};
  vis[u] = 1;
  for (auto [v, w] : T2[u]) {
    if (vis[v]) continue;
    dis2[v] = dis2[u] + w;
    dfs4(v);
  }
}

void prework() {
  dfs1(rt1, 0), dfs2(rt2, 0);
  lg[0] = -1;
  for (int i = 1; i <= n; ++i) lg[i] = lg[i >> 1] + 1;
  for (int i = 1; i <= lg[n]; ++i) {
    for (int j = 1; j <= n - (1 << i) + 1; ++j) {
      st1[j][i] = get(dfn1, st1[j][i - 1], st1[j + (1 << (i - 1))][i - 1]);
      st2[j][i] = get(dfn2, st2[j][i - 1], st2[j + (1 << (i - 1))][i - 1]);
    }
  }
}

void dickdreamer() {
  std::cin >> n >> k >> q >> t;
  for (int i = 1; i <= n; ++i) {
    std::cin >> p1[i];
    if (~p1[i]) G1[p1[i]].emplace_back(i), G1[i].emplace_back(p1[i]);
    else rt1 = i;
  }
  for (int i = 1; i <= n; ++i) {
    std::cin >> p2[i];
    if (~p2[i]) G2[p2[i]].emplace_back(i), G2[i].emplace_back(p2[i]);
    else rt2 = i;
  }
  prework();
  for (int i = 1; i <= k; ++i) {
    id[i] = idx1[i];
    std::cout << id[i] << ' ';
  }
  std::cout << std::endl;
  std::sort(id + 1, id + 1 + k, [&] (int x, int y) { return dfn2[x] < dfn2[y]; });
  for (int i = 1; i < k; ++i)
    std::cout << "? " << id[i] << ' ' << id[i + 1] << '\n';
  std::cout << "!" << std::endl;
  for (int i = 1; i < k; ++i) {
    int x = id[i], y = id[i + 1], lca1 = LCA1(x, y), lca2 = LCA2(x, y);
    int d1, d2, d3, d4;
    std::cin >> d1 >> d2 >> d3 >> d4;
    T1[lca1].emplace_back(x, d1), T1[x].emplace_back(lca1, -d1);
    T1[lca1].emplace_back(y, d2), T1[y].emplace_back(lca1, -d2);
    T2[lca2].emplace_back(x, d3), T2[x].emplace_back(lca2, -d3);
    T2[lca2].emplace_back(y, d4), T2[y].emplace_back(lca2, -d4);
  }
  dfs3(id[1]), dfs4(id[1]);
  std::vector<std::pair<int, int>> res;
  for (int i = 1; i <= t; ++i) {
    int x, y;
    std::cin >> x >> y;
    int lca1 = LCA1(x, y), lca2 = LCA2(x, y);
    res.emplace_back(dis1[x] + dis1[y] - 2 * dis1[lca1], dis2[x] + dis2[y] - 2 * dis2[lca2]);
  }
  for (auto [x, y] : res) std::cout << x << ' ' << y << '\n';
}

int32_t main() {
#ifdef ORZXKR
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
  std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
  int T = 1;
  // std::cin >> T;
  while (T--) dickdreamer();
  // std::cerr << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 797ms
memory: 234508kb

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: 10
Accepted
time: 780ms
memory: 234340kb

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: 10
Accepted
time: 627ms
memory: 210264kb

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 146602 106115 32426 8390 3821 314935 201979 171459 413397 469146 119187 74265 167902 479051 182695 260054 235048 135315 280891 13044 240704 209304 211564 188960 481631 289686 273785 175837 385737 204887 288861 330677 315423 120726 278204 129910 396267 322633 472675 325914 329277 67326 391455 ...

result:

ok good job!

Test #4:

score: 10
Accepted
time: 633ms
memory: 211048kb

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 40773 30337 3831 195031 251118 21848 332855 402436 374839 357357 42119 382885 377328 13863 386544 201759 32946 323963 484564 215037 277370 472684 81309 484227 89315 381707 431727 439267 216824 485515 421976 411697 230680 43213 25204 68073 30255 143879 164080 135142 441489 282767 310382 1...

result:

ok good job!

Test #5:

score: 10
Accepted
time: 671ms
memory: 212376kb

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 4033 3297 46811 80464 284515 347374 116368 204675 12242 236061 42585 91081 312035 285728 234206 326918 231575 193431 385908 123360 219570 237308 488275 146973 278867 303046 17686 461933 83949 100486 65040 253090 278869 342370 141292 167787 205320 41653 29945 83893 40950 348576 412681 220300 26...

result:

ok good job!

Test #6:

score: 10
Accepted
time: 723ms
memory: 214196kb

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 26617 47747 209286 31977 243665 65697 394458 66936 330203 111706 400826 188117 490312 451749 377213 451432 482110 450513 372367 243217 17878 326862 79427 343913 203244 140881 256494 329204 164961 461047 338802 166743 393825 25540 420037 374407 50003 96053 427346 365280 191816 338726 463407 32...

result:

ok good job!

Test #7:

score: 10
Accepted
time: 691ms
memory: 215500kb

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 172713 204978 297105 474574 443479 326538 390969 34874 492305 157831 85371 217598 310810 104348 344506 18218 34919 284048 191391 375157 93215 437374 179027 95313 246201 105486 90705 261692 432138 60063 214041 101698 415529 126781 367122 27413 85730 36224 346513 104818 2238...

result:

ok good job!

Test #8:

score: 10
Accepted
time: 715ms
memory: 216584kb

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 92100 139432 131622 170991 324408 396138 18454 365411 494280 359470 62857 516 49116 212775 228269 406044 238351 73730 344036 164637 142035 62522 287306 191612 27113 107127 151520 273425 3029 266766 489355 250496 60335 369915 212496 230914 324800 64090 294847 116290 472262 346162 136322 249997...

result:

ok good job!

Test #9:

score: 10
Accepted
time: 629ms
memory: 212080kb

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 15990 60747 1844 173342 476686 180822 429820 298329 356039 58547 290254 180015 476506 20120 265956 172302 27153 59287 30817 110197 441521 428010 2003 112355 265905 198312 129358 442298 120472 138884 373998 58266 256425 7274 137614 43114 65060 393472 137647 293565 81701 495260 317778 230822 47...

result:

ok good job!

Test #10:

score: 10
Accepted
time: 643ms
memory: 212148kb

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 36690 87374 138798 36564 181594 428424 260437 178882 134288 146942 90320 210326 241671 445549 121178 164319 184591 354583 355428 247773 281684 307841 387907 97435 102464 184979 164216 317633 56960 295193 191071 295961 328549 299162 27136 188202 118130 161902 236258 147998 155971 322975 474055...

result:

ok good job!

Test #11:

score: 10
Accepted
time: 588ms
memory: 210020kb

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 30912 58228 256224 419416 179276 226624 297156 434671 224297 66900 102019 206352 345445 170824 216398 382142 38139 295276 461808 479814 117039 338283 434145 494560 141370 72417 19374 27632 289877 24100 185985 333545 136905 137035 102602 147548 27797 299360 304944 475001 306860 73631 185755 27...

result:

ok good job!

Test #12:

score: 10
Accepted
time: 656ms
memory: 212272kb

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 92225 16389 129241 166449 184539 134974 114717 355886 329721 379424 292962 421117 497443 381527 149162 408 10702 212632 50138 317213 372008 378849 113411 195237 172507 239020 420304 489080 360466 438166 227686 419986 209153 382570 15084 218300 418265 483901 215816 378626 452355 214360 491276 ...

result:

ok good job!

Subtask #2:

score: 25
Accepted

Test #13:

score: 25
Accepted
time: 843ms
memory: 237396kb

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:

63742 11431 300071 157785 268420 71772 84553 267656 174540 21500 451751 82419 58833 165916 94199 78203 263216 146169 306934 50728 338250 199716 469441 135516 133967 123248 375309 17045 459156 413018 49645 73720 188292 322328 493921 152164 219927 140202 236207 266137 180568 32077 371348 66876 354136 ...

result:

ok good job!

Test #14:

score: 25
Accepted
time: 752ms
memory: 230136kb

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:

71019 495557 31730 116065 88378 303281 100690 375513 399886 191425 467776 333920 329290 14772 76952 27872 409419 154816 362396 408615 364034 455915 146139 56273 450037 424683 327232 385588 134811 499210 495342 81995 301341 243738 7518 121857 431344 232635 155628 226209 161465 497460 38422 126619 489...

result:

ok good job!

Test #15:

score: 25
Accepted
time: 621ms
memory: 212824kb

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:

304557 5586 35015 142984 203679 307387 69839 114137 351992 102549 275087 115971 152276 166589 173091 315821 346786 327878 347431 197274 176411 20689 233103 290982 172652 217254 88597 257648 441421 8668 230244 414354 50518 158452 315685 346828 429538 322192 171982 487157 154079 214541 343978 425067 4...

result:

ok good job!

Test #16:

score: 25
Accepted
time: 662ms
memory: 214352kb

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:

215050 19446 24400 14615 25643 180067 364241 307458 446357 280769 25651 109140 154973 368623 119541 492227 218310 171728 458393 198784 278559 137494 143019 227763 174716 29023 442092 264773 359300 125241 127942 272563 494038 31155 287989 453608 450633 62726 406813 353500 484783 177859 188029 54381 1...

result:

ok good job!

Test #17:

score: 25
Accepted
time: 640ms
memory: 211260kb

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:

85810 56701 55013 70070 20863 5952 44369 209016 21393 196502 238286 283328 231091 362159 24100 53022 77434 53861 190964 245909 494770 203142 362680 468997 315074 372025 269279 470919 475142 61788 148196 68925 152178 188666 312179 183386 84902 272511 112309 451308 55250 470069 491403 81967 44243 2885...

result:

ok good job!

Test #18:

score: 25
Accepted
time: 695ms
memory: 213768kb

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:

348556 146589 205582 221656 249128 195934 492809 206910 175113 2067 34723 477415 119761 15015 31436 110900 407525 204562 264534 32273 109660 8075 275848 349253 264882 433035 97105 329745 104719 134042 1136 387372 488227 431870 202883 220503 289534 223339 377081 226168 463382 349185 319077 140953 216...

result:

ok good job!

Test #19:

score: 25
Accepted
time: 744ms
memory: 216036kb

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:

170008 7720 95069 341476 142119 379154 297454 155114 190447 388001 212236 129861 177381 165561 47615 419342 421994 347222 212793 71057 423887 427649 477862 238237 287162 93168 476946 183217 360660 178382 64558 206375 224877 491157 260044 2631 157019 147678 40460 50894 92665 168502 355595 359741 6602...

result:

ok good job!

Test #20:

score: 25
Accepted
time: 751ms
memory: 215620kb

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:

17746 18894 180905 262116 326573 230546 56308 196921 9831 282611 374547 131465 152720 208442 259401 427528 459956 206851 394189 117212 297546 62953 12308 407175 492883 439659 102696 247813 447244 122148 384268 33227 238674 268160 125027 264559 225392 175283 357835 237532 447469 331672 53586 473315 3...

result:

ok good job!

Test #21:

score: 25
Accepted
time: 718ms
memory: 218288kb

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:

2084 5815 93001 202359 243798 405309 291972 366414 316544 388931 106560 132629 103737 58551 267206 80906 77251 383779 123727 484984 493002 352732 49530 74164 56975 492876 21197 34481 316192 220237 183163 326953 33478 182960 366287 413625 263093 297110 453549 152396 329702 108739 57987 100910 44043 3...

result:

ok good job!

Test #22:

score: 25
Accepted
time: 738ms
memory: 219588kb

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:

198418 24971 47481 38227 40624 105638 172696 106976 170252 307508 380430 396983 421252 115174 345389 436645 132372 13305 402654 197480 329961 357315 295923 61979 41410 458963 110595 119515 22431 184447 172640 228319 202163 253214 219264 135357 30833 166178 140682 292036 443190 473347 81788 185944 47...

result:

ok good job!

Test #23:

score: 25
Accepted
time: 662ms
memory: 214708kb

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:

385478 94041 19393 413423 273056 249670 439749 420604 89804 161843 189395 169496 469828 368127 53630 289387 14799 380376 429774 419016 388663 217051 81818 81937 331279 372910 111997 161493 166724 40160 248536 353961 360122 82089 432669 65172 265563 74197 361532 111240 145571 478471 196757 408687 319...

result:

ok good job!

Test #24:

score: 25
Accepted
time: 698ms
memory: 219848kb

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:

468866 45240 46584 25404 135863 480512 175428 201694 281094 205982 141446 236246 11299 56131 54297 280362 102488 259688 306385 19003 213040 10729 394676 251752 444295 49401 271739 289974 493096 129570 122810 252688 200779 364946 452649 477527 361527 234772 476356 238366 4569 131538 54695 416814 4521...

result:

ok good job!

Subtask #3:

score: 19
Accepted

Test #25:

score: 19
Accepted
time: 690ms
memory: 201660kb

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:

20242 414878 185020 125537 353357 496468 308518 188057 254952 120898 414314 11748 435424 326112 345902 271794 473882 337923 135188 438050 45188 88306 260313 116954 457474 435919 366460 431766 397351 392326 178950 199724 227083 282259 70917 121346 109196 193669 242154 12225 466790 155481 287973 15749...

result:

ok good job!

Test #26:

score: 19
Accepted
time: 677ms
memory: 201692kb

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:

107095 98656 106791 304190 196877 423284 60540 204253 341441 59196 240332 29151 433366 290562 22079 64655 213528 72009 364851 443801 202553 8696 9763 456384 397249 125804 414847 223082 446791 174 461813 451655 292806 308476 264153 244973 167889 101629 244034 183440 234960 246613 494471 130935 20773 ...

result:

ok good job!

Test #27:

score: 19
Accepted
time: 559ms
memory: 178236kb

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:

290210 13677 151634 40727 24083 377951 51259 24387 78447 258948 149198 97404 320915 110359 396250 159729 244808 125173 325310 78665 311099 89482 494453 148339 485441 212679 140059 237182 317985 425227 437371 495349 444488 169841 239410 91689 156783 214680 246889 14065 65024 408878 386696 105752 3679...

result:

ok good job!

Test #28:

score: 19
Accepted
time: 545ms
memory: 179976kb

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:

262885 26405 37590 47135 198540 83701 246994 411590 108867 135661 199799 63705 15347 76486 127960 90652 349722 490303 371316 113083 390263 395835 316123 324202 444511 410294 120551 33149 49987 71281 136741 180235 421772 467747 268922 32675 341992 482651 175982 417051 425763 495175 221570 299352 2801...

result:

ok good job!

Test #29:

score: 19
Accepted
time: 540ms
memory: 181728kb

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:

356081 2312 17788 6539 471617 121113 254620 209285 69902 362175 199619 310574 418009 464422 371025 217479 94218 46766 225849 100918 356122 402143 451851 97789 317757 327166 370682 403651 299445 127799 269331 306308 414664 359779 364422 152541 458138 349882 315266 74866 85788 230345 405923 252885 290...

result:

ok good job!

Test #30:

score: 19
Accepted
time: 564ms
memory: 183264kb

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:

35725 15183 307544 103768 75760 194524 142193 151681 351937 156748 154434 145963 7330 131588 282828 166004 462630 103384 153029 171959 226536 271825 273141 303746 265437 327265 372225 46297 449256 82283 357232 218423 97322 423291 399174 446468 250648 417860 115359 129995 384902 412094 166544 379130 ...

result:

ok good job!

Test #31:

score: 19
Accepted
time: 603ms
memory: 181880kb

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:

352301 50228 33442 105746 318234 242743 494637 202564 27854 478655 54227 282065 494185 272019 313856 497489 162619 338308 83927 184774 335718 356177 242991 284118 139187 171779 458685 440527 100050 355976 411506 252784 38102 446292 304506 440095 473379 257752 489690 376862 164425 351579 386968 15391...

result:

ok good job!

Test #32:

score: 19
Accepted
time: 602ms
memory: 183520kb

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:

457551 33120 310606 409181 164955 333664 415023 414483 483873 290894 121606 285951 273848 74615 374861 199386 421805 292076 215704 314619 493051 291088 256615 199707 411774 39651 47465 92053 236892 240655 77165 483798 108546 252344 344927 181809 364754 359074 443208 28064 98595 99033 236577 57134 41...

result:

ok good job!

Test #33:

score: 19
Accepted
time: 551ms
memory: 183880kb

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:

99685 14630 25308 222609 42377 77941 300331 378286 225635 50038 419228 54775 193525 350703 120401 195472 258665 264305 306805 90771 396598 294690 359231 222548 323672 7056 37419 290297 498041 350945 39054 201271 144770 81112 151935 260307 382362 186587 269440 303347 252391 64959 71498 40234 435683 2...

result:

ok good job!

Test #34:

score: 19
Accepted
time: 551ms
memory: 186256kb

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:

184569 64682 25871 32137 162841 279584 369285 50040 137924 94856 8750 20323 97496 27258 30352 120030 225002 462296 148795 282345 293615 466790 163719 184851 252352 41908 391133 327009 22054 391191 386663 424359 53100 171598 234987 88566 294271 322682 76388 309645 457921 282765 205011 216045 81525 20...

result:

ok good job!

Test #35:

score: 19
Accepted
time: 585ms
memory: 182140kb

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:

485685 16879 95136 85559 301260 223640 396312 234346 139273 164993 410208 422158 106942 449432 244910 223531 289215 351912 88124 82997 20475 44463 28827 398118 40443 483726 249086 23653 184838 250220 269534 235858 251468 441312 371439 375614 280930 494510 496319 381338 399488 406004 67540 149470 184...

result:

ok good job!

Test #36:

score: 19
Accepted
time: 554ms
memory: 186224kb

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:

410090 13158 14478 168448 4367 253064 400898 8818 323890 209798 479143 173136 448278 25573 12787 94458 123389 405005 227840 395897 96313 188051 17353 95760 148985 199086 229886 323946 284194 47858 296531 189179 84306 47229 312803 53545 444712 421194 61623 105089 186209 23083 328288 236919 85473 2562...

result:

ok good job!

Subtask #4:

score: 22
Accepted

Test #37:

score: 22
Accepted
time: 1558ms
memory: 363204kb

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:

545967 706162 53597 107558 776536 230611 572458 293457 390487 241653 638541 42868 433774 438059 293014 739962 25440 503383 628342 573629 887812 909797 805385 862282 382785 706534 190319 439139 648412 626240 131005 848982 269684 840650 376086 933701 18720 749474 336321 160119 795534 671698 201133 610...

result:

ok good job!

Test #38:

score: 22
Accepted
time: 1562ms
memory: 361844kb

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:

95498 889615 960323 436119 268907 878076 506332 704874 156497 67827 745845 203785 930852 891171 111021 389493 512868 480450 704804 985356 427544 771792 987920 534755 390890 820863 819565 664577 291796 963733 65362 76637 833989 747732 553794 727554 980477 63319 4035 692108 638253 898078 315136 558195...

result:

ok good job!

Test #39:

score: 22
Accepted
time: 1209ms
memory: 319908kb

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:

277025 98015 61408 27302 933005 948653 685171 412061 686090 401874 886528 60098 393982 922827 149085 180671 236305 591437 853563 94232 622963 259325 311993 944027 347203 610609 801299 48594 688433 575174 279735 114109 477037 251655 246985 757503 393269 511526 53445 736190 820306 622599 212823 24516 ...

result:

ok good job!

Test #40:

score: 22
Accepted
time: 1209ms
memory: 319424kb

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:

842070 61244 9479 49638 80277 93547 64902 205418 399856 461035 37205 142236 587209 273864 51485 180422 328708 616981 713321 357443 475222 612141 723680 66497 350066 605589 687768 859391 263939 838977 457263 318383 317291 404492 82015 227368 633196 843234 451053 520129 765603 916256 941240 630386 322...

result:

ok good job!

Test #41:

score: 22
Accepted
time: 1226ms
memory: 321208kb

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:

831483 65234 846856 994513 100734 120520 109866 6885 16089 904409 963956 389373 934265 466483 79172 10170 120188 169189 54716 95841 336665 232529 460124 474143 298189 604597 825927 326083 494785 975591 340050 629829 421389 146050 149025 353315 426681 781949 544187 258767 687298 843054 77876 618597 2...

result:

ok good job!

Test #42:

score: 22
Accepted
time: 1396ms
memory: 327080kb

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:

74982 84832 135723 847384 656253 346750 249104 892382 275119 417978 174770 874055 211177 782107 108099 730267 625728 693926 66712 742351 910747 939711 528104 22110 814166 973353 453198 656866 187810 536951 670174 896820 722181 872980 549726 884450 236703 947912 417392 820980 290470 700254 929794 722...

result:

ok good job!

Test #43:

score: 22
Accepted
time: 1349ms
memory: 326900kb

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:

664618 37707 391174 899944 364973 289489 88987 145327 509163 704569 462649 833742 664024 433630 803869 108519 462955 36802 121343 986524 977879 314905 985622 315724 861623 434810 268661 222185 324130 54136 415619 510162 219171 524493 86027 236417 589742 395552 478017 212703 66296 402452 150499 96555...

result:

ok good job!

Test #44:

score: 22
Accepted
time: 1376ms
memory: 326436kb

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:

498695 4585 771298 106700 725340 556971 623707 708015 663016 935802 190965 543388 739519 53714 486096 502372 764919 294928 108945 6538 714801 782316 246156 432047 220433 794684 213088 631710 796771 949462 959060 245025 400542 209112 552091 913591 548332 855908 124871 138676 865873 971471 63490 52326...

result:

ok good job!

Test #45:

score: 22
Accepted
time: 1278ms
memory: 329680kb

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:

389549 61427 114140 231763 797784 181900 259593 299029 106065 296318 596446 696555 167271 884442 379888 642657 655348 180877 154704 218728 554262 696513 724005 733491 214976 278000 451829 284328 311632 373335 333650 738857 304592 22592 552544 862689 83544 34651 223376 92271 403912 807878 226046 9776...

result:

ok good job!

Test #46:

score: 22
Accepted
time: 1264ms
memory: 329544kb

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:

380028 205689 76627 148571 486545 518013 490559 525975 893786 790263 650632 246956 920667 369184 118786 148723 286668 158667 233200 334696 51836 375270 917336 892437 280821 427806 305702 572041 783709 105805 40345 770920 192605 287881 492052 538783 59864 71395 485914 528483 645264 281701 941016 2507...

result:

ok good job!

Test #47:

score: 22
Accepted
time: 1264ms
memory: 327816kb

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:

507406 29879 189820 165105 347325 622326 216833 630332 91511 751939 817857 893734 208282 20444 736905 510370 863952 994029 199286 509211 857974 315233 714359 273387 884979 867429 562477 719576 879287 262499 959460 8787 664660 90990 35044 143475 156660 365103 430649 72552 281609 326871 506933 576916 ...

result:

ok good job!

Test #48:

score: 22
Accepted
time: 1290ms
memory: 328656kb

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:

628359 13031 894561 79875 74990 515112 563410 932696 392078 873976 173039 825761 972944 293392 384370 857233 667136 622465 118683 791829 836075 179964 922561 182269 973008 958578 210053 200891 425380 89749 672102 126806 648570 727910 827203 887603 37502 49795 66651 855389 323314 90063 267517 153708 ...

result:

ok good job!

Subtask #5:

score: 24
Accepted

Dependency #4:

100%
Accepted

Test #49:

score: 24
Accepted
time: 1721ms
memory: 411556kb

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:

827995 196444 835457 100266 922715 142913 297340 524911 950490 582786 741644 863505 805244 984882 24755 930891 884867 861271 531596 648132 338218 46845 847717 595175 12717 326481 377840 588017 813334 995758 603487 25306 578153 332196 711148 800636 39897 846372 614206 907492 415320 957601 361674 2575...

result:

ok good job!

Test #50:

score: 24
Accepted
time: 1712ms
memory: 411140kb

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:

817772 657031 55207 421261 893501 135937 750393 440629 311734 700739 420833 514845 773485 235162 434337 863985 194772 516431 556822 285605 430380 294378 871757 809646 399453 929706 390314 165599 628640 110756 872436 719112 744549 97663 634614 689982 998575 157296 636440 644369 82641 825277 301856 24...

result:

ok good job!

Test #51:

score: 24
Accepted
time: 1281ms
memory: 365032kb

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:

139210 5819 128244 99787 106099 710625 176613 666257 658188 930379 850090 324831 372609 147983 298184 990649 354196 319440 129952 758520 368507 346959 351344 618641 683387 967579 642318 114495 264692 812319 269059 816677 689125 414405 770695 402695 102104 264353 452205 116517 350585 172897 222330 59...

result:

ok good job!

Test #52:

score: 24
Accepted
time: 1368ms
memory: 368572kb

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:

349880 127200 60841 172245 791830 895413 552967 213402 568756 831618 95837 371020 204341 529702 798916 328778 155723 23881 941687 41715 599905 826119 998348 581851 10404 154151 592661 520500 734681 777300 334938 596612 177167 476436 64776 25799 437189 465011 428589 567130 279731 666708 587082 74686 ...

result:

ok good job!

Test #53:

score: 24
Accepted
time: 1271ms
memory: 363772kb

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:

386504 5130 463337 59116 350737 399006 661688 998503 603961 369924 423638 349366 532987 761233 886607 710100 835566 792581 878876 146587 43651 578729 74525 77361 53512 141100 551841 43728 545091 4441 820152 141888 400570 321712 85782 647759 981730 673571 832184 781715 483334 6031 234274 909129 16115...

result:

ok good job!

Test #54:

score: 24
Accepted
time: 1516ms
memory: 374908kb

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:

148349 85398 229041 384634 319752 274093 446324 136193 373929 693107 223625 564869 502090 252894 923403 23230 495756 629132 662608 921982 415999 873702 449026 364143 879307 326189 140084 274055 890292 938733 995671 533636 207918 786432 491286 156553 36657 959713 853473 613484 979524 470980 844542 71...

result:

ok good job!

Test #55:

score: 24
Accepted
time: 1443ms
memory: 370884kb

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:

377649 77769 289012 777515 538127 559233 580716 450556 419167 579595 619465 601911 80563 522881 291977 935059 41130 792757 751731 130700 946594 254132 558609 824813 223537 332860 440954 622975 44639 248722 423471 152785 590586 252413 441017 836427 216318 360999 618872 479634 208295 497140 260205 620...

result:

ok good job!

Test #56:

score: 24
Accepted
time: 1485ms
memory: 375176kb

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:

422996 264657 204770 223664 680483 132553 92089 428739 173084 315951 454865 597862 608628 733879 264751 213786 131257 892123 434365 633164 320301 645239 581686 751818 787193 847907 231242 334225 82334 313641 366808 620619 535225 77724 253377 55205 495601 754994 925481 115932 445115 556302 567757 955...

result:

ok good job!

Test #57:

score: 24
Accepted
time: 1390ms
memory: 373876kb

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:

622629 156822 61944 729688 193999 411961 231836 641109 656470 414102 680346 881305 216781 222657 535813 72435 250868 168422 756925 690177 218323 120476 651593 210847 974926 601862 708528 402337 464725 52390 755313 986620 807749 261902 16638 452743 472088 732583 328164 919347 602744 971586 935338 297...

result:

ok good job!

Test #58:

score: 24
Accepted
time: 1399ms
memory: 373024kb

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:

109338 17616 25379 91939 299177 779557 813187 126252 739172 813245 908177 36782 760015 916963 841921 116964 3853 116775 346774 438982 504429 470772 689829 839772 255755 791033 995595 281674 938902 964307 728067 62651 713375 431368 443425 697407 364554 55264 119940 771955 912532 359942 710132 666407 ...

result:

ok good job!

Test #59:

score: 24
Accepted
time: 1385ms
memory: 372900kb

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:

562168 33984 225425 836826 231890 90668 486575 159007 641352 708749 289283 306005 785416 74617 319306 321677 97862 175775 36176 996282 252719 272801 14741 399472 20343 763275 122135 384558 435524 309490 640038 634420 488557 602248 665479 384932 43931 74245 121010 128296 545224 43945 725189 497993 54...

result:

ok good job!

Test #60:

score: 24
Accepted
time: 1404ms
memory: 374980kb

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:

861270 1235 66202 672524 127959 189338 52975 404340 169355 203986 520073 779538 861398 837599 779591 783614 187648 1677 15927 211577 26089 213904 465270 502374 589224 607388 428690 58521 16607 813683 636913 773397 237978 291160 670141 735389 249870 876727 913963 96194 733182 947927 52600 210556 3603...

result:

ok good job!

Extra Test:

score: 0
Extra Test Passed