QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#448517#4401. PrizeNaganohara_Yoimiya100 ✓1908ms858104kbC++147.4kb2024-06-19 18:19:402024-06-19 18:19:40

Judging History

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

  • [2024-06-19 18:19:40]
  • 评测
  • 测评结果:100
  • 用时:1908ms
  • 内存:858104kb
  • [2024-06-19 18:19:40]
  • 提交

answer

#include<bits/stdc++.h>

#define ll long long
#define mk make_pair
#define fi first
#define se second

using namespace std;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;(c<'0'||c>'9');c=getchar()){if(c=='-')f=-1;}
	for(;(c>='0'&&c<='9');c=getchar())x=x*10+(c&15);
	return x*f;
}

template<typename T>void cmax(T &x,T v){x=max(x,v);}
template<typename T>void cmin(T &x,T v){x=min(x,v);}

mt19937 rnd(time(0));
int randint(int l,int r){return rnd()%(r-l+1)+l;}

const int N=1e6+50;

int n,k,q;

struct zkw{
	int M,k,d[N<<2];
	void build(){
		M=1,k=0;while(M<n)M<<=1,k++;
		for(int i=1;i<=2*M-1;i++)d[i]=1e9;
	}
	void pushup(int p){d[p]=min(d[p<<1],d[p<<1|1]);}
	void ins(int p){
		d[p+M-1]=p,p+=M-1;
		for(int i=1;i<=k;i++)pushup(p>>i);
	}
	int qry(int l,int r){
		int res=1e9;
		for(l+=M-1,r+=M;l<r;l>>=1,r>>=1){
			if(l&1)cmin(res,d[l++]);
			if(r&1)cmin(res,d[--r]);
		}
		return res;
	}
};

struct BIT{
	int c[N];
	void clear(){memset(c,0,sizeof(c));}
	int lowbit(int x){return x&(-x);}
	void add(int x,int v){for(int i=x;i<=n;i+=lowbit(i))c[i]+=v;}
	int sum(int x){int res=0;for(int i=x;i;i-=lowbit(i))res+=c[i];return res;}
};

struct Tree{

vector<int>G[N];
int fa[N],hson[N],top[N],dfn[N],idfn[N],dep[N],sz[N],dfc,root;

void dfs1(int u){
	dep[u]=dep[fa[u]]+1,sz[u]=1;
	for(int v:G[u]){
		dfs1(v),sz[u]+=sz[v];
		if(sz[v]>sz[hson[u]])hson[u]=v;
	}
}
void dfs2(int u,int tp){
	top[u]=tp,idfn[dfn[u]=++dfc]=u;
	if(hson[u])dfs2(hson[u],tp);
	for(int v:G[u])if(v!=hson[u])dfs2(v,v);
}

zkw T1,T3;
BIT T2;

int f[N];
void mdf(int x,int v){
	T2.add(dfn[x],v-f[x]),T2.add(dfn[x]+sz[x],f[x]-v);
	f[x]=v;
}
int qsum(int x){
	return T2.sum(dfn[x]);
}

int LCA(int u,int v){
	while(top[u]!=top[v]){
		if(dep[top[u]]<dep[top[v]])swap(u,v);
		u=fa[top[u]];
	}
	if(dep[u]>dep[v])swap(u,v);
	return u;
}
int qry(int x,int y){
	int z=LCA(x,y);
	int fx=qsum(x),fy=qsum(y),fz=qsum(z);
	return fx+fy-fz-fz;
}

int getpos_1(int x){
	int p=T1.qry(dfn[x],dfn[x]+sz[x]-1);
	if(p>n)return -1;
	return idfn[p];
}
int getpos_3(int x){
	int p=T3.qry(dfn[x],dfn[x]+sz[x]-1);
	if(p>n)return -1;
	return idfn[p];
}

bool In[N];
int mn1[N],mn2[N];

void build(vector<int>Fa){
	for(int i=1;i<=n;i++)fa[i]=Fa[i];
	for(int i=1;i<=n;i++){
		if(fa[i]!=-1)G[fa[i]].emplace_back(i);
		else root=i,fa[i]=0;
	}

	dfc=0,dep[root]=0;
	dfs1(root),dfs2(root,root);
	T1.build(),T2.clear(),T3.build();

	for(int i=1;i<=n;i++)In[i]=0,mn1[i]=mn2[i]=-1;
}

set<int>S1[N],S2[N];
void ins(int u,bool c){
	if(c){
		T3.ins(dfn[u]);
		if(mn2[top[u]]==-1||dep[mn2[top[u]]]>dep[u])mn2[top[u]]=u;
		S2[top[u]].insert(dep[u]);
	}
	T1.ins(dfn[u]);
	if(mn1[top[u]]==-1||dep[mn1[top[u]]]>dep[u])mn1[top[u]]=u;
	S1[top[u]].insert(dep[u]);
	In[u]=1;
}

void ins2(int u){ // --> real
	T3.ins(dfn[u]);
	if(mn2[top[u]]==-1||dep[mn2[top[u]]]>dep[u])mn2[top[u]]=u;
	S2[top[u]].insert(dep[u]);
}

int getf_1(int u){
	while(u){
		if(mn1[top[u]]!=-1&&dep[mn1[top[u]]]<=dep[u]){
			auto it=--S1[top[u]].upper_bound(dep[u]);
			int d=(*it);
			return idfn[dfn[top[u]]+d-dep[top[u]]];
		}
		u=fa[top[u]];
	}
	return -1;
}
int getf_2(int u){
	while(u){
		if(mn2[top[u]]!=-1&&dep[mn2[top[u]]]<=dep[u]){
			auto it=--S2[top[u]].upper_bound(dep[u]);
			int d=(*it);
			return idfn[dfn[top[u]]+d-dep[top[u]]];
		}
		u=fa[top[u]];
	}
	return -1;
}

void print(){
	for(int i=1;i<=n;i++)cout<<f[i]<<" ";puts("");
}

bool is_anc(int u,int v){return dfn[u]<=dfn[v]&&dfn[v]<=dfn[u]+sz[u]-1;}

}T1,T2;

