QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#715404#9492. 树上简单求和WrongAnswer_9030 5471ms99528kbC++237.8kb2024-11-06 11:51:422024-11-06 11:51:42

Judging History

This is the latest submission verdict.

  • [2024-11-06 11:51:42]
  • Judged
  • Verdict: 30
  • Time: 5471ms
  • Memory: 99528kb
  • [2024-11-06 11:51:42]
  • Submitted

answer

#include<bits/stdc++.h>
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define ll long long
#define lll __int128
#define fi first
#define se second
#define e emplace
#define eb emplace_back
#define db double
#define ef emplace_front
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>
#define vp vector<pii>
#define vt vector<tup>
#define all(x) x.begin(),x.end()
#define mp make_pair

#define FastI
#define FastO
//#define int ll
bool ST;
static const ll MOD=1e9+9,Phi=998244352,inv2=499122177,Root=3,iRoot=332748118;
static const ll inf=1073741823,Inf=4294967296,INF=4557430888798830399;
static const ld eps=1e-9,pi=3.1415926535;
char in[1<<20],*p1=in,*p2=in;
char out[1<<20],*p3=out;
using namespace std;
struct tup
{
	int x,y,z;
	tup(int X=0,int Y=0,int Z=0)
	{x=X,y=Y,z=Z;}
	inline bool operator <(const tup t)const
	{return x<t.x||(x==t.x&&y<t.y)
	||(x==t.x&&y==t.y&&z<t.z);}
};
#ifdef FastI
#define getchar() (p1==p2&&(p2=(p1=in)+fread(in,1,1<<20,stdin),p1==p2)?EOF:*p1++)
#endif
#ifdef FastO
#define putchar(x) (p3-out==1<<20?fwrite(out,1,1<<20,stdout),p3=out,0:0,*p3++=x)
#define puts(x) write(x,'\n')
#endif
namespace FastIO
{
	template<typename T> inline void write(T x,char ch=' ')
	{
		if(is_same<char,T>::value)putchar(x);
		else
		{
			if(x<0)x=-x,putchar('-');
			static char st[40];
			int top=0;
			do st[top++]=x%10+'0',x/=10;while(x);
			while(top)putchar(st[--top]);
		}
		ch!='~'?putchar(ch):0;
	}
	inline void write(const char*x,char ch=' ')
	{
		for(int i=0;x[i]!='\0';++i)putchar(x[i]);
		ch!='~'?putchar(ch):0;
	}
	inline void read(char&s){do s=getchar();while(s=='\n'||s==' ');}
	inline void read(char s[])
	{
		int len=0;char st;
		do st=getchar();while(st=='\n'||st==' ');
		s[++len]=st,st=getchar();
		while(st!='\n'&&st!=' '&&st!='\r'&&st!='\0')s[++len]=st,st=getchar();
		s[++len]='\0';
	}
	template<typename T> inline void read(T &s)
	{
		char ch=getchar();s=0;
		while((ch>'9'||ch<'0')&&ch!='-')ch=getchar();
		bool tf=(ch=='-'&&(ch=getchar()));
		while(ch>='0'&&ch<='9')s=(s<<1)+(s<<3)+ch-'0',ch=getchar();
		s=tf?-s:s;
	}
	inline void edl(){putchar('\n');}
	template<typename T1,typename T2> inline void read(pair<T1,T2> &s){read(s.fi),read(s.se);}
	template<typename T,typename...Args> inline void write(T x,Args...args){write(x,'~'),write(args...);}
	template<typename T,typename...Args> inline void read(T&x,Args&...args){read(x),read(args...);}
	#ifdef FastO
	struct Writer{~Writer(){fwrite(out,1,p3-out,stdout);}}Writ;
	#endif
}
using namespace FastIO;
namespace MTool
{
	inline int Cadd(int a,int b){return (ll)a+b>=MOD?(ll)a+b-MOD:a+b;}
	inline int Cdel(int a,int b){return a-b<0?a-b+MOD:a-b;}
	inline int Cmul(int a,int b){return 1ll*a*b%MOD;}
	inline int sqr(int a){return 1ll*a*a%MOD;}
	inline void Madd(int&a,int b){a=((ll)a+b>=MOD?(ll)a+b-MOD:a+b);}
	inline void Mdel(int&a,int b){a=(a-b<0?a-b+MOD:a-b);}
	inline void Mmul(int&a,int b){a=1ll*a*b%MOD;}
	inline int Cmod(int x){return (x%MOD+MOD)%MOD;}
	inline void Mmod(int&x){x=(x%MOD+MOD)%MOD;}
	template<typename T> inline bool Mmax(T&a,T b){return a<b?a=b,1:0;}
	template<typename T> inline bool Mmin(T&a,T b){return a>b?a=b,1:0;}
	template<typename...Args> inline void Madd(int&a,int b,Args...args){Madd(a,b),Madd(a,args...);}
	template<typename...Args> inline void Mmul(int&a,int b,Args...args){Mmul(a,b),Mmul(a,args...);}
	template<typename...Args> inline void Mdel(int&a,int b,Args...args){Mdel(a,b),Mdel(a,args...);}
	template<typename...Args> inline int Cadd(int a,int b,Args...args){return Cadd(Cadd(a,b),args...);}
	template<typename...Args> inline int Cmul(int a,int b,Args...args){return Cmul(Cmul(a,b),args...);}
	template<typename...Args> inline int Cdel(int a,int b,Args...args){return Cdel(Cdel(a,b),args...);}
	template<typename...Args,typename T> inline bool Mmax(T&a,T b,Args...args){return Mmax(a,b)|Mmax(a,args...);}
	template<typename...Args,typename T> inline bool Mmin(T&a,T b,Args...args){return Mmin(a,b)|Mmin(a,args...);}
	inline int power(int x,int y){int s=1;for(;y;y>>=1,Mmul(x,x))if(y&1)Mmul(s,x);return s;}
}
using namespace MTool;
namespace WrongAnswer_90
{
	int n,m;
	int len,c[200010];
	ull a[200010],s[200010],ans[200010],cont[200010];
	int p[200010],top[200010];
	bool vis[200010],ins[200010];
	vp ve[200010];
	namespace DS
	{
		const int BB=450;
		ull v[200010],tg[510];
		int b[200010];
		inline void init()
		{
			for(int i=1;i<=n;++i)b[i]=(i-1)/BB+1;
		}
		inline void add(int x,ull y)
		{
			if(!x)return;
			for(int i=x;b[i]==b[x];--i)v[i]+=y;
			for(int i=1;i<b[x];++i)tg[i]+=y;
		}
		inline ull ask(int x){return v[x]+tg[b[x]];}
	}
	using namespace DS;
	struct Tree
	{
		vi T[200010];
		int tot,dfn[200010],F[17][200010],siz[200010],Fa[200010];
		void dfs(int x,int fa=0)
		{
			dfn[x]=++tot;
			siz[x]=1;
			Fa[x]=F[0][tot]=fa;
			for(auto to:T[x])if(to!=fa)
			dfs(to,x),siz[x]+=siz[to];
		}
		inline int get(int x,int y){return dfn[x]<dfn[y]?x:y;}
		inline int LCA(int x,int y)
		{
			if(x==y)return x;
			if((x=dfn[x])>(y=dfn[y]))swap(x,y);
			int k=__lg(y-x++);
			return get(F[k][x],F[k][y-(1<<k)+1]);
		}
		void init()
		{
			dfs(1);
			for(int i=1;i<17;++i)for(int j=1;j+(1<<i)-1<=n;++j)
			F[i][j]=get(F[i-1][j],F[i-1][j+(1<<(i-1))]);
		}
	}T1,T2;
	inline ull get(int id){return ask(T1.dfn[id])-ask(T1.dfn[id]+T1.siz[id]);}
	void dfs0(int x,int fa=0)
	{
		top[x]=top[fa];
		if(vis[x])top[x]=x;
		s[x]+=a[x];
		for(auto to:T2.T[x])if(to!=fa)
		s[to]=s[x],dfs0(to,x);
	}
	void dfs1(int x,int fa=0)
	{
		c[++len]=x;
		for(auto to:T1.T[x])if(to!=fa)
		dfs1(to,x);
	}
	ull query(int x)
	{
		ull s=0;
		while(!vis[x])s+=get(x),x=T2.Fa[x];
		return s;
	}
	struct Node
	{
		int x,y,lca1,lca2;
		ull z;
		Node(int _x=0,int _y=0,ull _z=0,int _lca1=0,int _lca2=0)
		{x=_x,y=_y,z=_z,lca1=_lca1,lca2=_lca2;}
	}q[200010];
	mt19937 rnd(time(0));
	inline int rd(int l,int r){return l+rnd()%(r-l+1);}
	const int B=1500;
	void mian()
	{
		int x,y;
		ull z;
		
		read(n,m);
		for(int i=1;i<=n;++i)read(a[i]);
		for(int i=1;i<n;++i)read(x,y),T1.T[x].eb(y),T1.T[y].eb(x);
		for(int i=1;i<n;++i)read(x,y),T2.T[x].eb(y),T2.T[y].eb(x);
		DS::init();
		T1.init(),T2.init();
		for(int i=1;i<=n;++i)p[i]=i,swap(p[rd(1,i)],p[i]);
		for(int i=1;i<=min(n,B);++i)vis[p[i]]=1;
		vis[0]=1;
		dfs0(1),dfs1(1);
//		cerr<<s[1]<<" "<<s[3]<<" "<<s[2]<<endl;
//		cerr<<a[1]<<" "<<a[3]<<" "<<a[2]<<endl;
		
		int lca1,lca2;
		db sum=0;
		for(int i=1;i<=m;++i)
		{
			read(x,y,z);
			lca1=T1.LCA(x,y);
			lca2=T2.LCA(x,y);
			q[i]=Node(x,y,z,lca1,lca2);
			add(T1.dfn[x],z),add(T1.dfn[y],z);
			add(T1.dfn[lca1],-z),add(T1.dfn[T1.Fa[lca1]],-z);
			ans[i]=s[x]+s[y]-2*s[lca2]+a[lca2];
			db st=clock();
			ans[i]+=query(x)+query(y)-query(lca2)-query(T2.Fa[lca2]);
			sum+=clock()-st;
			ve[top[x]].eb(mp(i,1));
			ve[top[y]].eb(mp(i,1));
			ve[top[lca2]].eb(mp(i,-1));
			ve[top[T2.Fa[lca2]]].eb(mp(i,-1));
		}
//		cerr<<sum<<endl;
//		exit(0);
		for(int i=1;i<=min(n,B);++i)
		{
			x=p[i];
			memset(ins,0,sizeof(ins));
			while(x)ins[x]=1,x=T2.Fa[x];
			for(int j=1;j<=n;++j)cont[c[j]]=cont[T1.Fa[c[j]]]+ins[c[j]];
			int j=0;
			ull tmp=0;
			for(auto [k,v]:ve[p[i]])
			{
				while(j<k)
				{
					++j;
					tmp+=(cont[q[j].x]+cont[q[j].y]-cont[q[j].lca1]-cont[T1.Fa[q[j].lca1]])*q[j].z;
				}
				ans[k]+=tmp*v;
			}
		}
		for(int i=1;i<=m;++i)write(ans[i],'\n');
	}
	inline void Mian()
	{
		int T=1;
//		read(T);
		while(T--)mian();
	}
}
bool ED;
signed main()
{
//	ios::sync_with_stdio(0);
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	double st=clock();
	WrongAnswer_90::Mian();
	double ed=clock();
 	cerr<<endl;
 	cerr<<"Time: "<<ed-st<<" ms\n";
 	cerr<<"Memory: "<<abs(&ST-&ED)/1024.0/1024.0<<" MB\n";
	return 0;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 18ms
memory: 52240kb

input:

3000 3000
7236742292501328495 17973811477309806363 16075782662531676171 17971236571771878676 11392080645527132110 3685563455925680459 9773593720088356683 8313828403245053795 7736401634567449043 1634817828009987181 6951124933529719486 12775126714635387213 15460977209223753216 397573676785925632 31372...

output:

12105153858659381124
18367442707572066757
11668241962484097878
11288238120352358472
1742468310074622166
9942835997686093671
3305677510569607477
17741602000425004088
14984128302052618266
1075081718074605786
6509217537832509095
16750513627843273113
8569443169249732820
14475184194298579044
156111071108...

result:

ok 3000 lines

Test #2:

score: 5
Accepted
time: 18ms
memory: 52116kb

input:

3000 3000
1612333876155866602 8538417838700679227 6080765231437578796 17905224638340228394 12270907925903144224 17944105326358594564 17302041033966840611 1006351124625222126 496336153231744288 9393087977687876980 9553975238547373621 9361882717200384390 15051881329169144319 9757999873162420435 882725...

output:

11133131376095771981
7909873024850695144
16250639243139481926
14562550655578101207
8274205996508264973
178549413271904466
2368406276743327913
7464009386554813982
9439464815411774627
1471756740732097060
15201641099137019227
6774030298556871576
18156105511913219667
1553508745644446823
4225137078364117...

result:

ok 3000 lines

Test #3:

score: 5
Accepted
time: 24ms
memory: 52384kb

input:

3000 3000
9709246061666095435 1861649101703072889 10620139893353930613 17635186539135419482 710209455559527146 6075101384669982511 1120305006358459674 9703156967435388252 1397046737759839382 5259056712870179169 8253156305433022999 710199693203327302 15130650033641744675 10720111924616886955 15543351...

output:

7834604406305153073
5037061270969117785
16481572776620825702
15177894197606565804
3120320619896892806
18008650876379132344
7417108723176816402
13515164814425439399
3299769942258542105
15897528270699011770
11642805469843844638
16764682282380318054
4824039114054405772
4859834102876213962
1234210473247...

result:

ok 3000 lines

Test #4:

score: 5
Accepted
time: 19ms
memory: 54396kb

input:

3000 3000
16538965545220923528 18062192327708400751 10422465150728338588 3471522151129113073 1236650672072793692 1942240200040301168 13090729759591037952 15335798523677372669 9912100622761466753 11177948788405690381 3710859061697501523 4984944638666762977 17278589713462878008 6371292801024547050 868...

output:

8182453933067329108
13535217473847106938
17067385337010269798
3806121648880466130
11322569288575153037
11079197311131660121
9670138330007803226
6554062218199796758
965954569567598779
18055887214749050688
6142620503089407421
8690117812667761187
9547139298346295115
8890987597519353054
1755036654049586...

result:

ok 3000 lines

Test #5:

score: 5
Accepted
time: 19ms
memory: 52252kb

input:

3000 3000
17759588706587888497 10550000524636484378 11601004513528075994 7150322911283804521 4459707248078569712 10692395730842402625 8940418793863522991 12967068928670540447 9954278250450015940 13702413838608801301 10598390500439869870 15110245227553613794 490862872212325709 15164980555660957366 94...

output:

9743736929788175512
16812303667256960040
14694223512340829897
550204232580650311
1175342872438242313
17622261358285047637
7413682703975031220
12643066512274062227
1868985217436232595
5471830334855681322
8070132260376389587
3970361922096052085
218281824643752746
991917103472727104
2960248244218479023...

result:

ok 3000 lines

Subtask #2:

score: 12
Accepted

Dependency #1:

100%
Accepted

Test #6:

score: 12
Accepted
time: 0ms
memory: 40932kb

input:

5 7
0 3 2 6 4
1 2
2 4
1 5
5 3
3 4
4 2
2 5
5 1
5 3 0
3 2 5
4 4 4
4 4 3
5 2 0
3 4 3
5 5 6

output:

15
21
10
13
17
26
18

result:

ok 7 lines

Test #7:

score: 12
Accepted
time: 601ms
memory: 71220kb

input:

70000 70000
3805295436278888199 9842309351516174725 1566744796319231180 2206519284152256579 2715928675931950447 6346821976624501261 16020972671480798719 14702021753902144915 17127828773798978442 15779168055669690475 4964561323934614661 9395102787554964450 6377076753365184543 15167378195767668817 288...

output:

5971729064136092190
6457394048987305727
13604212649915736394
8639973959364892219
437861319070967556
16133076880026962355
5384937395694479961
4591478439775690843
16071919565966962790
15485626634068969082
10235993901046758372
3449528613427081475
8064280362779764074
12784984512326434905
424951714880051...

result:

ok 70000 lines

Test #8:

score: 12
Accepted
time: 590ms
memory: 76152kb

input:

70000 70000
17769190865915081913 3772925482507158804 10559962993069063712 16307277356502651642 12014171661057147061 1923543107882042577 13408785599350410314 17786178374951015816 2038922879833426794 2540043772647346461 15419977514837351390 5175974305273838292 16815288359165841441 6295059675346852046 ...

output:

16215781699519408534
17067966839552063165
1639359200259068228
1157756671621253300
12850966537933214537
13917563606289473282
11146906493479190751
869141055866285398
529460535280965984
11437720548737856517
12321579881011015953
4005153170897692243
10217866116994297464
8892403813874757974
12520505236760...

result:

ok 70000 lines

Test #9:

score: 12
Accepted
time: 600ms
memory: 75036kb

input:

70000 70000
1322605819855709761 1534349070722535975 3956030287626175223 12996546673549161162 7258680666490714729 15591023033141410544 11626890152249303179 7745771567168540351 5535931029756133379 11840793767439557739 6286106656048048381 9490665709724541446 4561258384162386434 2460318488748442222 1303...

output:

7565012138645637258
1080785033897684285
4000254219257999844
8727142139647715419
1784876728989450460
2474052717732723820
5108017366064709316
5232698473118606856
7893212823648229982
6449010654774296779
16571818815110297674
603759348329356530
7364528294111530037
4667545362378304836
3039728935129459889
...

result:

ok 70000 lines

Test #10:

score: 12
Accepted
time: 723ms
memory: 72596kb

input:

70000 70000
2918414982140182939 1004760492603077644 7526656799259998488 6665485253854847449 7752199419154649757 12763267823077347079 11745132191692540338 6726116817426709990 15550876907005962464 9760509858122842638 684733892856965421 10077915441058780247 8380400329996723109 16920573433866702239 3069...

output:

8230389499860859172
16425656898047941538
107743004356580170
9778122844868660722
11068387722102791183
13252614309136720348
15937842372230698728
12777338070107774364
17974062134369145560
3740400391792770609
7367804332878038809
14236246024207211797
5659238205278608512
10550373456364765526
3478082332928...

result:

ok 70000 lines

Test #11:

score: 12
Accepted
time: 885ms
memory: 74588kb

input:

70000 70000
14167059704556856337 16190708842842354431 16763990539754009056 7631426709261583690 16701377874952853623 13128000186728267818 13668914249103068169 11444044591715948726 461080622438520919 15327533341012334586 15905150558482528923 18113008235210277231 18273290154232335325 871461822812191943...

output:

5416890687002400795
15434184693210288436
14994504916760087024
2057026449542829151
14782289435774270062
5375237679514404106
6242405047854012647
13176621545709355733
14860610197328732602
2320525143444929350
4955538191022622551
16072981679771537209
16493487770453132249
7457010288198365370
1095949888193...

result:

ok 70000 lines

Test #12:

score: 12
Accepted
time: 409ms
memory: 71600kb

input:

70000 70000
6512290618577097706 2307104154841663907 18099814251235047570 8297332016606109910 6979819983598849680 18022671181330012408 7003320957516774041 10765303713874539785 15263207007138552812 11713955610641877995 9084887894280210904 3653718255996209121 14197591595561260765 2937670413926210256 43...

output:

5372775214253596890
927985558228810546
3829815088328182672
17496384540548895622
2541458359607440535
9685902106698191409
13649653134779075960
2952563488513208867
3457470079648848247
11542323450217419837
6576344363223624061
12316990756988470568
17923006133291073450
13069551524451668138
648013229980407...

result:

ok 70000 lines

Test #13:

score: 12
Accepted
time: 503ms
memory: 71308kb

input:

70000 70000
13665984219894847790 9458613748861462697 7467746948118990839 10855454155004540952 10025433108785732161 15816172836312183738 2834129139700401667 221649423184372325 8409217794427284711 16119623676185869010 12488380095384700010 3049877130176336551 5805665682633632307 13224802542929355280 18...

output:

7934210059911784858
14305091721658406168
5803801684631217062
8806866881905382618
14997911434771439753
7006465422324293550
15394754861139766679
8377831978907312075
12227086919743533414
8784212755151945751
17039860679476902214
6474495685436520748
11136139762939837997
16869294577244011226
1164744311638...

result:

ok 70000 lines

Subtask #3:

score: 13
Accepted

Dependency #2:

100%
Accepted

Test #14:

score: 13
Accepted
time: 2303ms
memory: 83156kb

input:

120000 120000
4056283459929576306 2264755903151268173 1157390036441353969 5734735320959854923 6025999163810189446 3972481234804681969 4746636248696530169 6716674455256322787 6407347371842702902 7463142557880503801 208361219405474896 512530621977574257 6488145455921761864 6595856237657889728 95997703...

output:

11686658894480913739
10283716998652647869
7469817527336516079
9879285786875030762
4982549977394044949
16564334076086174008
6433057925981833441
7460470339844352254
9945354316570680900
18377735143728853940
15872286040534058104
8507347369923543553
308747406436979607
18218197459972943141
177225056570719...

result:

ok 120000 lines

Test #15:

score: 13
Accepted
time: 2283ms
memory: 83092kb

input:

120000 120000
5867632904403891095 7734115005912544376 13901514937742085110 17141033381317351710 17988246451665298411 17540600012243810041 15190868862458266725 15454563456231559301 8740470882859091311 17882360629171437337 12095218884748126199 17817518168343018595 7112391591378197276 65538601378146110...

output:

13420129597746517056
18337642296188485079
4380067206814687930
5525410739012465159
1979575298167242590
10855827974711636510
9874020479466690595
17720000790164899934
16724816545805525287
15594891417371432986
14655386085151616523
11435247647009150363
7635358811289719984
14609735500036643833
13339404812...

result:

ok 120000 lines

Test #16:

score: 13
Accepted
time: 1299ms
memory: 78936kb

input:

120000 120000
12590795589408290093 11275909154009220197 10996087245163181988 287253987689120747 522028471439816976 5251098397309018220 9466903789635983479 12562504698210775380 14359608006525868271 12860739587215060171 6110493152041264342 8941951597283806533 7247902667356706183 13908919237133011991 1...

output:

12568574963997891813
9761481874717599084
9748193662109666281
17759229044598540251
9232146611495947992
16451851566322082145
10163587939420717881
11939061140179225100
13555756814075457024
15331444302135124578
12404089960631589833
10914316315261843243
3330610810849167077
4308673861372384247
22214038984...

result:

ok 120000 lines

Test #17:

score: 13
Accepted
time: 811ms
memory: 82004kb

input:

120000 120000
16014732670888203993 17003360764706956461 4309217563402934767 12155136955819956058 9472943536135969437 8619903067520668384 8532935983471178458 840596314384730622 8808409849265669508 16268252642839060126 8703458878963184072 14133056030074803107 16125379684339605436 13795196609771489642 ...

output:

14157083647705042191
9626539498588941455
12672590587667741319
7637586779842324001
17945793757619266709
6486513804042528016
17128439522931715545
14506773931432125656
10149598925465005229
8493513931817247270
9843224754697262936
17563138715401598781
5251652421620155711
16347886781065131205
141775307219...

result:

ok 120000 lines

Test #18:

score: 13
Accepted
time: 1946ms
memory: 78400kb

input:

120000 120000
3799726989717681598 2540658873004706851 6999377479951345208 4574847538261052797 1388764904624490347 797597442974571877 12049698136986117426 1334073669070317189 11812534794423707083 12910806883079537898 8919907966949030320 3609251437048437267 6955259073591432492 1913761510032208708 1536...

output:

16410218753178084291
3452125570141203996
12637348475870430626
939828522750114530
6181904502892064992
7530673907543931274
11125835388154440123
1132493328298594689
6540415366631312545
10171022468601061874
10785984448364782773
15132462728937914062
13894055239781007518
14553135357399426810
1058534365058...

result:

ok 120000 lines

Test #19:

score: 13
Accepted
time: 1634ms
memory: 80144kb

input:

120000 120000
523123731336918243 4097858622836674571 1961367823237386001 2725250184116707092 15256083167104925470 8826573328357841773 14551942275839683916 4676612813711946771 16866097649532049020 16028370234860808559 16550040875881081238 13114506992715113111 18223636920754369434 4711187061384408363 ...

output:

13171866584326858355
7378923635054867195
4676544939953182559
8211313138413629930
3762100382261198154
17376905504590956432
11575432112253285846
6651270238220236939
7296214239679292747
3921715204635211841
13514446212830941534
14681462832343839777
9394758474079991863
2039117273115115478
162036285844685...

result:

ok 120000 lines

Test #20:

score: 13
Accepted
time: 1191ms
memory: 77412kb

input:

120000 120000
16563527794956746492 3507607345845239151 6704373347302736722 4366660651585002614 17477711326324414919 14064904073416411127 1886265819461820151 1530962154006256458 3386801749967932412 10176358119958383434 14136333004424650089 18047845530334381646 14290290829566494165 1979382774616512004...

output:

2687063429907612648
7246290134975359576
451523845887078136
6787443537167049842
11742387638116508426
9452080235999660003
1640133015384348445
9479626460563956802
8536081354965239985
14886879078945984440
5977814891978138604
16811290642393481835
2319291536056800936
4327858711873466013
508236457787094527...

result:

ok 120000 lines

Subtask #4:

score: 0
Wrong Answer

Test #21:

score: 0
Wrong Answer
time: 1678ms
memory: 87576kb

input:

200000 200000
622783158027686223 2242697872372232537 8481648430436878777 10092474834140799044 15403999682625301609 12614289513474949582 9180944589267018841 7823784919308285798 8257785171198951273 5134508521895120821 8041682272181381093 3835432206618893170 2653803171409877650 5589823419153460372 1007...

output:

6971998134198664028
11611293489264521142
5835924579879681322
2861807851240422939
14339416497951219777
700814297877824402
8325533829178393328
1356782756358710563
1053141240424881043
6500693987870518249
13043750024385337442
15305655005871179140
7709472453943207944
14287702771569615553
1638968086636232...

result:

wrong answer 1st lines differ - expected: '9042998055336671259', found: '6971998134198664028'

Subtask #5:

score: 0
Wrong Answer

Test #27:

score: 0
Wrong Answer
time: 5471ms
memory: 96788kb

input:

200000 200000
1958469220619413759 14991498002015735322 6054491201406941902 18206143187746582567 15082377615826460430 2936248617457291604 10073577150351675920 16534472678586906457 2207599132486246393 10301540360769075442 1492580560381080472 551692353431379140 13238280352539145808 8462626987240986565 ...

output:

15274063521509460493
10757142436288261906
6788663598253106219
4947458746475345589
8656050929520058908
13956300241102744164
6617618906888093095
1449888819999967120
6071595654178013535
1381925643615725675
11012085704271380405
18139659052120893757
7517830995029766809
3300266856805567674
136161410922609...

result:

wrong answer 1st lines differ - expected: '11479812171669345085', found: '15274063521509460493'

Subtask #6:

score: 0
Wrong Answer

Test #34:

score: 0
Wrong Answer
time: 2540ms
memory: 99528kb

input:

200000 200000
6794776813641982926 1561596256197101737 10910039723053043515 7892247858295192798 12233819960547881004 17695389034783066733 9173201689566865598 17626618141377486739 7358781671024283919 6787559733384974662 3884392438269280436 14872846228351316833 9037842441501571648 14299818404271084016 ...

output:

5519324519442957729
13462861144392030499
13475486865438194684
4148979398311169421
8384527935231032070
16512016873725670736
13867297907038176506
10296428352441857103
15654304415409320656
7404566644919251615
9870876264015800597
6356224262148620783
249874952637342736
9023132497407647441
141617598536753...

result:

wrong answer 3rd lines differ - expected: '8898301730697138469', found: '13475486865438194684'

Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%