QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#42500#4401. Prizecatthomas10 2728ms265344kbC++3.9kb2022-08-02 16:22:052022-08-02 16:22:06

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-08-02 16:22:06]
  • 评测
  • 测评结果:10
  • 用时:2728ms
  • 内存:265344kb
  • [2022-08-02 16:22:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
inline void Flu(){fflush(stdout);}
const int maxm=200025;
const int maxn=1000025;
int n,K,Q,T,m,i,j,t,k,s,Log[maxn];
struct Edge
{
	int nxt,aim;
};
bool lit[maxn];
int seq[maxm],tsq,stk[maxm],tp,tof[maxm],quer[maxm][4],ord[maxm];
struct Tree
{
	int N,head[maxn],nrt,fat[maxn][21],dfn[maxn],bac[maxn];
	int dep[maxn],tod[maxn],dep2[maxn];
	Edge edge[maxn];
	inline void add_edge(int x,int y)
	{
		if (x==-1){nrt=y;return;}
		fat[y][0]=x;
		edge[++N]=(Edge){head[x],y};head[x]=N;
		//edge[++N]=(Edge){head[y],x};head[y]=N;
	}
	void dfs_gt_seq(int x)
	{
		lit[x]=1;ord[++tsq]=x;if (tsq>=K) return;
		for (int i=head[x];i;i=edge[i].nxt)
		{
			int des=edge[i].aim;
			dfs_gt_seq(des);if (tsq>=K) return;
		}
	}
	void dfs1(int x)
	{
		dfn[x]=++t;bac[t]=x;dep[x]=dep[fat[x][0]]+1;
		for (int i=1;i<=Log[n];++i)
		 fat[x][i]=fat[fat[x][i-1]][i-1];
		for (int i=head[x];i;i=edge[i].nxt)
		{
			int des=edge[i].aim;
			dfs1(des);
		}
	}
	int LCA(int x,int y)
	{
		if (dep[x]<dep[y]) swap(x,y);
		for (int i=Log[n];~i;--i) if (dep[fat[x][i]]>=dep[y]) x=fat[x][i];
		if (x==y) return x;
		for (int i=Log[n];~i;--i) if (fat[x][i]^fat[y][i])
		 x=fat[x][i],y=fat[y][i];
		return fat[x][0];
	}
	void dfs2(int x)
	{
		dep2[x]=dep2[fat[x][0]]+tod[x];
		for (int i=head[x];i;i=edge[i].nxt)
		{
			int des=edge[i].aim;
			dfs2(des);
		}
	}
	void Process1()
	{
		tsq=0;
		for (int i=1;i<=n;++i)
		 if (lit[bac[i]]) seq[++tsq]=bac[i];assert(tsq==K);
		for (int i=1;i<=tsq;++i) printf("%d ",seq[i]);puts("");
		for (int i=1;i<tsq;++i) printf("? %d %d\n",seq[i],seq[i+1]);
		puts("!");Flu();
		for (int i=1;i<tsq;++i)
		 scanf("%d%d%d%d",&quer[i][0],&quer[i][1],
		  &quer[i][2],&quer[i][3]);
		stk[tp=1]=seq[1];
		for (int i=2;i<=tsq;++i)
		{
			int lc=LCA(stk[tp],seq[i]),lst=-1,len=quer[i-1][0];
			while (tp&&dep[stk[tp]]>dep[lc])
			{
				if (lst!=-1) tod[lst]=tof[tp+1],len-=tof[tp+1];
				lst=stk[tp];--tp;
			}
			if (stk[tp]^lc)
			{
				stk[++tp]=lc;
				if (lst!=-1) tod[lst]=len;
				tof[tp]-=len;
			}else if (lst!=-1) tod[lst]=len;
			stk[++tp]=seq[i];tof[tp]=quer[i-1][1];
		}
		while (tp>1) tod[stk[tp]]=tof[tp],--tp;
		dfs2(nrt);
	}
	int pre[maxn],nxt[maxn],qv[maxn][2];
	void Process2()
	{
		for (int i=1;i<tsq;++i)
		{
			int t0=seq[i],t1=seq[i+1];
			nxt[t0]=t1;pre[t1]=t0;
			qv[t0][0]=quer[i][2];qv[t0][1]=quer[i][3];
		}
		int nowtt=tsq;
		while (nowtt>1)
		{
			int now=ord[nowtt];--nowtt;
			int t0=pre[now],t1=nxt[now];
			if (!t1)
			{
				int lc0=LCA(t0,now);
				nxt[t0]=0;
				tod[now]=lc0;dep2[now]=qv[t0][1];
				continue;
			}
			else if (!t0)
			{
				int lc1=LCA(t1,now);
				pre[t1]=0;
				tod[now]=lc1;dep2[now]=qv[now][0];
				continue;
			}
			int lc0=LCA(t0,now),lc1=LCA(t1,now);
			tod[now]=lc0;dep2[now]=qv[t0][1];
			if (dep[lc0]<=dep[lc1])
			 qv[t0][1]=0ll+qv[t0][1]+qv[now][1]-qv[now][0];
			else
			{
				int d1=0ll+qv[t0][0]+qv[now][0]-qv[t0][1];
				qv[t0][1]=qv[now][1];qv[t0][0]=d1;
			}
			pre[t1]=t0;nxt[t0]=t1;
		}
		dep2[nrt]=0;
		for (int i=2;i<=tsq;++i)
		 dep2[ord[i]]+=dep2[tod[ord[i]]];
	}
	int gtds(int x,int y){return 0ll+dep2[x]-2ll*dep2[LCA(x,y)]+dep2[y];}
}tr1,tr2;

int ask[maxm][2];

int main()
{
	for (i=2;i<maxn;++i)
	 Log[i]=Log[i>>1]+1;
	scanf("%d%d%d%d",&n,&K,&Q,&T);
	for (i=1;i<=n;++i)
	{
		scanf("%d",&t);
		tr1.add_edge(t,i);
	}
	for (i=1;i<=n;++i)
	{
		scanf("%d",&t);
		tr2.add_edge(t,i);
	}
	tr2.dfs_gt_seq(tr2.nrt);
	t=0;tr1.dfs1(tr1.nrt);t=0;tr2.dfs1(tr2.nrt);
	tr1.Process1();
	tr2.Process2();
	Flu();
	for (i=1;i<=T;++i)
	 scanf("%d%d",&ask[i][0],&ask[i][1]),Flu();
	for (i=1;i<=T;++i)
	{
		printf("%d %d\n",tr1.gtds(ask[i][0],ask[i][1]),tr2.gtds(ask[i][0],ask[i][1]));
	}
	Flu();
	return 0;
}
/*
9 3 2 3
2 -1 2 1 1 5 1 4 5
9 4 5 5 7 3 -1 3 7

0 3 5 0
3 4 0 1
1 7
7 9
1 9

*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1138ms
memory: 138184kb

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: 1169ms
memory: 138904kb

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: 774ms
memory: 132828kb

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 475865 321066 209201 462604 214253 196699 226268 117131 350699 80452 25767 119995 214529 357833 292947 225261 88518 406492 280325 288052 472421 212781 374357 131433 126129 146914 100104 462425 237524 61399 118483 69532 7167 205586 192148 457094 51756 22755 163842 266528 164794 33213 463264 24...

result:

ok good job!

Test #4:

score: 0
Accepted
time: 803ms
memory: 132228kb

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 497883 480811 452802 492417 418837 489998 482202 374848 289765 110680 44797 89513 378682 31352 85884 239398 471868 462423 126653 81678 479584 465851 494207 338718 467250 307848 66039 38694 318222 497955 274328 218770 211188 137818 464748 74827 307971 311906 435586 96725 263480 427209 316995 4...

result:

ok good job!

Test #5:

score: 0
Accepted
time: 855ms
memory: 132920kb

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 486608 447632 311856 176217 140269 41860 495622 336304 407115 326281 422501 237284 228965 459131 164231 210096 36000 18635 113069 424572 369989 278926 5557 285982 428570 246301 37534 439333 362562 335977 270335 150717 217178 479485 216679 181482 158511 101150 450818 65767 281479 254609 76742 3...

result:

ok good job!

Test #6:

score: 0
Accepted
time: 1013ms
memory: 134008kb

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 400064 17878 393825 463407 419374 324697 246607 415699 193455 464346 123412 360569 179912 398688 70886 255935 399564 225125 66793 171898 292203 303280 310037 168995 59490 80738 100068 33512 34314 337722 389758 398573 961 150261 487444 449590 366771 480658 469084 386039 24...

result:

ok good job!

Test #7:

score: 0
Accepted
time: 1014ms
memory: 134312kb

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 412347 156219 429048 311400 237666 376930 358105 172116 223728 347566 163517 24933 222554 62652 450905 111814 292285 381302 9722 20522 237978 362286 151412 329939 131882 35390 373863 273121 290480 204978 443479 492305 157831 85371 426614 320962 313401 260605 124678 401442 429465 35096 116573 ...

result:

ok good job!

Test #8:

score: 0
Accepted
time: 997ms
memory: 133720kb

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 453335 431734 359470 262646 246698 118545 434345 308679 54000 429984 58520 150175 496485 320496 226752 157757 411306 471147 177546 84102 21718 405045 229436 365081 354126 287769 18847 159843 439439 472598 266529 209455 153471 162068 232574 113351 30464 210981 92825 30916 22707 141818 30364 25...

result:

ok good job!

Test #9:

score: 0
Accepted
time: 771ms
memory: 132840kb

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 485825 431592 164281 145981 86316 174346 80301 113618 487665 195552 414429 388882 204209 80452 122276 419753 180024 193433 229168 88715 50776 213156 141400 324806 395048 381700 288273 304234 33047 458744 184179 366547 154339 335938 453780 354088 190817 228996 422056 344516 120896 33776...

result:

ok good job!

Test #10:

score: 0
Accepted
time: 865ms
memory: 132656kb

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 481099 499156 453960 393401 420707 490583 300635 457841 400593 362860 43697 439965 396991 259790 76224 209515 171230 384576 55737 330347 157797 329818 259497 162271 198217 140016 472820 346759 384195 48170 465258 391317 424786 181091 362106 81702 55087 46106 446240 429146 381049 446694 111378...

result:

ok good job!

Test #11:

score: 0
Accepted
time: 767ms
memory: 132288kb

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 472144 368896 436727 185550 365962 268698 368492 3377 345731 3530 464046 140761 273689 201619 469799 394344 235126 314427 90759 257401 495673 56059 218201 415591 470103 255673 178092 331005 207934 77614 238596 214701 232320 472004 432899 63486 380625 274954 193159 466963 373914 221349 40706 2...

result:

ok good job!

Test #12:

score: 0
Accepted
time: 773ms
memory: 132492kb

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 497074 411928 166528 27377 492052 442541 286098 257719 348936 496628 65473 327811 270751 427588 253567 209339 182074 3507 347804 482508 464097 368679 379219 262140 457347 414902 413100 249692 107916 365412 166083 109652 355124 313876 225009 139337 337423 39090 139799 20308 101393 120141 45641...

result:

ok good job!

Subtask #2:

score: 0
Wrong Answer

Test #13:

score: 25
Accepted
time: 1323ms
memory: 139048kb

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 263216 146169 50728 199716 469441 459156 322328 152164 66876 274063 180006 237497 208598 249207 359435 96669 110070 41714 147909 214779 59127 151892 216797 194356 199621 20899 418742 198323 158340 163745 123748 85656 172672 123919 47108 313725 12227 183377 183933 348552 102798 184923 290145 17...

result:

ok good job!

Test #14:

score: 0
Accepted
time: 1157ms
memory: 138148kb

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:

154816 362396 450037 134811 7518 38422 119314 43275 412297 380046 465285 405991 75531 379813 36281 281211 137834 336400 10173 219815 389857 29366 476153 333693 222590 318117 4684 259586 214152 484414 225911 152245 481486 109527 42793 47295 294599 177444 430241 227553 353815 421724 89015 337781 46301...

result:

ok good job!

Test #15:

score: -25
Wrong Answer
time: 813ms
memory: 131924kb

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:

51828 473426 445081 57639 354967 86793 140791 264055 338782 272606 431020 214166 186297 159565 46575 213976 357863 353443 115707 425038 179822 257935 117881 365846 197395 139359 76696 13458 298383 491528 494236 159550 192014 352468 188356 308120 107670 337384 86141 285437 54983 349085 127681 353472 ...

result:

wrong answer wrong answer on the second integer of query #1: read 30048 but expected 27590

Subtask #3:

score: 0
Wrong Answer

Test #25:

score: 19
Accepted
time: 796ms
memory: 125632kb

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:

464387 27779 146694 443858 405500 46371 375328 183696 253669 95388 173896 183797 18073 431275 140576 468877 345574 227090 361228 17134 261985 60381 64649 124883 275006 345205 205047 166559 173438 437370 498046 158980 365732 106698 145138 342120 407307 83109 296453 316074 219468 97176 251586 177490 2...

result:

ok good job!

Test #26:

score: 0
Accepted
time: 813ms
memory: 126696kb

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:

332473 244705 329425 11670 1976 487833 9007 276165 332796 312780 40729 316303 262301 333879 107770 492625 290121 131493 452498 165311 58291 430151 17928 144890 413013 491676 82978 491900 220829 88480 488804 85566 226877 148451 471377 89209 413295 493138 228587 42773 455217 374293 451378 249388 39514...

result:

ok good job!

Test #27:

score: -19
Wrong Answer
time: 533ms
memory: 121132kb

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:

327030 102630 12826 196528 392772 99711 138529 277616 25910 36722 195048 448320 281921 129741 351511 70324 18748 349330 443128 409259 128449 478518 377662 487467 60012 36280 143859 378801 337078 272646 318080 79189 318889 466985 457455 53178 276940 186653 413379 5875 190396 399519 13914 91602 205310...

result:

wrong answer wrong answer on the second integer of query #1: read 12396 but expected 10086

Subtask #4:

score: 0
Wrong Answer

Test #37:

score: 22
Accepted
time: 2216ms
memory: 250892kb

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 237540 859419 982835 971518 506285 771618 939329 16802 700671 845162 359776 499849 958003 722555 893539 667107 399090 361260 56054 518738 929831 330952 261064 845434 378738 416383 813166 332967 155083 279300 603715 217430 73563 278581 71462 840056 191244 422478 38987 402361 21178 733103 92045...

result:

ok good job!

Test #38:

score: 0
Accepted
time: 2265ms
memory: 250628kb

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:

959155 71732 216953 52396 218400 471935 261546 739634 378310 36063 83375 817354 897911 522282 872241 172504 51526 459366 489117 1470 604900 617893 858099 222969 589307 401759 600954 487433 102962 333151 531844 369556 979169 59651 886371 796473 529233 799539 596446 792490 872895 106195 268233 639986 ...

result:

ok good job!

Test #39:

score: -22
Wrong Answer
time: 1372ms
memory: 240576kb

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:

782981 619342 123231 16201 541213 485625 244820 856234 710688 470149 46884 124005 526601 534107 926984 993276 631240 468312 818047 33349 580409 747487 376210 164957 553573 838362 647718 794464 718844 366747 916829 534947 252029 343027 800318 565482 186972 80905 777694 710867 553553 226868 729481 306...

result:

wrong answer wrong answer on the second integer of query #1: read 9352 but expected 8806

Subtask #5:

score: 0
Wrong Answer

Test #49:

score: 24
Accepted
time: 2728ms
memory: 264948kb

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:

100266 524911 805244 861271 648132 338218 588017 846372 361674 257564 857806 809152 146144 655284 305021 895380 787314 337733 840423 783219 849918 564122 924389 456471 56411 922287 626528 573150 955857 663398 713622 677964 973127 106150 529384 890628 839820 734754 971452 312629 105748 707190 993032 ...

result:

ok good job!

Test #50:

score: 0
Accepted
time: 2576ms
memory: 265344kb

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:

657031 420833 863985 744549 327860 7465 366454 503105 174600 66331 884132 440435 83331 20169 431840 637465 706870 854218 769446 308290 973468 409784 465480 510074 624313 325255 531901 746512 948232 774257 670120 537460 477635 627130 405465 446642 481969 419640 744427 161791 304380 337938 935695 9745...

result:

ok good job!

Test #51:

score: -24
Wrong Answer
time: 1599ms
memory: 253672kb

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:

388582 218670 486014 178990 292828 321823 441301 724945 792149 146729 202775 584439 689687 254948 171260 765128 813165 986565 518209 368097 794441 728385 675404 43513 753842 193875 900577 836329 997340 944637 225864 63471 507259 772467 322518 828669 91140 344612 84880 976226 287094 751001 29460 7720...

result:

wrong answer wrong answer on the second integer of query #1: read 18739 but expected 16752