Tree A1,A2;

auto QRY(int u,int v){
	int z1=A1.LCA(u,v),z2=A2.LCA(u,v);
	return make_tuple(A1.qry(u,z1),A1.qry(z1,v),A2.qry(u,z2),A2.qry(z2,v));
}

set<int>S;

struct Oper{
	int op;
	int u,v;
	int i,id,t;
};
vector<Oper>ops;

void Qry(int u,int v){
	Oper nw;
	nw.op=1,nw.u=u,nw.v=v;
	ops.emplace_back(nw);
}

ll tmp[8];
void Add(int i,int id){
	Oper nw;
	nw.op=2,nw.i=i,nw.id=id;
	ops.emplace_back(nw);
}
void Del(int i,int id){
	Oper nw;
	nw.op=3,nw.i=i,nw.id=id;
	ops.emplace_back(nw);
}
void Add2(int i,int t,int u,int v){
	Oper nw;
	nw.op=4,nw.i=i,nw.u=u,nw.v=v,nw.t=t;
	ops.emplace_back(nw);
}
void Del2(int i,int t,int u,int v){
	Oper nw;
	nw.op=5,nw.i=i,nw.u=u,nw.v=v,nw.t=t;
	ops.emplace_back(nw);
}
void Abs(int i){
	Oper nw;
	nw.op=8,nw.i=i;
	ops.emplace_back(nw);
}

void Mdf(int t,int u,int i){
	Oper nw;
	nw.op=6,nw.u=u,nw.i=i,nw.t=t;
	ops.emplace_back(nw);
}
void Clr(){
	Oper nw;
	nw.op=7;
	ops.emplace_back(nw);
}

int d[4];
void DO(Oper nw){
	if(nw.op==1){
		cin>>d[0]>>d[1]>>d[2]>>d[3];
		// auto [x,y,z,t]=QRY(nw.u,nw.v);
		// d[0]=x,d[1]=y,d[2]=z,d[3]=t;
	}
	if(nw.op==2)tmp[nw.i]+=d[nw.id];
	if(nw.op==3)tmp[nw.i]-=d[nw.id];
	if(nw.op==4)tmp[nw.i]+=(nw.t==1?T1.qry(nw.u,nw.v):T2.qry(nw.u,nw.v));
	if(nw.op==5)tmp[nw.i]-=(nw.t==1?T1.qry(nw.u,nw.v):T2.qry(nw.u,nw.v));
	if(nw.op==6){
		if(nw.t==1)T1.mdf(nw.u,tmp[nw.i]);
		if(nw.t==2)T2.mdf(nw.u,tmp[nw.i]);
	}
	if(nw.op==7)memset(tmp,0,sizeof(tmp));
	if(nw.op==8)tmp[nw.i]=abs(tmp[nw.i]);
}

