QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#386212#7455. stcmOccDreamerAC ✓276ms44248kbC++143.7kb2024-04-11 14:06:152024-04-11 14:06:15

Judging History

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

  • [2024-04-11 14:06:15]
  • 评测
  • 测评结果:AC
  • 用时:276ms
  • 内存:44248kb
  • [2024-04-11 14:06:15]
  • 提交

answer

//code by Emissary
#include<bits/stdc++.h>

#define vc vector
#define db double
#define fi first
#define se second
#define ll long long
#define mk make_pair
#define pb push_back
#define RI register int
#define PI pair<int,int>
#define ull unsigned long long
#define err cerr << "   -_-   " << endl
#define debug cerr << " ------------------- " << endl

#define input(x) freopen(#x".in","r",stdin)
#define output(x) freopen(#x".out","w",stdout)

#define NO puts("No")
#define YES puts("Yes")

//#define OccDreamer
//#define int long long

using namespace std;

namespace IO{
	inline int read(){
		int X=0, W=0; char ch=getchar();
		while(!isdigit(ch)) W|=ch=='-', ch=getchar();
		while(isdigit(ch)) X=(X<<1)+(X<<3)+(ch^48), ch=getchar();
		return W?-X:X;
	}
	inline void write(int x){
		if(x<0) x=-x, putchar('-');
		if(x>9) write(x/10);
		putchar(x%10+'0');
	}
	inline void sprint(int x){write(x), putchar(32);}
	inline void eprint(int x){write(x), putchar(10);}
}using namespace IO;

const int MAXN = 5e6+5;

int tot, All;
int node, lc[MAXN], rc[MAXN];
int son[MAXN], siz[MAXN], fa[MAXN];
int n, id[MAXN], toid[MAXN], topf[MAXN];
int head[MAXN], ne[MAXN<<1], to[MAXN<<1], cnt;

struct huff{
	int x, sz;
	inline bool friend operator < (const huff &x, const huff &y){return x.sz>y.sz;}
};

inline void Del(){putchar('-');}
inline void Add(int x){putchar('+'); write(x);}
inline void report(int x){putchar('='); write(x);}

inline void add(int x, int y){++cnt;to[cnt]=y;ne[cnt]=head[x];head[x]=cnt;}

inline void dfs1(int x, int f){
	siz[x]=1; fa[x]=f; son[x]=0;
	for(int i=head[x];i;i=ne[i]){
		if(to[i]==f) continue;
		dfs1(to[i],x); siz[x]+=siz[to[i]];
		if(siz[to[i]]>siz[son[x]]) son[x]=to[i];	
	}
	return ;
}

inline void dfs2(int x, int tp){
	topf[x]=tp; id[x]=++tot; toid[tot]=x;
	if(son[x]) dfs2(son[x],tp);
	for(int i=head[x];i;i=ne[i]){
		if(to[i]==fa[x] || to[i]==son[x]) continue;	
		dfs2(to[i],to[i]);
	}
}	

inline void addtree(int x){
	for(int i=id[x];i<=id[x]+siz[x]-1;++i) Add(toid[i]);
	return ;	
}

inline void deltree(int x){
	for(int i=id[x];i<=id[x]+siz[x]-1;++i) Del();
	return ;
}

inline void Run(int now);

inline void construct(int x){
	report(x);
	for(int i=head[x];i;i=ne[i]){
		if(to[i]==son[x]) continue;
		addtree(to[i]);	
	}
	Add(x);
	if(son[x]) construct(son[x]);
	Del();
	for(int i=head[x];i;i=ne[i]){
		if(to[i]==son[x]) continue;
		deltree(to[i]);	
	}
	if(topf[x]==x){
		priority_queue<huff> Q;
		int now=x;
		while(now){
			Add(now);
			for(int i=head[now];i;i=ne[i]){
				if(to[i]==son[now]) continue;
				Q.push(huff{to[i],siz[to[i]]});
			}
			now=son[now];
		}
		if(Q.size()){
			if(Q.size()==1) construct(Q.top().x);
			else{
				while(Q.size()>=2){
					huff A, B;
					A=Q.top(); Q.pop();
					B=Q.top(); Q.pop();	
					++node; lc[node]=A.x; rc[node]=B.x; Q.push(huff{node,A.sz+B.sz});
				}
				Run(Q.top().x);
			}
		}
		now=x;
		while(now){
			Del();
			now=son[now];	
		}
	}
}

inline void adddfs(int x){
	if(x<=n) addtree(x);
	if(lc[x]) adddfs(lc[x]);
	if(rc[x]) adddfs(rc[x]);
	return ;	
}

inline void deldfs(int x){
	if(x<=n) deltree(x);
	if(lc[x]) deldfs(lc[x]);
	if(rc[x]) deldfs(rc[x]);
	return ;	
}

inline void Run(int x){
	if(x<=n) construct(x);
	else{
		adddfs(rc[x]);
		Run(lc[x]); deldfs(rc[x]); adddfs(lc[x]);
		Run(rc[x]); deldfs(lc[x]);
	}
	return ;
}
	
inline void solve(){
	int x; tot=0; All=0; node=n;
	for(int i=1;i<=n;++i) head[i]=0, lc[i]=rc[i]=0; cnt=0;
	for(int i=2;i<=n;++i) x=read(), add(x,i);
	dfs1(1,0); dfs2(1,1); construct(1);
	putchar('!'); putchar(10);
}	