void ins(int u){
	if(T2.In[u]){
		int v=T1.fa[u];
		cout<<"? "<<u<<" "<<v<<'\n';
		
		Qry(u,v);
		Add(1,0);
		Mdf(1,u,1);
		Clr();

		T2.ins2(u),T1.ins(u,0);
		return;
	}

	auto it=S.insert(T2.dfn[u]).first;int p=-1;
	if(it!=S.begin()){
		int z=T2.LCA(T2.idfn[*prev(it)],u);
		if(z!=u&&(!T2.In[z]))p=z;
	}
	if(++it!=S.end()){
		int z=T2.LCA(u,T2.idfn[*it]);
		if(z!=u&&(!T2.In[z]))p=z;
	}

	if(p!=-1){
		S.insert(T2.dfn[p]);

		int v=-1,vv=-1;
		for(int q:T2.G[p]){
			v=T2.getpos_3(q),vv=T2.getpos_1(q);
			if(v!=-1)break;
		}

		assert(v!=-1);

		cout<<"? "<<u<<" "<<v<<'\n';
		Qry(u,v);

		// int w1=a+b-T1.qry(T1.fa[u],v);
		// T1.mdf(u,w1);
		Add(1,0),Add(1,1),Del2(1,1,T1.fa[u],v),Mdf(1,u,1);

		int r=T2.getf_1(p);
		// int w3=d-T2.qry(v,vv);
		Add(3,3),Del2(3,2,v,vv);
		if(r!=-1){
			Add2(2,2,r,v),Del(2,3);
			// int w2=T2.qry(r,v)-d;
			// T2.mdf(p,w2);
			Mdf(2,p,2);
		}
		Add(4,2),Mdf(2,u,4);
		Mdf(2,vv,3);
		// T2.mdf(u,c);
		// T2.mdf(vv,w3);

		T1.ins(u,1),T2.ins(u,1),T2.ins(p,0);
	}
	else{
		int r=T2.getf_1(u),s=-1,ss=-1;
		for(int q:T2.G[u]){
			s=T2.getpos_1(q);
			if(s!=-1)break;
		}
		int v=T1.root;
		
		cout<<"? "<<u<<" "<<v<<'\n';
		Qry(u,v);

		Add(1,0),Add(1,1),Del2(1,1,T1.fa[u],v),Mdf(1,u,1);

		// int w2=0,w3=0;
		// if(r!=-1)w2=abs(T2.qry(v,r)-c-d);
		// if(s!=-1)w3=abs(c+d-T2.qry(s,v));
		// if(r!=-1)T2.mdf(u,w2);
		// if(s!=-1)T2.mdf(s,w3);

		if(r!=-1)Add2(2,2,v,r),Del(2,2),Del(2,3),Abs(2);
		if(s!=-1)Add2(3,2,s,v),Del(3,2),Del(3,3),Abs(3);
		if(r!=-1)Mdf(2,u,2);
		if(s!=-1)Mdf(2,s,3);

		T1.ins(u,1),T2.ins(u,1);
	}
	Clr();
}

int qq;

signed main(void){

// #ifndef ONLINE_JUDGE
// 	freopen("in.txt","r",stdin);
// #endif

	cin>>n>>k>>qq>>q;
	vector<int>Fa(n+1);
	for(int i=1;i<=n;i++)cin>>Fa[i];T1.build(Fa);
	for(int i=1;i<=n;i++)cin>>Fa[i];T2.build(Fa);
	
	vector<int>nodes(n);
	for(int i=1;i<=n;i++)nodes[i-1]=i;
	sort(nodes.begin(),nodes.end(),[&](int x,int y){return T1.dep[x]<T1.dep[y];});

	for(int i=0;i<k;i++)cout<<nodes[i]<<" \n"[i==k-1];
	T1.ins(nodes[0],0),T2.ins(nodes[0],1),S.insert(T2.dfn[nodes[0]]);
	for(int i=1;i<k;i++)ins(nodes[i]);
	cout<<"!"<<endl;

	for(auto nw:ops)DO(nw);

	vector<pair<int,int> >Qs(q);
	for(int _=0;_<q;_++)cin>>Qs[_].fi>>Qs[_].se;
	for(int _=0;_<q;_++){
		auto [u,v]=Qs[_];
		cout<<T1.qry(u,v)<<" "<<T2.qry(u,v);
		if(_<q-1)cout<<'\n';
	}
	cout<<endl;

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 977ms
memory: 712328kb

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: 1069ms
memory: 722392kb

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: 936ms
memory: 635588kb

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 408863 290951 335954 196742 462604 270393 410420 343790 170589 339454 360585 475865 272971 435584 146602 416115 277513 19586 262337 153299 451326 242721 281222 497922 284958 322708 210925 209977 217066 138968 88518 461231 424964 239423 113460 119995 227377 99942 461746 310464 390469 37637 257...

result:

ok good job!

Test #4:

score: 0
Accepted
time: 904ms
memory: 631124kb

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 376032 252875 107945 204315 497883 300480 244893 453571 260986 480811 111424 1449 84000 412829 288415 465966 280824 40773 195220 39044 238722 82457 140337 204997 250564 211177 190581 172186 134521 197827 402014 95 197733 168162 225182 434002 23111 215838 307381 393149 448813 134779 301850 438...

result:

ok good job!

Test #5:

score: 0
Accepted
time: 945ms
memory: 642848kb

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 321237 42291 74889 306341 486608 189433 427525 51583 101922 407895 91845 271298 407800 338533 19229 156054 483318 415653 4033 474491 444649 210462 376047 494879 378821 490989 115579 49438 13847 331936 477727 282984 17686 439333 358089 162159 488602 1871 53000 68494 419889 190894 191069 473503 ...

result:

ok good job!

Test #6:

score: 0
Accepted
time: 966ms
memory: 653756kb

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 65697 47747 111706 66936 450513 26617 372367 330203 394458 209286 400826 243217 31977 451749 188117 490312 400064 243665 17878 377213 326862 393825 451432 420037 338802 25540 79427 427346 482110 463407 365280 324697 419374 343913 166743 374407 461047 50003 203244 119601 191816 96053 246607 14...

result:

ok good job!

Test #7:

score: 0
Accepted
time: 981ms
memory: 653972kb

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 292285 412347 131882 111814 156219 35390 381302 362286 329939 9722 373863 429048 151412 273121 237666 311400 172713 204978 20522 443479 290480 358105 376930 237978 297105 326538 492305 172116 474574 390969 223728 157831 85371 347566 34874 24933 163517 222554 426614 217598 62652 260605 419414 ...

result:

ok good job!

Test #8:

score: 0
Accepted
time: 938ms
memory: 650784kb

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 170991 92100 359470 139432 324408 453335 431734 262646 131622 62857 396138 246698 516 494280 18454 248742 268964 118545 365411 494550 478761 441872 268796 49116 205579 466197 270875 135573 434345 212775 228269 308679 54000 238351 328689 52558 58520 429984 73730 113837 344036 406044 164637 150...

result:

ok good job!

Test #9:

score: 0
Accepted
time: 901ms
memory: 638320kb

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 339735 183834 376658 452229 17602 242546 346708 15990 178549 413417 152620 26152 238198 111146 321012 417544 92787 155902 255908 437303 489642 161208 250265 271077 410527 494372 131419 296924 273690 194916 314748 451578 446428 269101 48263 79427 144608 454898 404212 484266 430464 12313...

result:

ok good job!

Test #10:

score: 0
Accepted
time: 977ms
memory: 639620kb

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 36690 181174 90854 463947 187429 294313 368772 145889 75237 133402 212224 337250 110576 431598 402240 14400 170562 253826 91393 231984 99545 339912 406858 472157 341596 66314 226717 375831 366225 426791 85796 37615 206457 124357 489662 385009 374386 208302 125119 433017 402221 7458 208...

result:

ok good job!

Test #11:

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

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 66900 383176 368448 402234 30912 450187 162271 408329 426848 356934 209420 141370 472144 58228 168493 340153 305883 279866 426896 208921 393563 160445 453638 495482 273356 463758 272686 434877 256224 72417 213507 307331 95710 67650 161729 232320 89792 316528 205514 331074 191101 290707...

result:

ok good job!

Test #12:

score: 0
Accepted
time: 958ms
memory: 638644kb

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 92225 92574 225485 263307 477335 399857 180932 192694 278429 261363 232151 456530 180268 371909 136846 258860 359086 288537 497074 471775 184539 128242 103322 292962 440872 438625 491029 169019 278238 348936 235068 308538 4364 74229 105052 35177 313527 391125 19305 5289 367203 280534 3...

result:

ok good job!

Subtask #2:

score: 25
Accepted

Test #13:

score: 25
Accepted
time: 1149ms
memory: 736820kb

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: 0
Accepted
time: 951ms
memory: 705144kb

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: 0
Accepted
time: 967ms
memory: 641196kb

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 196673 306329 42912 402073 177329 120173 6636 146621 149822 5586 101299 160942 71664 150901 337562 114759 128206 142984 474649 413290 358091 371829 428580 342964 220830 116507 452341 228337 51245 32783 487049 246389 89423 230211 403613 209440 28815 415656 145716 471285 228800 144079 37841 996...

result:

ok good job!

Test #16:

score: 0
Accepted
time: 1084ms
memory: 675556kb

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 251476 126474 19446 78956 330406 230127 303094 214663 285173 378280 206155 54328 40604 493479 58729 351467 99615 261076 291867 347905 295746 24400 490883 323735 397380 69120 349354 459170 133456 38410 114348 287627 95185 359539 196356 423664 418234 177804 32573 254320 172626 438298 98444 1725...

result:

ok good job!

Test #17:

score: 0
Accepted
time: 985ms
memory: 645632kb

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 322066 56701 140828 212415 351948 146174 404885 279542 158833 12243 206524 424242 425070 23112 399383 345052 37619 459435 126003 377680 55013 247407 39601 480253 86073 466658 368488 37555 95558 294671 184223 212451 122024 492590 71133 53868 150437 101910 390713 70070 182101 445051 408118 33754...

result:

ok good job!

Test #18:

score: 0
Accepted
time: 971ms
memory: 651228kb

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 221656 146589 249128 205582 492809 319077 195934 206910 349185 226168 179590 175113 140953 463382 2067 477415 216732 421309 34723 119761 25291 12987 15015 398951 104719 431870 294441 152208 202883 329745 387372 377081 9827 134042 212275 31436 488227 110900 204562 357778 97123 395349 1136 2205...

result:

ok good job!

Test #19:

score: 0
Accepted
time: 1115ms
memory: 681904kb

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 388339 142119 387737 379154 7720 438979 160377 95069 297454 183857 65202 341476 192505 155114 270016 6304 190447 134067 190035 491157 291771 388001 381828 276457 260044 148999 212236 250251 2631 165561 360660 212793 129861 177381 71057 227398 47615 178382 157019 328371 423887 224877 377462 64...

result:

ok good job!

Test #20:

score: 0
Accepted
time: 1072ms
memory: 686308kb

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 180905 18894 292021 291449 397859 262116 177744 473204 326573 54826 82047 131353 230546 463055 339924 161773 450018 56308 117212 361368 196921 114559 297546 459956 93847 206851 62953 9831 435432 394189 263311 31191 388882 282611 359583 12308 375306 473522 439659 407175 24180 336625 209577 3745...

result:

ok good job!

Test #21:

score: 0
Accepted
time: 1112ms
memory: 682200kb

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 63082 470955 129565 450288 442458 358841 191779 107198 158632 184396 5815 55091 353688 121854 267206 93001 237560 240934 226522 378535 412921 429418 421211 14221 440544 387129 383117 161867 95594 109058 419196 380719 352732 254553 322895 380893 213588 463821 397258 265070 361754 287885 253341 1...

result:

ok good job!

Test #22:

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

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 65271 161964 47481 362251 439209 361016 481152 419045 359791 439941 152048 251663 382643 328392 287474 93651 153014 317755 235999 40624 209457 140688 188084 315212 475776 369964 118882 124418 16318 95940 70365 106976 21140 178517 4203 473149 351646 222862 365258 242976 459435 401220 468...

result:

ok good job!

Test #23:

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

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 296484 166724 94041 369728 282876 368886 260510 224751 111997 228866 462355 83300 219738 379704 153993 161843 196715 461982 40160 13108 20656 317787 407214 352816 179989 161493 324595 485744 103461 194267 228027 247793 222205 438372 394817 158709 189395 482630 56770 271812 451974 23604 343070...

result:

ok good job!

Test #24:

score: 0
Accepted
time: 1120ms
memory: 677796kb

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 476713 253876 365161 308196 139670 394646 214562 482199 164637 45240 158118 85089 357407 204347 117233 33896 222759 278841 411557 398810 159347 52166 62708 150235 234380 412710 477521 310935 368629 402468 459828 250671 412076 101214 325491 255570 222606 182240 404466 287694 324857 135688 1408...

result:

ok good job!

Subtask #3:

score: 19
Accepted

Test #25:

score: 19
Accepted
time: 726ms
memory: 674744kb

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: 0
Accepted
time: 712ms
memory: 672032kb

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: 0
Accepted
time: 620ms
memory: 600932kb

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 440862 35769 47059 415081 391557 168027 343625 414959 400057 13677 176688 306911 165077 279783 270672 60938 151672 153463 153847 280120 482691 151522 299948 5238 38524 427895 39246 114335 478023 8963 307415 220771 5442 199042 294421 476929 163009 59252 127451 251549 360073 229303 216331 47700...

result:

ok good job!

Test #28:

score: 0
Accepted
time: 613ms
memory: 605568kb

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 177257 385797 366136 26405 239523 33465 331260 109300 451322 415294 135825 114874 101559 87153 407875 56 223629 293705 108867 339845 424117 455357 81451 444912 499758 59412 316123 422294 468102 253871 268791 268641 316190 316808 94463 382723 73797 432299 57373 477549 363522 108679 342707 2421...

result:

ok good job!

Test #29:

score: 0
Accepted
time: 603ms
memory: 608604kb

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 68796 164757 176269 430554 207040 17063 237483 5142 210445 413120 375117 2312 250983 236388 124218 40404 32277 85370 108255 206943 261233 289158 331848 65180 38580 486858 493146 340616 415750 319967 23088 319007 319361 21080 104901 42183 329114 107774 89310 74635 48678 328197 267940 325240 16...

result:

ok good job!

Test #30:

score: 0
Accepted
time: 691ms
memory: 613484kb

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 103768 15183 151681 241619 156748 142193 351937 343344 307544 75760 337186 154434 462630 145963 194524 257139 401939 186069 103384 171959 7330 131588 372225 282828 271825 226536 153029 327265 273141 166004 46297 166544 303746 379130 265437 449256 485597 434764 357232 82283 109652 148925 218423...

result:

ok good job!

Test #31:

score: 0
Accepted
time: 681ms
memory: 611152kb

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 356177 50228 54227 83927 335718 242991 184774 410874 33442 478655 284118 105746 282065 318234 440527 139187 494185 171779 272019 313856 100050 242743 252784 304506 473379 497489 458685 494637 351579 355976 446292 386968 162619 257752 440095 411506 38102 243324 202564 338308 153916 489690 3768...

result:

ok good job!

Test #32:

score: 0
Accepted
time: 662ms
memory: 615476kb

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 292076 290894 164955 33120 348991 429337 121606 310606 333664 495421 215704 256615 409181 314619 493051 415023 285951 199707 483873 291088 411774 273848 414483 39651 74615 374861 454153 47465 236892 447138 92053 199386 468407 402888 474057 240655 421805 80 331242 109132 483798 166568 77165 38...

result:

ok good job!

Test #33:

score: 0
Accepted
time: 638ms
memory: 609076kb

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 432969 156418 453894 352805 89362 133486 419699 263734 379086 438351 352881 14630 115217 223484 142120 385899 173663 144381 358921 449218 144072 143836 185536 221089 129236 2607 174093 5466 425274 22153 43456 97517 271629 454852 146110 263786 110783 317359 215381 215788 45816 434005 47383 2545...

result:

ok good job!

Test #34:

score: 0
Accepted
time: 639ms
memory: 615904kb

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 363817 107853 159961 416919 304117 495851 255246 282144 71548 64682 91691 164743 397926 235627 461451 497306 198517 379862 85005 161416 188316 498428 372889 350465 278270 412763 278953 58142 494660 267214 162923 466162 361413 259485 278862 198286 240966 472118 234282 274213 25871 50662 253059...

result:

ok good job!

Test #35:

score: 0
Accepted
time: 630ms
memory: 613168kb

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 46664 293638 121308 167449 197749 193963 351439 274757 391057 419411 464217 34251 262432 298251 300081 100899 16879 252661 129613 382347 482776 214606 176259 221836 482072 301903 185726 441719 441533 66594 217099 497791 409008 2084 178755 453049 332842 79483 168470 308515 391051 190094 93149 ...

result:

ok good job!

Test #36:

score: 0
Accepted
time: 622ms
memory: 611540kb

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 38497 20711 72353 419620 127782 455085 13158 45628 159629 443181 131972 45068 27446 469398 141700 37855 413366 13192 361343 357342 304657 457351 303613 366918 207219 467687 110210 139282 126874 445881 141991 303 30471 444932 125602 145344 20307 154072 238514 379205 50672 368057 47945 63330 33...

result:

ok good job!

Subtask #4:

score: 22
Accepted

Test #37:

score: 22
Accepted
time: 1526ms
memory: 788972kb

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: 0
Accepted
time: 1567ms
memory: 796656kb

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: 0
Accepted
time: 1243ms
memory: 649436kb

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 647427 533982 897949 883077 430038 191938 967051 803085 491289 98015 966440 666341 727175 550258 679164 238703 577417 769441 322713 571723 990732 542037 235360 522192 549731 242089 24411 760514 955552 645969 18455 457677 24412 47999 467388 809574 679275 410496 63172 726045 739890 174561 16614...

result:

ok good job!

Test #40:

score: 0
Accepted
time: 1243ms
memory: 647320kb

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 706069 844180 644365 232392 472501 228913 176856 171129 900175 61244 999835 936090 700398 722999 838346 272721 890963 793831 323136 9955 343315 272524 991634 614617 793593 9479 754175 388362 785502 846531 506411 633258 366957 656348 255594 509834 182393 59314 210546 786264 770149 307028 45977...

result:

ok good job!

Test #41:

score: 0
Accepted
time: 1220ms
memory: 645256kb

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 722680 731460 654344 109866 65234 377592 851905 313544 887847 369772 202435 100734 846431 869187 751379 494337 56719 768679 13212 334090 445056 362189 780924 575768 6885 692947 795777 162396 790249 799711 516394 735721 861934 499615 846856 711537 919510 763267 851121 225246 158083 125537 3221...

result:

ok good job!

Test #42:

score: 0
Accepted
time: 1424ms
memory: 673044kb

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 309869 791834 964452 943915 84832 244780 41073 204106 279963 906069 135723 371138 909131 847384 564868 313416 65092 844843 424439 343447 318576 814166 656253 958833 512238 544950 346750 592730 528104 520479 319514 973353 771247 22110 256349 842420 249104 453198 656866 700254 722422 892382 6294...

result:

ok good job!

Test #43:

score: 0
Accepted
time: 1399ms
memory: 675288kb

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 891858 37707 466070 742398 202105 977879 391174 425609 462955 985622 121343 434810 36802 899944 315724 314905 986524 861623 268661 364973 524493 589742 86027 395552 289489 236417 772548 222185 145327 704569 509163 478017 324130 88987 462649 415619 212703 833742 54136 390076 510162 664024 1504...

result:

ok good job!

Test #44:

score: 0
Accepted
time: 1389ms
memory: 675020kb

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 124871 138676 990585 4585 865873 971471 771298 63490 935802 502177 106700 663016 523261 190965 556995 623707 556971 708015 543388 614244 725340 320862 739519 324672 53714 539839 621522 538193 593769 715849 502372 45803 486096 941071 782316 764919 707767 548332 422122 129446 246156 432047 2949...

result:

ok good job!

Test #45:

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

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 872282 312077 61427 968485 205149 893364 193655 750917 934622 637422 100191 574350 998885 83544 309989 39710 310872 367766 879688 906291 868881 882328 351039 408034 11856 142316 27500 394991 55560 221450 81349 565129 98452 851004 996072 612755 588621 41247 240069 34651 300491 493327 781422 22...

result:

ok good job!

Test #46:

score: 0
Accepted
time: 1296ms
memory: 673244kb

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 735823 205689 607603 626443 867877 972483 611322 301731 556764 424400 533754 565458 956179 974676 591265 603332 919264 495199 709062 354229 533339 402828 615629 846412 5921 427579 76143 525422 823708 205943 985709 270075 303098 209727 552989 92234 858119 76627 809416 671508 934406 467521 5955...

result:

ok good job!

Test #47:

score: 0
Accepted
time: 1279ms
memory: 672896kb

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 221358 90990 381110 419462 361510 936783 334948 816421 788692 384022 29879 518409 280929 99754 120333 958310 297367 143475 272173 753237 783134 210749 960586 613154 595826 775274 315233 974597 315223 138452 841341 569103 589267 216833 112443 749983 124812 847032 796978 412457 664870 870918 31...

result:

ok good job!

Test #48:

score: 0
Accepted
time: 1282ms
memory: 672936kb

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 219333 436262 459224 278141 210053 787475 79875 765666 823176 464060 13031 610892 723049 847609 165574 848011 263069 310127 672293 241745 189740 74990 66730 381899 973192 776349 902264 932117 680592 973008 82428 300405 305621 199670 127044 294037 397450 218452 183205 356152 781118 489810 3800...

result:

ok good job!

Subtask #5:

score: 24
Accepted

Dependency #4:

100%
Accepted

Test #49:

score: 24
Accepted
time: 1907ms
memory: 854176kb

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: 0
Accepted
time: 1901ms
memory: 858104kb

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: 0
Accepted
time: 1550ms
memory: 682672kb

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 217791 975717 486044 258220 218071 327494 824367 319556 5819 267754 279533 479262 459808 249425 944310 268784 141356 28197 868536 766810 574502 911656 438517 676722 681281 549076 82901 664833 403506 305782 278567 391862 875104 46386 486621 706497 397920 227126 429492 593275 230175 320607 5839...

result:

ok good job!

Test #52:

score: 0
Accepted
time: 1718ms
memory: 714132kb

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 822069 942183 127200 964379 593058 338013 216803 446207 259233 509803 494333 979652 626565 844783 344620 616296 332403 689721 801696 215476 72098 998498 937257 496985 344811 204341 640440 952018 511177 441388 979161 164601 861539 815224 282073 319362 951741 85606 439359 194816 713735 874828 1...

result:

ok good job!

Test #53:

score: 0
Accepted
time: 1550ms
memory: 679148kb

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 632078 484305 894227 524221 529126 411057 814714 310119 146587 623466 5130 419761 357931 451512 785417 451392 643600 889624 415889 603961 833589 133742 142566 221454 451229 570210 851920 43651 251861 253108 643674 113672 502017 856119 375489 823140 581607 135475 865494 114694 287039 50109 991...

result:

ok good job!

Test #54:

score: 0
Accepted
time: 1908ms
memory: 742384kb

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 616832 493517 229041 460157 253514 108538 384634 83431 677648 927716 956524 319752 312484 983868 948471 626065 545508 728026 274093 354799 52298 446324 356198 433165 423337 895849 30841 147246 449026 136193 624630 666147 364143 373929 879307 633968 505335 693107 326189 583805 223625 502...

result:

ok good job!

Test #55:

score: 0
Accepted
time: 1718ms
memory: 711632kb

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 601911 289012 77769 762767 450556 777515 419167 601060 80563 522881 538127 935059 579595 152293 728860 41130 580716 999075 619465 291977 550166 792757 559233 751731 304671 635993 565086 539717 419906 328290 566317 226358 130700 488729 675202 946594 597119 273807 925480 949775 219462 574873 67...

result:

ok good job!

Test #56:

score: 0
Accepted
time: 1865ms
memory: 745896kb

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 959546 334225 264657 620619 366808 849678 231242 82334 223664 535225 204770 663253 790299 77724 416882 680483 313641 253377 132553 732514 495601 55205 847907 597862 733879 160184 264751 608628 754994 281147 787193 92089 995568 751818 925481 428739 213786 115932 434365 804865 131257 173084 201...

result:

ok good job!

Test #57:

score: 0
Accepted
time: 1712ms
memory: 717356kb

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 279955 398137 390219 535025 774210 501471 472923 674349 979990 573085 156822 265188 218323 565793 756925 545184 916927 453150 932111 331850 314638 558172 623701 418511 439600 157647 510850 544017 858331 51802 938896 535813 363967 585351 277743 686452 995484 120476 973867 985056 841393 43125 8...

result:

ok good job!

Test #58:

score: 0
Accepted
time: 1695ms
memory: 711348kb

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 359020 417140 959456 501109 411252 461101 487482 944862 59941 491248 278664 894259 457941 17616 480084 883361 257051 397152 637715 207595 184914 762412 374739 792401 894659 388618 978032 184153 703705 341582 59919 321712 768958 811139 447980 253072 680759 528013 510558 763464 133015 916814 97...

result:

ok good job!

Test #59:

score: 0
Accepted
time: 1674ms
memory: 713556kb

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 593372 816493 517423 831179 580684 953347 501012 90668 318421 334490 778995 493998 874846 384462 794437 177147 529498 817676 873777 33984 575047 979193 141029 97862 435602 651863 231756 501826 708749 448738 62534 852900 925209 486575 285566 69588 557383 715823 274369 245874 381075 967497 3351...

result:

ok good job!

Test #60:

score: 0
Accepted
time: 1782ms
memory: 737112kb

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 88343 903845 71385 497179 523892 1235 550534 2052 635779 956182 206544 162803 400596 708942 675581 353231 128495 941346 637303 161265 95996 814987 86398 282601 174074 666072 994984 917007 578402 268317 58246 905690 850708 641562 358549 120541 368754 522425 847347 388450 778842 127959 931938 2...

result:

ok good job!

Extra Test:

score: 0
Extra Test Passed