signed main(){
	while(scanf("%d",&n)!=EOF) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 41ms
memory: 26448kb

input:

1000
1 1 2 1 1 2 2 7 2 7 3 11 10 6 4 8 10 13 16 2 19 7 6 18 6 2 16 27 21 14 6 14 14 29 12 13 3 27 28 27 2 34 26 27 44 14 30 25 7 50 47 1 36 24 4 32 10 20 53 52 61 23 43 39 2 15 47 9 14 54 48 53 36 14 14 66 76 55 17 67 21 22 18 25 67 75 7 48 21 6 35 11 31 41 63 28 6 98 51 3 29 52 102 77 27 58 39 64 9...

output:

=1+569+772+243+494+882+812+940+177+441+570+732+773+968+727+435+905+754+323+665+980+426+206+843+798+622+412+53+73+136+468+523+691+873+650+175+590+619+129+994+778+60+531+195+6+15+67+238+250+304+348+877+658+553+496+420+871+789+655+438+292+376+568+853+733+608+975+86+152+200+501+929+810+795+378+422+947+1...

result:

ok 11660 / 543316 / 537198

Test #2:

score: 0
Accepted
time: 214ms
memory: 27112kb

input:

100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

=1+99999+99998+99997+99996+99995+99994+99993+99992+99991+99990+99989+99988+99987+99986+99985+99984+99983+99982+99981+99980+99979+99978+99977+99976+99975+99974+99973+99972+99971+99970+99969+99968+99967+99966+99965+99964+99963+99962+99961+99960+99959+99958+99957+99956+99955+99954+99953+99952+99951+999...

result:

ok 1968890 / 2195854 / 2098556

Test #3:

score: 0
Accepted
time: 204ms
memory: 33940kb

input:

100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

=1+99999+99998+99997+99996+99995+99994+99993+99992+99991+99990+99989+99988+99987+99986+99985+99984+99983+99982+99981+99980+99979+99978+99977+99976+99975+99974+99973+99972+99971+99970+99969+99968+99967+99966+99965+99964+99963+99962+99961+99960+99959+99958+99957+99956+99955+99954+99953+99952+99951+999...

result:

ok 1968890 / 2258982 / 1649822

Test #4:

score: 0
Accepted
time: 190ms
memory: 39860kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

=1+96265+78531+74750+22990+64808+14298+84286+83950+11723+17997+84809+82171+79119+71468+70493+67008+66737+65239+40239+95626+94310+85782+15815+89033+43600+35789+1=2+98407+96113+77957+2=3+93291+78171+46017+26643+53297+48174+20655+30176+60501+38765+35736+57682+57436+37049+32839+27290+76275+65634+52948+1...

result:

ok 1706844 / 1390737 / 2053659

Test #5:

score: 0
Accepted
time: 170ms
memory: 26688kb

input:

100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 95 33 47 4 54 83 22 90 98 51 7 58 66 61 73 42 15 68 90 88 98 13 96 96 40 21 70 82 22 12 87 100 ...

output:

=1+100+99632+99578+99561+99515+99512+99381+99231+99173+99085+99047+99033+98906+98797+98726+98684+98668+98596+98591+98526+98493+98402+98329+98139+98076+98031+98012+97937+97889+97646+97435+97430+97377+97336+97008+97003+96733+96602+96320+96116+95721+95685+95631+95619+95486+95300+95250+95180+95114+94970...

result:

ok 2064466 / 2050783 / 1958144

Test #6:

score: 0
Accepted
time: 170ms
memory: 30912kb

input:

100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

=1+10000+13721+97117+84124+80188+73393+86267+75170+64835+41979+16866+84513+12142+87816+10852+9999+20803+98541+76273+71607+89892+53778+53004+37747+32602+25613+96824+70871+16698+9998+86388+73001+70042+47178+46164+45192+34367+13051+9997+96293+65765+54371+21474+10461+9996+24705+90647+86673+35768+34338+2...

result:

ok 1904078 / 1979103 / 1997372

Test #7:

score: 0
Accepted
time: 174ms
memory: 28524kb

input:

100000
1 1 1 1 1 1 1 1 1 7 2 3 11 4 9 5 6 9 10 6 10 3 6 6 7 7 6 4 7 6 7 8 4 7 9 8 8 9 6 4 9 4 9 10 4 2 8 9 9 7 4 5 3 10 8 6 6 8 7 8 7 7 11 2 7 11 6 5 8 6 4 5 10 7 10 11 11 3 4 8 9 7 11 11 3 3 9 6 2 6 3 2 5 10 11 9 6 2 6 8 10 11 3 6 8 3 3 8 6 5 6 3 3 4 7 8 11 7 11 6 2 9 7 8 5 4 11 9 5 4 7 10 10 9 7 3...

output:

=1+94508+93102+80056+65544+61456+10+27467+86856+86604+81769+81317+71975+60697+59997+59992+59981+59968+59951+59948+59914+59913+59909+59900+59897+59893+59891+59890+59855+59851+59848+59845+59844+59829+59811+59799+59789+59785+59784+59764+59742+59741+59714+59713+59711+59709+59684+59679+59659+59650+59639+...

result:

ok 1984884 / 2297144 / 2239929

Test #8:

score: 0
Accepted
time: 169ms
memory: 30792kb

input:

100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 13 13 1...

output:

=1+19+199+1999+19999+19998+19997+19996+19995+19994+19993+19992+19991+19990+1998+19989+19988+19987+19986+19985+19984+19983+19982+19981+19980+1997+19979+19978+19977+19976+19975+19974+19973+19972+19971+19970+1996+19969+19968+19967+19966+19965+19964+19963+19962+19961+19960+1995+19959+19958+19957+19956+1...

result:

ok 2217692 / 2137788 / 2132345

Test #9:

score: 0
Accepted
time: 175ms
memory: 30840kb

input:

100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

=1+599+598+597+596+595+594+593+592+591+590+589+588+587+586+585+584+583+582+581+580+579+578+577+576+575+574+573+572+571+570+569+568+567+566+565+564+563+562+561+560+559+558+557+556+555+554+553+552+551+550+549+548+547+546+545+544+543+542+541+540+539+538+537+536+535+534+533+532+531+530+529+528+527+526+5...

result:

ok 2067820 / 2064236 / 2059992

Test #10:

score: 0
Accepted
time: 191ms
memory: 40392kb

input:

100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

=1+19999+19998+19997+19996+19995+19994+19993+19992+19991+19990+19989+19988+19987+19986+19985+19984+19983+19982+19981+19980+19979+19978+19977+19976+19975+19974+19973+19972+19971+19970+19969+19968+19967+19966+19965+19964+19963+19962+19961+19960+19959+19958+19957+19956+19955+19954+19953+19952+19951+199...

result:

ok 2042270 / 1978841 / 1398909

Test #11:

score: 0
Accepted
time: 212ms
memory: 44248kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

=1+100000+1=2+50001+2=3+50002+3=4+50003+4=5+50004+5=6+50005+6=7+50006+7=8+50007+8=9+50008+9=10+50009+10=11+50010+11=12+50011+12=13+50012+13=14+50013+14=15+50014+15=16+50015+16=17+50016+17=18+50017+18=19+50018+19=20+50019+20=21+50020+21=22+50021+22=23+50022+23=24+50023+24=25+50024+25=26+50025+26=27+5...

result:

ok 1034446 / 1778909 / 1911909

Test #12:

score: 0
Accepted
time: 267ms
memory: 32332kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

=1+100000+99000+98000+97000+96000+95000+94000+93000+92000+91000+90000+89000+88000+87000+86000+85000+84000+83000+82000+81000+80000+79000+78000+77000+76000+75000+74000+73000+72000+71000+70000+69000+68000+67000+66000+65000+64000+63000+62000+61000+60000+59000+58000+57000+56000+55000+54000+53000+52000+51...

result:

ok 1949909 / 1963209 / 1967009

Test #13:

score: 0
Accepted
time: 276ms
memory: 30052kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 1 2 3 4 5 6 7 8 ...

output:

=1+100000+99950+99900+99850+99800+99750+99700+99650+99600+99550+99500+99450+99400+99350+99300+99250+99200+99150+99100+99050+99000+98950+98900+98850+98800+98750+98700+98650+98600+98550+98500+98450+98400+98350+98300+98250+98200+98150+98100+98050+98000+97950+97900+97850+97800+97750+97700+97650+97600+97...

result:

ok 1967959 / 1968529 / 1968719

Test #14:

score: 0
Accepted
time: 265ms
memory: 35004kb

input:

100000
1 2 3 4 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4...

output:

=1+100000+99995+99990+99985+99980+99975+99970+99965+99960+99955+99950+99945+99940+99935+99930+99925+99920+99915+99910+99905+99900+99895+99890+99885+99880+99875+99870+99865+99860+99855+99850+99845+99840+99835+99830+99825+99820+99815+99810+99805+99800+99795+99790+99785+99780+99775+99770+99765+99760+99...

result:

ok 1968814 / 1968871 / 1548892

Test #15:

score: 0
Accepted
time: 121ms
memory: 38172kb

input:

100000
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 11 6 23 24 25 26 27 28 29 30 31 6 23 24 25 26 27 28 29 30 31 32 27 44 45 46 47 48 49 50 51 52 27 44 45 46 47 48 49 50 51 52 53 48 65 66 67 68 69 70 71 72 73 48 65 66 67 68 69 70 71 72 73 74 69 86 87 88 89 90 91 92 93 94 69 86 87 88 89 90 91 92 93 94 9...

output:

=1+12+1=2+13+2=3+14+3=4+15+4=5+16+5=6+33+17+7+8+9+10+11+22+21+20+19+18+6=23+34+23=24+35+24=25+36+25=26+37+26=27+54+38+28+29+30+31+32+43+42+41+40+39+27=44+55+44=45+56+45=46+57+46=47+58+47=48+75+59+49+50+51+52+53+64+63+62+61+60+48=65+76+65=66+77+66=67+78+67=68+79+68=69+96+80+70+71+72+73+74+85+84+83+82...

result:

ok 1411682 / 1371998 / 1327559

Test #16:

score: 0
Accepted
time: 114ms
memory: 34336kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

=1+302+1=2+303+2=3+304+3=4+305+4=5+306+5=6+307+6=7+308+7=8+309+8=9+310+9=10+311+10=11+312+11=12+313+12=13+314+13=14+315+14=15+316+15=16+317+16=17+318+17=18+319+18=19+320+19=20+321+20=21+322+21=22+323+22=23+324+23=24+325+24=25+326+25=26+327+26=27+328+27=28+329+28=29+330+29=30+331+30=31+332+31=32+333+...

result:

ok 1284189 / 1240178 / 1180853

Test #17:

score: 0
Accepted
time: 134ms
memory: 36544kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

=1+10002+1=2+10003+2=3+10004+3=4+10005+4=5+10006+5=6+10007+6=7+10008+7=8+10009+8=9+10010+9=10+10011+10=11+10012+11=12+10013+12=13+10014+13=14+10015+14=15+10016+15=16+10017+16=17+10018+17=18+10019+18=19+10020+19=20+10021+20=21+10022+21=22+10023+22=23+10024+23=24+10025+24=25+10026+25=26+10027+26=27+10...

result:

ok 1134386 / 1548892 / 817787

Test #18:

score: 0
Accepted
time: 146ms
memory: 33928kb

input:

100000
1 1 1 4 4 4 4 4 9 10 10 10 10 14 14 14 14 14 14 14 14 22 23 24 25 26 27 27 29 30 30 30 33 34 35 36 36 38 38 40 40 40 40 44 44 44 47 47 49 49 49 49 49 54 54 56 57 57 59 59 61 61 63 64 65 65 67 67 67 70 71 71 71 71 75 75 75 75 75 75 75 75 83 83 85 85 85 88 89 89 91 91 91 91 95 96 97 98 98 98 10...

output:

=1+3+2+1=4+8+7+6+5+4=9+9=10+13+12+11+10=14+21+20+19+18+17+16+15+14=22+22=23+23=24+24=25+25=26+26=27+28+27=29+29=30+32+31+30=33+33=34+34=35+35=36+37+36=38+39+38=40+43+42+41+40=44+46+45+44=47+48+47=49+53+52+51+50+49=54+55+54=56+56=57+58+57=59+60+59=61+62+61=63+63=64+64=65+66+65=67+69+68+67=70+70=71+74...

result:

ok 1516384 / 2270916 / 2143832

Test #19:

score: 0
Accepted
time: 173ms
memory: 38956kb

input:

100000
1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 32 33 33 33 33 33 33 39 40 40 42 42 42 42 42 42 42 49 50 50 50 50 50 50 56 57 58 59 59 59 59 59 64 65 65 65 65 69 69 69 69 69 69 69 69 69 69 69 80 80 82 82 82 82 82 82 88 89 89 89 89 89 89 95 95 95 95 99 99 99 99 99 99 105 105 105 ...

output:

=1+8+7+6+5+4+3+2+1=9+31+30+29+28+27+26+25+24+23+22+21+20+19+18+17+16+15+14+13+12+11+10+9=32+32=33+38+37+36+35+34+33=39+39=40+41+40=42+48+47+46+45+44+43+42=49+49=50+55+54+53+52+51+50=56+56=57+57=58+58=59+63+62+61+60+59=64+64=65+68+67+66+65=69+79+78+77+76+75+74+73+72+71+70+69=80+81+80=82+87+86+85+84+8...

result:

ok 1486305 / 1341073 / 1465913

Test #20:

score: 0
Accepted
time: 174ms
memory: 32056kb

input:

100000
1 1 3 3 3 3 3 3 3 3 3 3 3 14 14 14 14 14 14 20 20 20 20 24 25 26 26 26 26 26 26 26 26 26 35 35 37 37 37 37 37 37 37 37 37 46 47 47 47 47 47 52 53 53 53 53 53 53 53 53 61 61 63 63 63 63 63 68 68 70 71 71 71 71 71 76 77 78 79 79 81 81 81 81 85 86 87 87 87 87 87 87 87 87 87 96 97 97 97 97 97 102...

output:

=1+2+1=3+13+12+11+10+9+8+7+6+5+4+3=14+19+18+17+16+15+14=20+23+22+21+20=24+24=25+25=26+34+33+32+31+30+29+28+27+26=35+36+35=37+45+44+43+42+41+40+39+38+37=46+46=47+51+50+49+48+47=52+52=53+60+59+58+57+56+55+54+53=61+62+61=63+67+66+65+64+63=68+69+68=70+70=71+75+74+73+72+71=76+76=77+77=78+78=79+80+79=81+8...

result:

ok 1633092 / 1831390 / 2013583

Test #21:

score: 0
Accepted
time: 158ms
memory: 29236kb

input:

100000
1 1 3 3 5 5 5 5 9 9 9 12 12 12 15 15 15 15 19 19 19 19 19 24 25 25 25 25 25 30 31 31 33 33 35 35 37 37 39 39 39 39 43 44 44 44 47 48 48 50 50 50 53 53 53 53 57 57 57 60 60 62 62 62 62 62 62 62 62 62 62 62 62 74 74 74 74 74 74 74 74 74 83 84 84 84 84 84 89 90 91 91 91 94 95 96 96 98 99 99 101 ...

output:

=1+2+1=3+4+3=5+8+7+6+5=9+11+10+9=12+14+13+12=15+18+17+16+15=19+23+22+21+20+19=24+24=25+29+28+27+26+25=30+30=31+32+31=33+34+33=35+36+35=37+38+37=39+42+41+40+39=43+43=44+46+45+44=47+47=48+49+48=50+52+51+50=53+56+55+54+53=57+59+58+57=60+61+60=62+73+72+71+70+69+68+67+66+65+64+63+62=74+82+81+80+79+78+77+...

result:

ok 2124232 / 2226006 / 2238961

Test #22:

score: 0
Accepted
time: 147ms
memory: 28424kb

input:

100000
1 1 3 3 3 3 3 3 3 10 10 10 10 10 10 16 17 17 17 20 21 21 23 23 23 23 23 23 23 30 31 32 32 34 34 36 36 38 38 38 41 42 43 43 45 45 45 48 48 48 48 52 52 54 55 55 55 55 59 59 61 62 62 62 65 66 66 66 66 66 71 72 72 74 74 76 77 78 79 80 81 81 83 83 85 86 86 86 86 86 91 92 93 93 95 95 95 95 95 100 1...

output:

=1+2+1=3+9+8+7+6+5+4+3=10+15+14+13+12+11+10=16+16=17+19+18+17=20+20=21+22+21=23+29+28+27+26+25+24+23=30+30=31+31=32+33+32=34+35+34=36+37+36=38+40+39+38=41+41=42+42=43+44+43=45+47+46+45=48+51+50+49+48=52+53+52=54+54=55+58+57+56+55=59+60+59=61+61=62+64+63+62=65+65=66+70+69+68+67+66=71+71=72+73+72=74+7...

result:

ok 2248166 / 2256435 / 2268767

Test #23:

score: 0
Accepted
time: 136ms
memory: 32692kb

input:

100000
1 1 3 3 3 3 3 8 8 10 11 12 12 14 14 14 14 14 14 20 21 21 21 21 25 25 25 25 25 30 30 30 30 30 35 35 35 38 38 38 38 42 42 42 45 46 46 46 46 50 50 50 53 53 53 53 53 53 53 53 53 62 63 63 63 63 67 67 67 70 70 70 73 74 75 76 77 78 79 80 81 81 81 80 85 85 85 80 89 89 89 92 79 94 95 95 95 94 99 99 99...

output:

=1+2+1=3+7+6+5+4+3=8+9+8=10+10=11+11=12+13+12=14+19+18+17+16+15+14=20+20=21+24+23+22+21=25+29+28+27+26+25=30+34+33+32+31+30=35+37+36+35=38+41+40+39+38=42+44+43+42=45+45=46+49+48+47+46=50+66687+66696+66699+88901+88905+96302+96303+98768+99589+99864+99955+99986+99995+99998+99999+100000+99997+99996+9999...

result:

ok 2267997 / 2266990 / 2268569

Test #24:

score: 0
Accepted
time: 138ms
memory: 28664kb

input:

100000
1 1 1 4 4 6 6 8 9 9 11 12 13 14 15 16 17 18 19 19 19 18 23 23 23 18 27 27 27 30 17 32 33 33 33 32 37 37 37 32 41 41 41 44 17 46 47 47 47 50 46 52 52 52 55 46 57 57 57 60 16 62 63 64 64 64 63 68 68 68 63 72 72 72 75 62 77 78 78 78 77 82 82 82 77 86 86 86 89 62 91 92 92 92 95 91 97 97 97 100 91...

output:

=1+3+2+1=4+5+4=6+7+6=8+33341+55560+62965+65434+66257+66532+66623+66654+66663+66666+66667+66668+66665+66664+66659+66662+66661+66660+66655+66658+66657+66656+66639+66648+66651+66652+66653+66650+66649+66644+66647+66646+66645+66640+66643+66642+66641+66624+66633+66636+66637+66638+66635+66634+66629+66632+6...

result:

ok 2268627 / 2269771 / 2143841

Test #25:

score: 0
Accepted
time: 147ms
memory: 31020kb

input:

100000
1 2 3 4 5 5 5 8 8 8 8 12 12 14 15 15 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 34 36 33 38 38 32 41 42 41 44 31 46 47 48 47 50 46 52 52 54 30 56 57 58 58 60 57 62 62 64 56 66 67 67 66 70 70 29 73 74 75 76 76 78 75 80 80 82 74 84 85 85 84 88 73 90 91 92 91 94 90 96 96 98 28 100 101...

output:

=1+1=2+2=3+3=4+4=5+7+6+5=8+61804+61806+61807+61808+61809+61810+61811+61812+61813+61814+61815+61816+61817+61818+61819+61820+61821+61822+61823+61824+61825+61827+61828+61826+61829+61831+61830+61832+61835+61836+61833+61834+61837+61838+61841+61842+61839+61840+61843+61845+61846+61844+61847+61848+61853+618...

result:

ok 2143661 / 2143432 / 2143100

Test #26:

score: 0
Accepted
time: 147ms
memory: 26692kb

input:

100000
1 2 3 3 5 5 5 8 8 8 8 8 8 8 8 16 17 18 18 18 18 18 23 23 23 23 27 27 27 30 31 31 33 34 35 35 35 35 35 35 35 35 43 44 44 44 44 44 44 50 51 51 53 53 53 53 53 58 58 58 58 62 62 64 65 65 65 68 69 70 70 70 70 70 70 70 77 77 77 80 81 81 81 81 81 81 81 88 88 90 91 91 91 94 94 96 97 97 97 100 100 100...

output:

=1+1=2+2=3+4+3=5+7+6+5=8+15+14+13+12+11+10+9+8=16+16=17+17=18+22+21+20+19+18=23+26+25+24+23=27+29+28+27=30+30=31+32+31=33+33=34+34=35+42+41+40+39+38+37+36+35=43+43=44+49+48+47+46+45+44=50+61820+61821+61822+61827+61828+61832+61836+61838+61840+61843+61850+61852+61857+61858+61861+61863+61866+61867+6186...

result:

ok 2141450 / 2138468 / 2131910

Test #27:

score: 0
Accepted
time: 138ms
memory: 29032kb

input:

100000
1 2 2 2 2 2 7 7 7 10 10 12 12 12 15 15 17 17 17 17 21 21 21 21 25 26 26 26 26 26 26 32 33 33 35 35 37 38 38 40 40 40 40 44 44 44 44 44 44 44 51 51 53 53 53 53 53 53 53 60 61 61 61 61 65 65 67 68 69 70 71 71 71 71 75 76 76 78 78 78 78 82 82 84 84 84 87 88 89 89 89 89 93 93 93 96 97 97 97 97 10...

output:

=1+1=2+6+5+4+3+2=7+9+8+7=10+11+10=12+14+13+12=15+16+15=17+20+19+18+17=21+24+23+22+21=25+25=26+31+30+29+28+27+26=32+32=33+34+33=35+36+35=37+37=38+39+38=40+43+42+41+40=44+50+49+48+47+46+45+44=51+52+51=53+59+58+57+56+55+54+53=60+60=61+64+63+62+61=65+66+65=67+67=68+68=69+69=70+70=71+74+73+72+71=75+75=76...

result:

ok 2118302 / 2094488 / 2058034

Test #28:

score: 0
Accepted
time: 157ms
memory: 31388kb

input:

100000
1 2 2 2 2 6 6 8 9 9 9 9 13 14 15 15 15 15 15 20 20 20 23 23 23 23 27 27 27 30 30 30 33 34 34 36 37 38 38 40 41 42 43 43 43 43 43 43 43 43 51 52 52 52 52 56 56 56 56 56 56 56 56 64 64 64 67 67 69 69 69 69 69 69 75 75 75 75 79 79 79 82 82 84 85 85 85 88 88 88 88 92 92 92 95 95 95 98 99 99 99 99...

output:

=1+1=2+5+4+3+2=6+7+6=8+8=9+12+11+10+9=13+13=14+14=15+19+18+17+16+15=20+22+21+20=23+26+25+24+23=27+29+28+27=30+32+31+30=33+33=34+35+34=36+36=37+37=38+39+38=40+40=41+41=42+42=43+50+49+48+47+46+45+44+43=51+51=52+55+54+53+52=56+63+62+61+60+59+58+57+56=64+66+65+64=67+68+67=69+74+73+72+71+70+69=75+78+77+7...

result:

ok 1983925 / 1859397 / 1699750

Test #29:

score: 0
Accepted
time: 173ms
memory: 38920kb

input:

100000
1 1 1 1 1 1 1 8 9 9 11 12 13 14 14 14 14 14 19 20 20 20 23 23 23 23 27 28 29 29 29 32 33 33 35 36 37 38 38 38 38 42 42 42 42 46 47 48 48 50 51 52 52 54 54 56 57 57 57 60 60 62 62 62 62 62 62 68 68 68 68 72 73 73 73 76 76 76 76 80 81 81 81 84 85 86 86 88 88 90 90 90 93 93 95 96 96 96 96 96 96 ...

output:

=1+7+6+5+4+3+2+1=8+8=9+10+9=11+11=12+12=13+13=14+18+17+16+15+14=19+19=20+22+21+20=23+26+25+24+23=27+27=28+28=29+31+30+29=32+32=33+34+33=35+35=36+36=37+37=38+41+40+39+38=42+45+44+43+42=46+46=47+47=48+49+48=50+50=51+51=52+53+52=54+55+54=56+56=57+59+58+57=60+61+60=62+67+66+65+64+63+62=68+71+70+69+68=72...

result:

ok 1536005 / 1412628 / 1335582

Test #30:

score: 0
Accepted
time: 88ms
memory: 28744kb

input:

100000
1 2 3 1 5 6 5 8 8 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 29 30 31 32 33 34 35 36 37 38 39 40 41 29 43 44 45 46 47 48 49 43 51 52 53 51 55 56 55 58 58 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 1 77 78 79 80 81 82 83 84 77 86 87 88 89 86 91 92 91 94 94 96 96 98 99 100 101...

output:

=1+24981+37471+43717+46840+48402+49184+49575+49771+49870+49920+49945+49958+49965+49969+49972+49974+49975+49976+49977+49978+49979+49980+49981+49982+49983+49984+49985+49986+49973+49970+49971+49966+49967+49968+49959+49960+49961+49962+49963+49964+49946+49947+49948+49949+49950+49951+49952+49953+49954+499...

result:

ok 1735178 / 1727864 / 1720914

Test #31:

score: 0
Accepted
time: 117ms
memory: 28988kb

input:

100000
1 1 3 3 5 1 7 7 9 7 11 11 13 13 1 16 17 16 19 19 21 21 16 24 24 26 27 24 29 30 29 32 32 34 1 36 37 36 39 39 41 36 43 43 45 43 47 48 47 50 50 52 36 54 54 56 54 58 58 60 60 54 63 63 65 66 63 68 69 68 71 71 73 73 75 76 1 78 79 78 81 81 83 78 85 85 87 85 89 89 91 91 93 78 95 95 97 95 99 99 101 10...

output:

=1+24811+37216+43419+46521+48073+48849+49238+49433+49531+49580+49605+49618+49625+49629+49632+49634+49635+49636+49637+49638+49639+49640+49641+49642+49643+49644+49645+49646+49647+49648+49649+49650+49651+49652+49653+49654+49655+49656+49657+49658+49659+49660+49661+49662+49663+49664+49665+49666+49667+496...

result:

ok 1907217 / 1756563 / 1549053

Test #32:

score: 0
Accepted
time: 118ms
memory: 29896kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 1 15 16 17 18 19 20 15 22 23 24 22 26 27 26 29 29 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 1 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 65 97 98 99 100 101...

output:

=1+23245+34868+40680+43586+45040+45767+46131+46314+46406+46452+46476+46488+46495+46499+46501+46503+46504+46505+46506+46507+46508+46509+46510+46511+46512+46513+46514+46515+46516+46517+46518+46519+46520+46521+46522+46523+46524+46525+46526+46527+46528+46529+46530+46531+46532+46533+46534+46535+46536+465...

result:

ok 1373284 / 1069383 / 2258816

Test #33:

score: 0
Accepted
time: 166ms
memory: 31048kb

input:

100000
1 1 3 3 5 5 5 5 9 9 9 9 13 14 14 16 16 16 19 19 21 21 23 24 25 26 26 26 26 26 26 26 33 34 34 34 34 34 34 40 41 41 41 44 45 45 45 45 49 49 49 52 52 52 55 56 56 58 58 58 58 58 63 64 64 64 67 68 68 70 70 72 73 74 72 72 77 72 79 80 80 80 70 70 85 85 87 85 85 90 85 85 93 93 93 70 70 98 99 100 100 ...

output:

=1+2+1=3+4+3=5+8+7+6+5=9+12+11+10+9=13+13=14+15+14=16+18+17+16=19+66680+66683+66684+66687+66688+66690+66692+66693+66695+66696+66698+70396+70397+70399+70400+70401+70403+72862+72867+72868+72870+72871+72872+73141+73142+73144+73233+73263+73272+73273+73275+73274+73269+73271+73270+73268+73265+73266+73267+...

result:

ok 2254040 / 2232095 / 2202906

Test #34:

score: 0
Accepted
time: 144ms
memory: 29252kb

input:

100000
1 1 3 3 3 3 3 8 8 8 11 12 13 13 13 13 13 13 13 13 13 13 13 13 13 26 26 28 29 29 29 29 29 29 29 36 36 36 39 40 40 40 40 40 45 46 46 46 49 49 51 52 53 54 55 56 56 56 56 56 56 62 62 62 62 62 62 68 68 68 68 72 72 74 75 75 75 75 79 79 79 82 83 84 84 86 87 88 88 88 88 92 92 92 92 96 97 97 97 97 97 ...

output:

=1+2+1=3+7+6+5+4+3=8+10+9+8=11+11=12+12=13+25+24+23+22+21+20+19+18+17+16+15+14+13=26+27+26=28+28=29+35+34+33+32+31+30+29=36+38+37+36=39+39=40+44+43+42+41+40=45+45=46+48+47+46=49+50+49=51+51=52+52=53+53=54+54=55+55=56+61+60+59+58+57+56=62+67+66+65+64+63+62=68+71+70+69+68=72+73+72=74+74=75+78+77+76+75...

result:

ok 2164645 / 2093185 / 1959033

Test #35:

score: 0
Accepted
time: 154ms
memory: 31044kb

input:

100000
1 1 1 1 1 6 6 8 8 8 11 12 12 14 14 14 14 18 19 19 19 19 19 19 19 26 27 27 29 29 29 29 29 29 29 29 29 38 38 38 41 41 41 41 45 45 47 47 47 47 47 47 53 54 54 54 54 54 54 54 54 54 54 54 54 54 67 67 69 70 70 70 70 70 70 70 70 70 70 70 70 70 83 83 85 86 87 87 89 89 91 92 92 92 92 92 92 92 99 99 99 ...

output:

=1+5+4+3+2+1=6+7+6=8+10+9+8=11+11=12+13+12=14+17+16+15+14=18+18=19+25+24+23+22+21+20+19=26+26=27+28+27=29+37+36+35+34+33+32+31+30+29=38+40+39+38=41+44+43+42+41=45+46+45=47+52+51+50+49+48+47=53+53=54+66+65+64+63+62+61+60+59+58+57+56+55+54=67+68+67=69+69=70+82+81+80+79+78+77+76+75+74+73+72+71+70=83+84...

result:

ok 1759497 / 1646699 / 1832097

Test #36:

score: 0
Accepted
time: 165ms
memory: 29988kb

input:

100000
1 1 1 1 1 1 1 1 9 10 10 12 12 14 14 16 16 16 16 16 21 21 23 24 25 25 25 25 29 29 31 31 31 34 35 36 36 36 39 39 41 41 43 43 43 46 46 48 49 49 49 49 53 53 53 56 56 58 59 59 59 59 59 59 59 59 59 59 69 69 69 72 73 73 73 73 77 78 79 79 79 79 79 79 79 86 87 87 89 89 89 92 93 93 95 95 95 98 99 99 99...

output:

=1+8+7+6+5+4+3+2+1=9+9=10+11+10=12+13+12=14+15+14=16+20+19+18+17+16=21+22+21=23+23=24+24=25+28+27+26+25=29+30+29=31+33+32+31=34+34=35+35=36+38+37+36=39+40+39=41+42+41=43+45+44+43=46+47+46=48+48=49+52+51+50+49=53+55+54+53=56+57+56=58+58=59+68+67+66+65+64+63+62+61+60+59=69+71+70+69=72+72=73+76+75+74+7...

result:

ok 1834861 / 1972757 / 2057836

Test #37:

score: 0
Accepted
time: 149ms
memory: 28728kb

input:

100000
1 2 2 2 2 6 6 8 8 8 8 8 8 8 8 8 8 8 19 20 20 20 23 23 23 23 23 28 28 28 31 31 31 31 35 36 36 36 36 36 41 41 41 44 44 46 46 46 49 49 49 49 49 49 49 56 56 56 56 56 61 61 61 61 65 65 65 68 69 69 69 72 73 74 74 76 76 76 76 80 80 80 80 84 84 84 84 84 84 90 91 91 91 91 95 96 96 96 96 96 101 101 101...

output:

=1+1=2+5+4+3+2=6+7+6=8+18+17+16+15+14+13+12+11+10+9+8=19+19=20+22+21+20=23+27+26+25+24+23=28+30+29+28=31+34+33+32+31=35+35=36+40+39+38+37+36=41+43+42+41=44+45+44=46+48+47+46=49+55+54+53+52+51+50+49=56+60+59+58+57+56=61+64+63+62+61=65+67+66+65=68+68=69+71+70+69=72+72=73+73=74+75+74=76+79+78+77+76=80+...

result:

ok 2110553 / 2142203 / 2150427

Test #38:

score: 0
Accepted
time: 144ms
memory: 28748kb

input:

100000
1 1 3 3 5 5 7 7 9 10 11 11 13 13 13 16 16 18 19 19 21 21 23 23 23 23 23 23 29 30 30 30 30 30 35 35 35 38 39 39 39 42 42 44 45 46 46 46 46 50 50 52 52 52 52 56 57 58 59 60 61 61 61 64 65 65 65 65 69 70 71 71 73 74 74 74 74 78 78 78 81 82 83 83 85 86 86 86 89 89 89 92 92 92 95 95 95 98 99 100 1...

output:

=1+2+1=3+4+3=5+6+5=7+8+7=9+9=10+10=11+61810+61813+61815+61816+61817+61821+61825+61828+61829+61832+61833+61834+61835+61836+61837+61841+61842+61847+61851+61852+61853+61854+61857+61858+61861+61862+61864+61865+61866+61869+61872+61874+61875+61878+61881+61882+61883+61884+61885+61891+61892+61894+61893+6188...

result:

ok 2159467 / 2093575 / 2080390

Test #39:

score: 0
Accepted
time: 121ms
memory: 28728kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 17 17 19 19 21 22 23 24 13 26 27 28 29 30 31 26 33 34 35 33 37 38 37 40 40 42 43 44 45 12 47 48 49 50 51 48 53 54 53 56 56 58 58 60 61 62 63 47 65 66 66 68 69 70 71 72 73 65 75 76 77 78 75 80 81 80 83 83 85 85 87 88 89 90 91 11 93 94 95 96 97 95 99 100 9...

output:

=1+1=2+3+24969+37453+43695+46817+48378+49159+49550+49746+49845+49895+49920+49933+49940+49944+49947+49949+49950+49951+49952+49953+49954+49955+49956+49957+49958+49959+49960+49961+49962+49963+49964+49965+49966+49967+49968+49969+49970+49971+49972+49973+49974+49975+49976+49948+49945+49946+49941+49942+499...

result:

ok 2062693 / 2014201 / 1931931

Test #40:

score: 0
Accepted
time: 109ms
memory: 28956kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 13 16 16 18 18 20 21 22 23 24 25 26 12 28 29 30 31 32 33 34 35 28 37 38 39 40 37 42 43 42 45 45 47 48 49 50 51 52 53 54 55 56 57 58 11 60 61 62 63 64 65 61 67 68 69 67 71 71 73 73 75 76 77 78 79 80 81 82 83 60 85 86 86 88 89 90 91 92 93 94 95 96 85 98 99 100 1...

output:

=1+1=2+3+24412+36617+42720+45772+47299+48063+48445+48637+48733+48782+48807+48820+48827+48831+48833+48835+48836+48837+48838+48839+48840+48841+48842+48843+48844+48845+48846+48847+48848+48849+48850+48851+48852+48853+48854+48855+48856+48857+48858+48859+48860+48861+48862+48863+48864+48865+48866+48867+488...

result:

ok 1788961 / 1769407 / 1749532

Test #41:

score: 0
Accepted
time: 118ms
memory: 27064kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 13 15 15 17 18 19 20 21 22 23 24 12 26 27 28 29 30 31 26 33 34 35 33 37 38 37 40 40 42 43 44 45 46 47 48 49 50 51 52 53 11 55 56 57 58 59 56 61 62 61 64 64 66 66 68 69 70 71 72 73 74 75 76 55 78 79 79 81 82 83 84 85 86 87 88 78 90 91 92 93 94 90 96 97 98 96 100 1...

output:

=1+1=2+3+24269+36403+42470+45504+47022+47781+48161+48352+48448+48496+48521+48534+48541+48545+48547+48549+48550+48551+48552+48553+48554+48555+48556+48557+48558+48559+48560+48561+48562+48563+48564+48565+48566+48567+48568+48569+48570+48571+48572+48573+48574+48575+48576+48577+48578+48579+48580+48581+485...

result:

ok 1749532 / 1728034 / 1705477

Test #42:

score: 0
Accepted
time: 101ms
memory: 29144kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 12 22 23 24 25 22 27 28 27 30 30 32 32 34 35 36 37 38 39 40 41 42 43 44 45 11 47 48 49 50 48 52 52 54 54 56 57 58 59 60 61 62 63 64 47 66 67 68 69 70 71 72 73 74 66 76 77 78 79 76 81 82 81 84 84 86 86 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

=1+1=2+3+23986+35978+41974+44973+46473+47223+47599+47787+47882+47930+47954+47967+47974+47978+47980+47982+47983+47984+47985+47986+47987+47988+47989+47990+47991+47992+47993+47994+47995+47996+47997+47998+47999+48000+48001+48002+48003+48004+48005+48006+48007+48008+48009+48010+48011+48012+48013+48014+480...

result:

ok 1681223 / 1655644 / 1629123

Test #43:

score: 0
Accepted
time: 94ms
memory: 31600kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 12 18 19 20 18 22 22 24 24 26 27 28 29 30 31 32 33 34 35 36 37 11 39 40 40 42 43 44 45 46 47 48 49 50 51 39 53 54 55 56 57 58 59 53 61 62 63 61 65 66 65 68 68 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 10 93 94 95 96 97 98 99 100 1...

output:

=1+1=2+3+23592+35387+41285+44234+45709+46447+46817+47002+47095+47142+47166+47179+47186+47190+47192+47194+47195+47196+47197+47198+47199+47200+47201+47202+47203+47204+47205+47206+47207+47208+47209+47210+47211+47212+47213+47214+47215+47216+47217+47218+47219+47220+47221+47222+47223+47224+47225+47226+472...

result:

ok 1601384 / 1571699 / 1540591

Test #44:

score: 0
Accepted
time: 118ms
memory: 30992kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 17 17 19 19 13 22 23 23 25 22 27 28 27 30 30 32 32 34 12 36 37 38 38 37 41 42 41 44 44 46 36 48 49 50 49 52 52 48 55 56 56 55 59 59 61 61 63 64 65 66 67 11 69 70 71 72 72 71 75 76 75 78 78 80 70 82 83 83 85 85 82 88 89 89 88 92 92 94 94 96 97 69 99 100 1...

output:

=1+1=2+3+24426+36638+42745+45799+47326+48090+48473+48665+48761+48810+48835+48848+48855+48859+48861+48863+48864+48865+48866+48867+48868+48869+48870+48871+48872+48873+48874+48875+48876+48877+48878+48879+48880+48881+48882+48883+48884+48885+48886+48887+48888+48889+48890+48891+48892+48893+48894+48895+488...

result:

ok 1937243 / 1912820 / 1886900

Test #45:

score: 0
Accepted
time: 129ms
memory: 27180kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 14 16 16 18 13 20 21 21 20 24 25 24 27 27 29 30 12 32 33 34 34 33 37 37 39 39 41 32 43 44 44 46 46 43 49 50 49 52 52 54 54 56 57 58 59 60 11 62 63 64 65 65 64 68 68 70 70 63 73 74 74 76 73 78 79 78 81 81 83 83 85 86 62 88 89 90 90 92 89 94 95 94 97 97 99 88 10...

output:

=1+1=2+3+24198+36296+42346+45371+46884+47641+48020+48210+48306+48354+48379+48392+48399+48403+48405+48407+48408+48409+48410+48411+48412+48413+48414+48415+48416+48417+48418+48419+48420+48421+48422+48423+48424+48425+48426+48427+48428+48429+48430+48431+48432+48433+48434+48435+48436+48437+48438+48439+484...

result:

ok 1859873 / 1830010 / 1801219

Test #46:

score: 0
Accepted
time: 122ms
memory: 29440kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 14 16 16 13 19 20 19 22 22 24 24 26 12 28 29 30 29 32 32 34 28 36 37 37 39 36 41 42 41 44 44 46 47 48 49 50 51 11 53 54 55 56 55 58 58 60 54 62 63 64 62 66 67 66 69 69 71 72 73 53 75 76 77 78 76 80 80 82 82 84 75 86 87 87 89 89 86 92 93 94 92 96 96 98 98 100 1...

output:

=1+1=2+3+23882+35822+41792+44778+46271+47018+47392+47580+47674+47722+47746+47759+47766+47770+47772+47774+47775+47776+47777+47778+47779+47780+47781+47782+47783+47784+47785+47786+47787+47788+47789+47790+47791+47792+47793+47794+47795+47796+47797+47798+47799+47800+47801+47802+47803+47804+47805+47806+478...

result:

ok 1771639 / 1738474 / 1704502

Test #47:

score: 0
Accepted
time: 123ms
memory: 31500kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 13 17 17 19 19 21 22 12 24 25 25 27 28 24 30 31 32 30 34 34 36 36 38 39 40 41 42 11 44 45 46 46 48 49 45 51 52 51 54 54 56 56 58 59 44 61 62 63 62 65 65 67 68 61 70 71 71 73 70 75 76 75 78 78 80 80 82 83 84 85 86 87 88 89 90 91 92 93 94 95 10 97 98 99 100 1...

output:

=1+1=2+3+23443+35163+41024+43955+45421+46154+46521+46705+46798+46845+46869+46881+46888+46892+46894+46896+46897+46898+46899+46900+46901+46902+46903+46904+46905+46906+46907+46908+46909+46910+46911+46912+46913+46914+46915+46916+46917+46918+46919+46920+46921+46922+46923+46924+46925+46926+46927+46928+469...

result:

ok 1668245 / 1929802 / 1947511

Test #48:

score: 0
Accepted
time: 154ms
memory: 28760kb

input:

100000
1 1 3 4 5 1 7 8 9 7 11 11 13 13 15 1 17 18 17 20 20 22 23 17 25 25 27 28 25 30 31 30 33 33 35 36 1 38 39 38 41 41 43 44 38 46 47 48 46 50 51 50 53 53 55 38 57 58 59 57 61 61 63 63 65 57 67 67 69 70 67 72 73 72 75 75 77 77 79 80 1 82 82 84 84 86 87 82 89 90 91 89 93 94 93 96 96 98 82 100 101 1...

output:

=1+24879+37318+43538+46649+48205+48983+49373+49568+49666+49716+49741+49754+49761+49765+49768+49770+49771+49772+49773+49774+49775+49776+49777+49778+49779+49780+49781+49782+49783+49784+49785+49786+49787+49788+49789+49790+49791+49792+49793+49794+49795+49796+49797+49798+49799+49800+49801+49802+49803+498...

result:

ok 1911812 / 1890860 / 1974755

Test #49:

score: 0
Accepted
time: 165ms
memory: 30632kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 23 23 22 28 22 30 21 32 33 32 32 21 37 20 39 40 40 42 39 44 39 20 47 47 19 50 51 52 52 54 51 56 51 50 59 59 61 50 19 64 64 18 67 68 69 70 70 72 69 74 69 68 77 77 79 68 67 82 83 83 82 82 67 88 18 90 90 92 17 94 95 96 97 98 98 97 97...

output:

=1+1=2+95000+95001+95002+95003+95004+95005+95006+95007+95008+95009+95010+95011+95012+95013+95014+95015+95017+95016+95019+95020+95018+95024+95021+95023+95022+95031+95032+95025+95026+95028+95027+95030+95029+95043+95044+95033+95034+95035+95036+95038+95037+95041+95042+95039+95040+95061+95063+95064+95062...

result:

ok 2070659 / 2111025 / 2132664

Test #50:

score: 0
Accepted
time: 162ms
memory: 29100kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 44 43 42 42 41 41 40 52 40 39 55 55 39 38 59 60 59 38 37 64 65 66 65 64 37 36 71 72 73 73 72 71 71 36 35 80 81 82 83 82 81 81 80 80 35 35 34 92 93 94 95 96 95 94 93 93 92...

output:

=1+1=2+100000+99999+99998+99997+99996+99995+99994+99993+99992+99991+99990+99989+99988+99987+99986+99985+99984+99983+99982+99981+99980+99979+99978+99977+99976+99975+99974+99973+99972+99971+99970+99969+99968+99967+99966+99965+99964+99963+99962+99961+99960+99959+99958+99957+99956+99955+99954+99953+9995...

result:

ok 2002640 / 1981388 / 2050690

Test #51:

score: 0
Accepted
time: 161ms
memory: 28792kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 14 14 14 14 14 14 14 14 14 13 25 25 25 25 25 25 13 13 13 13 12 36 37 37 37 37 37 37 37 36 45 45 45 36 36 36 36 12 12 12 12 12 12 11 59 60 61 61 61 61 61 61 61 60 69 69 69 60 60 60 60 60 59 78 78 78 78 78 78 78 78 78 78 78 59 59 59 59 59 59 59 11 11 11 11 11 11...

output:

=1+100000+99999+99998+99997+99996+99995+99994+99993+99992+99991+99990+99989+99988+99987+99986+99985+99984+99983+99982+99981+99980+99979+99978+99977+99976+99975+99974+99973+99972+99971+99970+99969+99968+99967+99966+99965+99964+99963+99962+99961+99960+99959+99958+99957+99956+99955+99954+99953+99952+99...

result:

ok 2359906 / 2342462 / 2372693

Test #52:

score: 0
Accepted
time: 184ms
memory: 26760kb

input:

100000
1 2 3 4 5 6 7 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9...

output:

=1+100000+99999+99998+99997+99996+99995+99994+99993+99992+99991+99990+99989+99988+99987+99986+99985+99984+99983+99982+99981+99980+99979+99978+99977+99976+99975+99974+99973+99972+99971+99970+99969+99968+99967+99966+99965+99964+99963+99962+99961+99960+99959+99958+99957+99956+99955+99954+99953+99952+99...

result:

ok 2256839 / 2337311 / 2342921

Test #53:

score: 0
Accepted
time: 159ms
memory: 28512kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 11 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11...

output:

=1+100000+99999+99998+99997+99996+99995+99994+99993+99992+99991+99990+99989+99988+99987+99986+99985+99984+99983+99982+99981+99980+99979+99978+99977+99976+99975+99974+99973+99972+99971+99970+99969+99968+99967+99966+99965+99964+99963+99962+99961+99960+99959+99958+99957+99956+99955+99954+99953+99952+99...

result:

ok 2344715 / 2311756 / 2322020

Test #54:

score: 0
Accepted
time: 177ms
memory: 29068kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 11 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 10 97 98 98 98 98...

output:

=1+100000+99999+99998+99997+99996+99995+99994+99993+99992+99991+99990+99989+99988+99987+99986+99985+99984+99983+99982+99981+99980+99979+99978+99977+99976+99975+99974+99973+99972+99971+99970+99969+99968+99967+99966+99965+99964+99963+99962+99961+99960+99959+99958+99957+99956+99955+99954+99953+99952+99...

result:

ok 2335587 / 2379194 / 2314436

Test #55:

score: 0
Accepted
time: 191ms
memory: 30644kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 10 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87...

output:

=1+100000+99999+99998+99997+99996+99995+99994+99993+99992+99991+99990+99989+99988+99987+99986+99985+99984+99983+99982+99981+99980+99979+99978+99977+99976+99975+99974+99973+99972+99971+99970+99969+99968+99967+99966+99965+99964+99963+99962+99961+99960+99959+99958+99957+99956+99955+99954+99953+99952+99...

result:

ok 2330490 / 2362658 / 2392598