QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#31755#4046. 钥匙 do_while_true100 ✓1074ms290228kbC++1445.3kb2022-05-12 11:02:042022-05-12 11:02:06

Judging History

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

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

answer

#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<ctime>
#define pb emplace_back
#define mp std::make_pair
#define fi first
#define se second
#define dbg(x) cerr<<"In Line "<< __LINE__<<" the "<<#x<<" = "<<x<<'\n';
#define dpi(x,y) cerr<<"In Line "<<__LINE__<<" the "<<#x<<" = "<<x<<" ; "<<"the "<<#y<<" = "<<y<<'\n';
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>pii;
typedef pair<ll,int>pli;
typedef pair<ll,ll>pll;
typedef vector<int>vi;
typedef vector<ll>vll;
typedef vector<pii>vpii;
template<typename T>T cmax(T &x, T y){return x=x>y?x:y;}
template<typename T>T cmin(T &x, T y){return x=x<y?x:y;}
#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
T &read(T &r){
	r=0;bool w=0;char ch=getchar();
	while(ch<'0'||ch>'9')w=ch=='-'?1:0,ch=getchar();
	while(ch>='0'&&ch<='9')r=r*10+(ch^48),ch=getchar();
	return r=w?-r:r;
}
template<typename T1,typename... T2>
void read(T1 &x, T2& ...y){ read(x); read(y...); }
inline int lowbit(int x){return x&(-x);}
const int N=1000010;
int n,m,ct[N];
int t[N],c[N];
int ctc[N][3];
int fa[N],dep[N];
vi eg[N];
namespace bf{
	void dfs(int x,int f){
		dep[x]=dep[f]+1;fa[x]=f;
		for(auto v:eg[x])if(v!=f)dfs(v,x);
	}
	void main(){
		dfs(1,0);
		while(m--){
			int x,y;read(x,y);
			vi vx,vy;
			while(x!=y){
				if(dep[x]>=dep[y]){
					vx.pb(x);
					x=fa[x];
				}
				else{
					vy.pb(y);
					y=fa[y];
				}
			}
			vx.pb(x);
			reverse(vy.begin(),vy.end());
			for(auto i:vy)vx.pb(i);
			int ans=0;
			for(auto i:vx){
				if(t[i]==1)++ct[c[i]];
				else if(ct[c[i]])--ct[c[i]],++ans;
			}
			for(auto i:vx)ct[c[i]]=0;
			cout << ans << '\n';
		}
	}
}
namespace ac{
	int dfn[N],ofn[N],fi[N],ed[N],oft,dft,dep[N],fa[N][21],lg[N],siz[N];
	int st[21][N],nowc;
	int top,stk[N];
	vi vec[N],et[N];
	void dfs1(int x,int f){
		fa[x][0]=f;dep[x]=dep[f]+1;siz[x]=1;
		dfn[x]=++dft;fi[x]=++oft;ofn[oft]=x;
		for(int i=1;i<=20;i++)fa[x][i]=fa[fa[x][i-1]][i-1];
		for(auto v:eg[x])if(v!=f){
			dfs1(v,x);
			siz[x]+=siz[v];
			ed[v]=++oft;
			ofn[oft]=x;
		}
	}
	int LCA(int x,int y){
		x=fi[x];y=fi[y];
		int l=min(x,y),r=max(x,y);
		int k=lg[r-l+1];
		return dep[st[k][l]]<dep[st[k][r-(1<<k)+1]] ? st[k][l] : st[k][r-(1<<k)+1];
	}
	void merge(int x,int y){
		et[x].pb(y);et[y].pb(x);
	}
	int Findsbt(int x,int y){
		for(int i=20;~i;i--)
			if(dep[fa[y][i]]>dep[x])
				y=fa[y][i];
		return y;
	}
	int lct;
	struct Line{
		int l,r,h,v;
	}li[N*10];
	struct Que{
		int x,y,i;
	}q[N];
	int ans[N];
	int tree[N];
	void modify(int x,int v){
		for(;x<=n;x+=lowbit(x))tree[x]+=v;
	}
	void modify(int l,int r,int v){
		modify(l,v);
		if(r<n)modify(r+1,-v);
	}
	int query(int x){
		int s=0;
		for(;x;x-=lowbit(x))s+=tree[x];
		return s;
	}
	void Push(int l1,int r1,int l2,int r2){
		if(l1>r1||l2>r2)return ;
//		cout << l1 << ' ' << r1 << ' ' << l2 << ' ' << r2 << '\n';
		li[++lct]={l2,r2,l1,1};
		if(r1<n)li[++lct]={l2,r2,r1+1,-1};
	}
	void dfs2(int x,int f,int h,int aci){
		if(x!=aci&&c[x]==nowc){
			if(t[x]==1)++h;
			else{
				if(!h){
					if(fi[aci]<=fi[x]&&ed[x]<=ed[aci]){
						int y=Findsbt(aci,x);
						int l=dfn[x],r=dfn[x]+siz[x]-1;
						Push(1,dfn[y]-1,l,r);
						Push(dfn[y]+siz[y],n,l,r);
					}
					else{
						if(fi[x]<=fi[aci]&&ed[aci]<=ed[x]){
							swap(x,aci);
							int y=Findsbt(aci,x);
							int l=dfn[x],r=dfn[x]+siz[x]-1;
							Push(l,r,1,dfn[y]-1);
							Push(l,r,dfn[y]+siz[y],n);
						}
						else{
							Push(dfn[aci],dfn[aci]+siz[aci]-1,dfn[x],dfn[x]+siz[x]-1);
						}
					}
					return ;
				}
				--h;
			}
		}
		for(auto v:et[x])if(v!=f){
			dfs2(v,x,h,aci);
		}
	}
	void init(){
		dfs1(1,0);
		ed[1]=++oft;ofn[oft]=1;
		for(int i=1;i<=oft;i++)st[0][i]=ofn[i];
		for(int i=2;i<=oft;i++)lg[i]=lg[i>>1]+1;
		for(int i=1;i<=20;i++)
			for(int j=1;j+(1<<i)-1<=oft;j++)
				st[i][j]=dep[st[i-1][j]]<dep[st[i-1][j+(1<<(i-1))]] ? st[i-1][j] : st[i-1][j+(1<<(i-1))];
		for(int i=1;i<=m;i++){
			int x,y;read(x,y);
			q[i]={dfn[x],dfn[y],i};
		}
	}
	void JiTangLaiLe(){
		for(int i=1;i<=n;i++)vec[c[i]].pb(i);
		for(int o=1;o<=n;o++){
			nowc=o;
			stk[top=1]=1;
			sort(vec[o].begin(),vec[o].end(),[](const int &x,const int &y){return dfn[x]<dfn[y];});
			vi po;
			for(auto x:vec[o]){
				if(x==1)continue;
				int t=LCA(x,stk[top]);
				while(top>1&&dep[t]<dep[stk[top-1]]){
					merge(stk[top-1],stk[top]);
					po.pb(stk[top]);--top;
					t=LCA(x,stk[top]);
				}
				if(dep[t]<dep[stk[top]]){
					merge(t,stk[top]);
					po.pb(stk[top]);--top;
					if(t!=stk[top])stk[++top]=t;
					stk[++top]=x;
				}
				else stk[++top]=x;
			}
			while(top>1){
				merge(stk[top],stk[top-1]);
				po.pb(stk[top]);--top;
			}
			po.pb(1);
			for(auto x:vec[o]){
				if(t[x]==1){
					dfs2(x,0,0,x);
				}
			}
			for(auto x:po){
				vi().swap(et[x]);
			}
		}		
	}
	void Sao(){
		sort(li+1,li+lct+1,[](const Line &x,const Line &y){return x.h<y.h;});
		sort(q+1,q+m+1,[](const Que &x,const Que &y){return x.x<y.x;});
		int pos=1;
		for(int i=1;i<=m;i++){
			while(pos<=lct&&li[pos].h<=q[i].x){
				modify(li[pos].l,li[pos].r,li[pos].v);
				++pos;
			}
			ans[q[i].i]=query(q[i].y);
		}
	}
	void main(){
		init();
		JiTangLaiLe();
		Sao();
		for(int i=1;i<=m;i++)cout << ans[i] << '\n';
	}
}
signed main(){
	read(n,m);
	for(int i=1;i<=n;i++){
		read(t[i],c[i]);
		ctc[c[i]][t[i]]++;
	}
	bool subafl=1;
	for(int i=1;i<=n;i++)
		if(ctc[i][1]||ctc[i][2]){
			if(ctc[i][1]!=1||ctc[i][2]!=1)
				subafl=0;
		}
	for(int i=1;i<n;i++){
		int x,y;read(x,y);
		eg[x].pb(y);eg[y].pb(x);
	}
	if(n<=5000&&m<=5000)bf::main();
	else ac::main();
    #ifdef do_while_true
		cerr<<'\n'<<"Time:"<<clock()<<" ms"<<'\n';
	#endif
	return 0;
}
/*5000,10000,15000,20000,25000,30000,35000,40000,45000,50000,55000,60000,65000,70000,75000,80000,85000,90000,95000,100000,105000,110000,115000,120000,125000,130000,135000,140000,145000,150000,155000,160000,165000,170000,175000,180000,185000,190000,195000,200000,205000,210000,215000,220000,225000,230000,235000,240000,245000,250000,255000,260000,265000,270000,275000,280000,285000,290000,295000,300000,305000,310000,315000,320000,325000,330000,335000,340000,345000,350000,355000,360000,365000,370000,375000,380000,385000,390000,395000,400000,405000,410000,415000,420000,425000,430000,435000,440000,445000,450000,455000,460000,465000,470000,475000,480000,485000,490000,495000,500000,
5000,9999,15000,20000,24999,30000,35000,39999,45000,50000,54999,60000,65000,69999,75000,80000,84999,90000,95000,99999,105000,110000,114999,120000,125000,129999,135000,140000,144999,150000,155000,159999,165000,170000,174999,180000,185000,189999,195000,200000,204999,210000,215000,219999,225000,230000,234999,240000,245000,249999,255000,260000,264999,270000,275000,279999,285000,290000,294999,300000,305000,309999,315000,320000,324999,330000,335000,339999,345000,350000,354999,360000,365000,369999,375000,380000,384999,390000,395000,399999,405000,410000,414999,420000,425000,429999,435000,440000,444999,450000,455000,459999,465000,470000,474999,480000,485000,489999,495000,500000,
5834,11667,17500,23334,29167,35000,40834,46667,52500,58334,64167,70000,75834,81667,87500,93334,99167,105000,110834,116667,122500,128334,134167,140000,145834,151667,157500,163334,169167,175000,180834,186667,192500,198334,204167,210000,215834,221667,227500,233334,239167,245000,250834,256667,262500,268334,274167,280000,285834,291667,297500,303334,309167,315000,320834,326667,332500,338334,344167,350000,355834,361667,367500,373334,379167,385000,390834,396667,402500,408334,414167,420000,425834,431667,437500,443334,449167,455000,460834,466667,472500,478334,484167,490000,495834,501667,507500,513334,519167,525000,530834,536667,542500,548334,554167,560000,565834,571667,577500,583334,
4834,9666,14500,19334,24166,29000,33834,38666,43500,48334,53166,58000,62834,67666,72500,77334,82166,87000,91834,96666,101500,106334,111166,116000,120834,125666,130500,135334,140166,145000,149834,154666,159500,164334,169166,174000,178834,183666,188500,193334,198166,203000,207834,212666,217500,222334,227166,232000,236834,241666,246500,251334,256166,261000,265834,270666,275500,280334,285166,290000,294834,299666,304500,309334,314166,319000,323834,328666,333500,338334,343166,348000,352834,357666,362500,367334,372166,377000,381834,386666,391500,396334,401166,406000,410834,415666,420500,425334,430166,435000,439834,444666,449500,454334,459166,464000,468834,473666,478500,483334,
6333,12666,19000,25333,31666,38000,44333,50666,57000,63333,69666,76000,82333,88666,95000,101333,107666,114000,120333,126666,133000,139333,145666,152000,158333,164666,171000,177333,183666,190000,196333,202666,209000,215333,221666,228000,234333,240666,247000,253333,259666,266000,272333,278666,285000,291333,297666,304000,310333,316666,323000,329333,335666,342000,348333,354666,361000,367333,373666,380000,386333,392666,399000,405333,411666,418000,424333,430666,437000,443333,449666,456000,462333,468666,475000,481333,487666,494000,500333,506666,513000,519333,525666,532000,538333,544666,551000,557333,563666,570000,576333,582666,589000,595333,601666,608000,614333,620666,627000,633333,
4713,9429,14141,18858,23571,28286,32999,37712,42431,47141,51858,56568,61287,66002,70713,75428,80141,84858,89570,94286,99000,103713,108429,113141,117858,122571,127286,131999,136712,141431,146141,150858,155568,160287,165002,169713,174428,179141,183858,188570,193286,198000,202713,207429,212141,216858,221571,226286,230999,235712,240431,245141,249858,254568,259287,264002,268713,273428,278141,282858,287570,292286,297000,301713,306429,311141,315858,320571,325286,329999,334712,339431,344141,348858,353568,358287,363002,367713,372428,377141,381858,386570,391286,396000,400713,405429,410141,414858,419571,424286,428999,433712,438431,443141,447858,452568,457287,462002,466713,471428,
6394,12786,19180,25573,31965,38359,44750,51143,57535,63930,70322,76716,83109,89500,95892,102287,108679,115071,121466,127858,134250,140644,147036,153430,159823,166215,172609,179000,185393,191785,198180,204572,210966,217359,223750,230142,236537,242929,249321,255716,262108,268500,274894,281286,287680,294073,300465,306859,313250,319643,326035,332430,338822,345216,351609,358000,364392,370787,377179,383571,389966,396358,402750,409144,415536,421930,428323,434715,441109,447500,453893,460285,466680,473072,479466,485859,492250,498642,505037,511429,517821,524216,530608,537000,543394,549786,556180,562573,568965,575359,581750,588143,594535,600930,607322,613716,620109,626500,632892,639287,
5848,11690,17537,23382,29226,35070,40915,46759,52608,58454,64297,70143,75988,81833,87678,93522,99366,105213,111061,116904,122750,128596,134440,140285,146131,151975,157821,163668,169511,175358,181203,187046,192891,198738,204581,210429,216274,222118,227964,233809,239653,245499,251345,257188,263037,268883,274727,280571,286416,292261,298106,303952,309795,315642,321490,327334,333179,339023,344867,350712,356559,362401,368250,374098,379940,385787,391632,397476,403320,409165,415009,420858,426704,432547,438393,444238,450083,455928,461772,467616,473463,479311,485154,491000,496846,502690,508535,514381,520225,526071,531918,537761,543608,549453,555296,561141,566988,572831,578679,584524,
6445,12889,19334,25778,32222,38667,45112,51556,58000,64443,70890,77334,83780,90222,96667,103112,109558,116000,122444,128888,135334,141780,148222,154667,161111,167557,174000,180444,186888,193334,199778,206223,212667,219113,225557,232000,238444,244890,251334,257779,264221,270667,277113,283557,290000,296443,302889,309334,315779,322221,328667,335111,341558,348000,354445,360889,367334,373779,380223,386667,393112,399556,406000,412445,418889,425334,431778,438222,444667,451112,457556,464000,470443,476890,483334,489780,496222,502667,509112,515558,522000,528444,534888,541334,547780,554222,560667,567111,573557,580000,586444,592888,599334,605778,612223,618667,625113,631557,638000,644444,
4512,9016,13527,18034,22540,27055,31567,36070,40584,45090,49599,54123,58622,63132,67640,72150,76656,81172,85673,90186,94689,99208,103715,108228,112742,117246,121749,126266,130774,135280,139791,144301,148808,153321,157830,162338,166844,171354,175865,180378,184879,189390,193898,198408,202928,207430,211941,216444,220958,225468,229976,234484,238994,243499,248018,252533,257036,261547,266053,270561,275070,279586,284089,288596,293108,297618,302124,306640,311146,315656,320169,324676,329186,333694,338199,342709,347223,351736,356239,360757,365254,369769,374279,378784,383299,387809,392309,396832,401339,405846,410362,414864,419370,423884,428395,432898,437410,441918,446426,450938,
7024,14044,21071,28095,35118,42144,49167,56188,63217,70240,77259,84285,91309,98334,105359,112383,119404,126428,133454,140475,147501,154525,161547,168572,175597,182615,189645,196667,203692,210714,217739,224761,231787,238811,245831,252857,259881,266904,273927,280953,287975,295002,302025,309045,316070,323096,330116,337143,344167,351188,358215,365239,372261,379288,386312,393331,400356,407382,414404,421430,428453,435476,442500,449525,456546,463570,470595,477616,484643,491664,498689,505714,512740,519759,526785,533810,540832,547858,554882,561902,568928,575953,582975,590000,597022,604047,611073,618098,625117,632142,639167,646188,653214,660238,667262,674288,681311,688332,695357,702383,
4469,8937,13397,17859,22333,26802,31261,35732,40206,44663,49138,53601,58063,62538,67011,71469,75941,80413,84869,89341,93810,98271,102741,107210,111664,116148,120609,125070,129551,134003,138474,142945,147409,151876,156350,160816,165274,169740,174210,178680,183142,187607,192075,196554,201014,205482,209951,214421,218876,223356,227810,232279,236756,241212,245680,250148,254611,259079,263553,268012,272483,276953,281413,285881,290360,294815,299280,303756,308207,312685,317152,321620,326088,330560,335021,339486,343947,348419,352890,357353,361815,366285,370757,375218,379690,384160,388626,393089,397562,402018,406489,410963,415416,419890,424354,428818,433289,437759,442212,446693,
6511,13023,19532,26046,32557,39065,45583,52097,58606,65118,71631,78141,84651,91165,97676,104189,110695,117215,123724,130240,136751,143259,149769,156281,162794,169308,175818,182333,188842,195359,201863,208382,214888,221400,227916,234424,240938,247448,253967,260472,266985,273499,280007,286518,293030,299544,306057,312568,319081,325590,332105,338613,345126,351637,358150,364669,371172,377686,384198,390711,397218,403734,410246,416760,423268,429781,436294,442803,449312,455832,462340,468850,475364,481879,488388,494898,501414,507925,514434,520943,527459,533972,540482,546996,553506,560019,566526,573039,579554,586061,592574,599087,605602,612111,618624,625131,631647,638161,644671,651179,
6331,12663,18994,25324,31657,37987,44321,50653,56983,63312,69645,75978,82305,88640,94971,101300,107631,113965,120292,126629,132962,139288,145620,151955,158283,164616,170947,177275,183610,189942,196272,202605,208935,215263,221601,227929,234258,240591,246923,253254,259587,265915,272249,278579,284910,291242,297575,303903,310235,316569,322899,329226,335564,341892,348221,354557,360888,367214,373551,379882,386212,392545,398874,405202,411539,417873,424200,430531,436862,443191,449524,455856,462185,468520,474851,481181,487512,493844,500174,506507,512836,519166,525500,531832,538167,544493,550827,557161,563488,569820,576148,582482,588813,595147,601477,607807,614139,620472,626806,633133,
6721,13442,20169,26885,33609,40333,47050,53771,60491,67217,73936,80660,87379,94099,100819,107543,114264,120981,127706,134430,141144,147871,154589,161313,168033,174755,181473,188195,194919,201635,208362,215082,221798,228526,235244,241963,248689,255410,262125,268853,275576,282291,289014,295737,302457,309178,315900,322622,329342,336065,342783,349506,356229,362946,369669,376390,383106,389834,396554,403273,409998,416720,423436,430161,436882,443599,450321,457047,463764,470487,477209,483927,490652,497373,504093,510817,517535,524252,530980,537701,544417,551147,557866,564584,571306,578028,584750,591471,598193,604912,611632,618354,625070,631799,638518,645240,651962,658683,665402,672127,
4347,8699,13074,17415,21792,26120,30484,34846,39203,43554,47911,52264,56633,60975,65331,69689,74031,78406,82749,87101,91443,95834,100167,104526,108867,113249,117601,121957,126305,130664,135015,139360,143700,148083,152420,156780,161144,165489,169849,174204,178554,182912,187254,191639,195984,200327,204701,209051,213425,217765,222118,226466,230811,235180,239520,243903,248246,252601,256960,261314,265664,270022,274389,278746,283070,287443,291796,296165,300521,304847,309222,313564,317932,322289,326629,330979,335352,339703,344061,348404,352781,357131,361496,365833,370204,374544,378897,383254,387602,391972,396326,400666,405025,409389,413747,418093,422450,426819,431165,435534,
7026,14063,21082,28116,35143,42174,49196,56230,63253,70282,77315,84343,91369,98393,105428,112451,119487,126514,133539,140566,147598,154624,161652,168682,175709,182732,189764,196792,203822,210850,217879,224904,231937,238959,245992,253025,260046,267079,274103,281130,288162,295188,302218,309247,316279,323302,330337,337360,344392,351417,358451,365473,372504,379529,386557,393587,400614,407643,414669,421698,428729,435759,442792,449810,456845,463869,470898,477924,484959,491982,499015,506045,513074,520097,527131,534158,541182,548207,555237,562271,569294,576322,583354,590382,597413,604441,611463,618494,625527,632550,639578,646609,653637,660663,667691,674721,681750,688778,695812,702837,
4363,8704,13041,17399,21734,26076,30445,34785,39152,43505,47846,52199,56551,60900,65235,69606,73963,78306,82658,87012,91372,95694,100052,104399,108758,113120,117442,121787,126175,130534,134868,139220,143543,147912,152263,156617,160959,165321,169672,174000,178367,182715,187061,191405,195762,200137,204460,208820,213162,217525,221884,226230,230575,234922,239271,243620,247962,252315,256667,261005,265367,269698,274053,278415,282761,287115,291477,295815,300177,304501,308890,313226,317591,321918,326290,330634,334976,339327,343666,348021,352378,356735,361083,365432,369769,374148,378482,382837,387167,391522,395856,400220,404564,408910,413269,417614,421970,426319,430683,435049,
6982,13973,20959,27942,34922,41910,48899,55873,62867,69846,76832,83822,90804,97787,104778,111753,118743,125725,132709,139695,146681,153661,160649,167635,174622,181604,188583,195573,202557,209545,216531,223511,230501,237480,244467,251445,258436,265417,272402,279387,286377,293360,300343,307329,314311,321300,328284,335263,342256,349235,356219,363205,370191,377173,384167,391149,398131,405117,412102,419082,426070,433054,440038,447020,454006,461001,467978,474959,481944,488932,495918,502903,509882,516876,523860,530840,537828,544808,551792,558778,565760,572744,579726,586719,593707,600692,607673,614658,621638,628628,635611,642594,649580,656566,663547,670529,677520,684508,691483,698467,
6388,12775,19159,25559,31943,38338,44731,51114,57508,63897,70285,76681,83066,89447,95840,102234,108621,115006,121398,127788,134174,140568,146958,153350,159737,166120,172518,178911,185293,191681,198076,204463,210848,217242,223628,230016,236416,242798,249183,255572,261969,268359,274747,281134,287519,293917,300301,306687,313086,319468,325864,332246,338639,345031,351419,357801,364201,370585,376974,383363,389757,396142,402535,408922,415305,421697,428089,434471,440875,447265,453646,460034,466426,472817,479205,485595,491982,498369,504769,511145,517545,523931,530317,536712,543103,549490,555880,562271,568654,575049,581434,587825,594220,600598,607000,613383,619771,626158,632541,638938,
6507,13001,19501,25999,32500,38998,45500,52006,58498,65004,71512,78009,84516,91019,97522,104021,110523,117021,123512,130014,136527,143022,149531,156032,162527,169030,175531,182038,188528,195038,201536,208033,214535,221045,227549,234042,240539,247035,253545,260040,266548,273044,279545,286046,292547,299055,305562,312066,318551,325059,331556,338059,344555,351059,357565,364068,370567,377062,383569,390069,396567,403076,409574,416067,422574,429073,435582,442085,448581,455086,461580,468084,474586,481082,487573,494085,500583,507092,513595,520094,526597,533088,539599,546091,552595,559095,565592,572105,578602,585108,591601,598111,604605,611120,617614,624112,630604,637113,643617,650117,
4325,8572,12855,17119,21367,25636,29930,34204,38481,42771,47023,51316,55615,59882,64182,68437,72735,77016,81304,85567,89827,94147,98418,102709,106994,111272,115549,119854,124100,128401,132681,136962,141198,145501,149803,154099,158339,162648,166882,171170,175473,179741,184014,188302,192590,196868,201145,205430,209681,214017,218242,222531,226858,231085,235400,239686,243949,248213,252531,256789,261074,265362,269638,273929,278174,282471,286756,291010,295302,299558,303853,308129,312412,316678,320952,325260,329533,333822,338095,342394,346653,350940,355222,359483,363772,368087,372366,376617,380907,385169,389454,393735,398034,402281,406567,410876,415128,419423,423729,427956,
7426,14862,22300,29733,37168,44600,52045,59468,66915,74339,81771,89210,96630,104077,111508,118939,126380,133812,141245,148683,156120,163541,170976,178415,185852,193272,200705,208150,215577,223016,230449,237884,245320,252750,260173,267621,275049,282489,289923,297357,304785,312232,319651,327085,334525,341956,349396,356826,364251,371694,379122,386552,393992,401426,408862,416297,423725,431162,438604,446023,453456,460890,468323,475755,483200,490643,498067,505495,512932,520361,527796,535233,542666,550092,557541,564966,572401,579838,587269,594707,602138,609572,617008,624447,631869,639314,646744,654176,661612,669039,676484,683910,691346,698777,706208,713642,721083,728507,735947,743374,
5753,11489,17233,22979,28728,34473,40222,45957,51717,57449,63199,68948,74688,80436,86178,91919,97668,103410,109167,114899,120645,126390,132141,137881,143632,149385,155121,160878,166630,172372,178112,183867,189601,195351,201102,206828,212587,218340,224069,229812,235557,241306,247053,252800,258549,264298,270045,275787,281526,287279,293024,298770,304517,310260,316011,321747,327483,333246,338983,344728,350489,356231,361963,367712,373453,379192,384940,390698,396436,402182,407928,413668,419421,425165,430905,436646,442385,448146,453888,459635,465383,471125,476872,482613,488353,494103,499847,505600,511348,517082,522834,528584,534332,540069,545818,551556,557300,563052,568793,574539,
6510,13023,19522,26036,32534,39042,45543,52057,58567,65069,71585,78086,84593,91094,97616,104116,110619,117143,123641,130143,136653,143178,149679,156182,162693,169200,175719,182222,188726,195230,201749,208243,214753,221264,227772,234281,240791,247289,253810,260317,266826,273322,279832,286353,292854,299355,305859,312382,318886,325394,331910,338407,344919,351429,357933,364439,370952,377448,383964,390468,396990,403496,409996,416511,423015,429515,436026,442534,449034,455550,462064,468554,475069,481586,488098,494597,501106,507616,514104,520633,527124,533628,540154,546655,553162,559666,566183,572690,579190,585695,592210,598723,605225,611727,618237,624757,631253,637760,644267,650791,
6388,12763,19149,25520,31901,38281,44645,51031,57422,63794,70175,76554,82930,89311,95692,102066,108448,114837,121211,127590,133959,140343,146723,153107,159483,165871,172250,178632,185008,191392,197758,204142,210524,216899,223279,229667,236047,242429,248797,255185,261561,267941,274320,280705,287078,293459,299848,306220,312601,318979,325358,331743,338115,344496,350878,357263,363636,370018,376398,382772,389148,395523,401913,408298,414677,421049,427431,433802,440178,446561,452946,459328,465722,472087,478457,484845,491231,497604,503986,510360,516738,523130,529500,535887,542268,548646,555027,561402,567777,574155,580544,586920,593294,599676,606061,612429,618818,625199,631580,637960,
6983,13957,20945,27918,34906,41882,48867,55850,62831,69815,76785,83771,90752,97735,104714,111701,118671,125663,132643,139623,146611,153580,160561,167548,174523,181509,188490,195462,202454,209435,216414,223404,230365,237347,244349,251323,258296,265289,272265,279238,286225,293216,300180,307162,314143,321135,328112,335090,342081,349053,356036,363016,369997,376980,383962,390943,397928,404897,411885,418867,425849,432828,439809,446797,453766,460751,467745,474710,481695,488684,495662,502642,509623,516600,523577,530565,537546,544534,551513,558483,565466,572452,579433,586418,593392,600379,607359,614330,621317,628299,635283,642269,649248,656221,663204,670181,677172,684158,691131,698105,
4209,8442,12565,16713,20895,25019,29215,33367,37544,41698,45902,50030,54225,58403,62568,66728,70957,75118,79274,83442,87629,91823,95990,100161,104298,108480,112680,116890,121033,125248,129423,133590,137759,141929,146071,150299,154475,158656,162825,167008,171147,175351,179522,183725,187902,192078,196254,200390,204584,208760,212944,217129,221320,225510,229654,233869,238020,242202,246384,250565,254725,258915,263098,267250,271449,275643,279827,283950,288152,292380,296509,300681,304856,309019,313209,317380,321540,325783,329976,334084,338275,342418,346646,350801,354991,359143,363298,367471,371647,375824,380040,384211,388394,392584,396730,400891,405093,409276,413448,417614,
7479,14957,22432,29925,37394,44876,52359,59836,67319,74794,82275,89764,97236,104728,112205,119680,127152,134638,142119,149597,157081,164562,172031,179521,187001,194483,201948,209430,216916,224401,231891,239358,246842,254317,261800,269274,276764,284245,291726,299207,306663,314167,321632,329103,336592,344085,351563,359038,366513,374002,381472,388956,396437,403912,411395,418869,426336,433830,441307,448788,456267,463755,471226,478711,486197,493681,501151,508634,516116,523594,531068,538551,546027,553509,560981,568463,575941,583429,590914,598396,605872,613350,620829,628305,635793,643281,650755,658243,665708,673181,680672,688134,695631,703112,710590,718061,725548,733033,740522,747987,
4214,8463,12609,16740,20918,25080,29225,33384,37595,41686,45911,50067,54256,58408,62574,66734,70912,75056,79263,83461,87604,91775,95953,100148,104257,108465,112648,116791,120987,125170,129345,133545,137714,141894,146017,150200,154408,158569,162708,166921,171082,175228,179441,183588,187786,191958,196160,200363,204524,208720,212879,217058,221189,225396,229553,233750,237918,242085,246258,250443,254604,258803,262961,267204,271325,275528,279731,283886,288021,292280,296444,300626,304770,308988,313176,317316,321468,325642,329850,334013,338217,342388,346582,350774,354966,359102,363286,367435,371643,375858,380014,384154,388301,392522,396660,400854,405055,409197,413359,417543,
7002,14009,21041,28024,35041,42061,49051,56047,63060,70069,77060,84104,91095,98106,105101,112115,119118,126117,133126,140142,147141,154148,161175,168183,175180,182187,189184,196204,203202,210202,217216,224231,231227,238242,245244,252243,259255,266257,273266,280286,287293,294288,301291,308292,315321,322327,329319,336345,343347,350365,357365,364376,371367,378384,385393,392404,399390,406418,413413,420412,427415,434428,441426,448451,455456,462462,469469,476478,483467,490494,497505,504503,511522,518518,525521,532527,539532,546543,553555,560573,567566,574586,581591,588586,595603,602609,609607,616615,623630,630645,637639,644653,651662,658656,665671,672683,679701,686693,693720,700715,
6444,12850,19287,25693,32119,38535,44963,51384,57808,64233,70661,77088,83511,89930,96347,102773,109202,115626,122044,128462,134890,141307,147734,154166,160586,166994,173422,179854,186283,192699,199126,205552,211991,218428,224837,231282,237679,244107,250537,256971,263403,269812,276218,282658,289074,295511,301908,308340,314773,321182,327624,334029,340457,346878,353307,359735,366161,372585,379010,385421,391853,398278,404702,411136,417531,423963,430392,436820,443237,449683,456095,462509,468946,475346,481793,488210,494635,501055,507485,513903,520321,526759,533170,539587,546010,552444,558875,565299,571728,578147,584559,590988,597407,603842,610272,616676,623107,629537,635952,642398,
6516,13026,19540,26031,32540,39048,45559,52060,58572,65087,71567,78082,84593,91097,97584,104102,110617,117145,123624,130149,136629,143163,149653,156171,162664,169185,175717,182213,188722,195224,201716,208228,214712,221239,227758,234261,240759,247265,253772,260284,266803,273294,279817,286342,292823,299344,305852,312367,318882,325358,331869,338381,344891,351410,357900,364426,370934,377443,383942,390461,396969,403484,409998,416486,422991,429481,435989,442519,449022,455508,462038,468536,475063,481569,488083,494569,501095,507581,514076,520597,527127,533625,540117,546632,553156,559653,566142,572669,579150,585664,592175,598696,605174,611719,618220,624730,631228,637762,644242,650754,
6221,12438,18661,24881,31055,37281,43506,49703,55922,62139,68339,74555,80778,86994,93217,99435,105648,111868,118078,124304,130523,136741,142955,149179,155388,161605,167829,174034,180239,186469,192674,198890,205107,211325,217523,223753,229980,236171,242388,248620,254836,261040,267247,273479,279685,285894,292117,298345,304554,310762,316974,323179,329386,335614,341835,348052,354259,360483,366692,372916,379131,385349,391550,397771,403995,410203,416412,422621,428835,435060,441281,447493,453726,459908,466133,472362,478568,484792,491006,497226,503431,509654,515871,522069,528300,534519,540728,546928,553161,559362,565585,571793,578019,584239,590463,596666,602880,609100,615316,621518,
7599,15190,22793,30398,37989,45580,53190,60791,68389,75984,83583,91180,98793,106384,113982,121589,129189,136769,144371,151970,159574,167181,174767,182371,189979,197584,205166,212774,220377,227979,235577,243176,250762,258375,265962,273562,281162,288758,296350,303957,311560,319164,326754,334355,341949,349544,357154,364758,372346,379958,387545,395145,402739,410334,417937,425543,433148,440755,448339,455942,463545,471141,478737,486327,493930,501538,509134,516721,524310,531922,539525,547122,554733,562318,569943,577512,585119,592721,600328,607913,615505,623115,630718,638319,645920,653506,661111,668709,676308,683911,691502,699076,706694,714295,721903,729491,737098,744702,752303,759894,
4114,8265,12415,16570,20604,24701,28731,32818,36888,40965,45084,49115,53161,57303,61419,65459,69545,73646,77737,81756,85922,89980,94063,98161,102242,106380,110396,114512,118610,122727,126790,130891,134933,139071,143172,147214,151349,155455,159527,163637,167755,171832,175903,179966,184131,188172,192275,196370,200500,204570,208658,212749,216794,220899,224990,229092,233276,237318,241426,245473,249649,253699,257795,261909,265987,270044,274163,278275,282346,286467,290510,294637,298702,302827,306948,310986,315153,319214,323321,327441,331540,335584,339652,343820,347905,351993,356096,360196,364320,368452,372508,376560,380694,384761,388859,392970,397079,401190,405262,409424,
6522,13048,19533,26061,32564,39047,45558,52078,58556,65077,71593,78085,84603,91099,97618,104130,110633,117135,123641,130146,136661,143161,149678,156189,162699,169198,175689,182183,188714,195213,201696,208232,214739,221234,227770,234270,240757,247291,253789,260281,266805,273332,279831,286323,292872,299369,305856,312377,318883,325390,331913,338417,344934,351409,357937,364404,370948,377446,383955,390467,396974,403473,409976,416511,422991,429514,436018,442502,449050,455545,462053,468550,475054,481552,488079,494606,501105,507600,514142,520614,527135,533648,540176,546681,553170,559685,566183,572679,579209,585727,592231,598741,605233,611756,618292,624792,631287,637789,644310,650824,
6446,12877,19316,25741,32192,38621,45032,51476,57900,64342,70784,77213,83633,90075,96509,102956,109394,115835,122246,128710,135120,141582,147999,154444,160858,167300,173734,180170,186586,193026,199444,205914,212335,218766,225198,231635,238081,244513,250954,257378,263803,270238,276689,283135,289562,295997,302428,308874,315298,321734,328157,334612,341025,347482,353915,360335,366766,373219,379668,386100,392538,398959,405391,411829,418266,424717,431157,437569,444023,450447,456879,463343,469764,476217,482628,489094,495517,501941,508360,514789,521254,527679,534111,540540,546966,553421,559851,566287,572735,579143,585604,592032,598448,604888,611322,617750,624194,630621,637055,643493,
7398,14783,22184,29568,36956,44356,51741,59129,66520,73899,81310,88702,96087,103481,110875,118252,125643,133044,140432,147819,155201,162605,170006,177398,184787,192185,199563,206965,214368,221750,229157,236522,243922,251303,258697,266078,273482,280883,288265,295665,303062,310428,317836,325217,332608,340018,347391,354778,362176,369578,376975,384362,391755,399147,406557,413932,421311,428717,436096,443482,450881,458294,465676,473057,480460,487868,495253,502625,510019,517412,524799,532181,539569,546990,554362,561743,569137,576537,583942,591329,598709,606107,613498,620882,628282,635687,643052,650456,657837,665242,672629,680021,687414,694799,702189,709568,716972,724351,731749,739144,
4067,8254,12387,16502,20645,24692,28731,32766,36792,40894,44863,48970,53017,57089,61170,65224,69261,73329,77401,81488,85547,89539,93619,97719,101803,105909,109978,113986,118072,122108,126183,130264,134282,138396,142411,146504,150567,154660,158786,162799,166869,170979,175035,179110,183160,187213,191282,195370,199439,203560,207618,211663,215756,219773,223867,227904,232011,236068,240130,244178,248296,252360,256492,260533,264607,268676,272740,276841,280911,284944,289012,293079,297125,301222,305339,309482,313483,317493,321579,325712,329743,333854,337920,342024,346101,350135,354205,358268,362406,366453,370515,374541,378649,382672,386794,390932,394986,399043,403191,407181,
7407,14773,22168,29551,36927,44312,51718,59105,66502,73872,81261,88641,96036,103412,110817,118201,125564,132970,140361,147751,155141,162539,169923,177310,184690,192085,199469,206847,214245,221625,229008,236405,243787,251184,258576,265949,273342,280730,288124,295501,302889,310271,317675,325049,332435,339845,347232,354620,362001,369401,376769,384158,391562,398958,406335,413732,421109,428503,435895,443275,450647,458051,465456,472830,480219,487606,494979,502385,509765,517174,524556,531940,539320,546735,554086,561471,568880,576276,583661,591035,598417,605828,613217,620586,627985,635359,642760,650123,657514,664906,672312,679719,687094,694455,701865,709249,716645,724031,731404,738794,
4029,8238,12413,16557,20680,24807,29007,32909,36995,41030,45116,49151,53260,57289,61334,65463,69581,73547,77624,81729,85775,89914,93926,98020,102085,106136,110239,114352,118404,122435,126535,130539,134691,138756,142844,146881,150942,155044,159116,163233,167317,171329,175395,179560,183605,187676,191755,195796,199904,203903,208003,212113,216201,220299,224360,228454,232518,236636,240651,244746,248800,252847,256932,261029,265119,269263,273352,277392,281450,285603,289612,293743,297743,301898,305901,310049,314046,318195,322312,326346,330361,334462,338505,342649,346703,350827,354925,358964,363056,367125,371167,375309,379401,383529,387596,391593,395719,399844,403937,407986,
7054,14114,21150,28204,35231,42273,49331,56376,63401,70446,77496,84547,91571,98635,105662,112735,119774,126806,133870,140908,147961,154997,162028,169096,176120,183166,190210,197277,204319,211341,218407,225453,232488,239555,246578,253631,260665,267709,274748,281806,288858,295926,302956,309994,317062,324085,331138,338203,345218,352266,359298,366341,373401,380433,387512,394556,401584,408629,415675,422705,429766,436817,443857,450913,457946,465001,472051,479097,486132,493177,500213,507280,514311,521354,528402,535446,542506,549545,556595,563642,570689,577717,584774,591818,598860,605916,612966,620005,627059,634111,641165,648204,655233,662295,669325,676390,683452,690468,697515,704567,
6973,13969,20958,27933,34915,41897,48904,55887,62863,69826,76825,83788,90794,97760,104740,111729,118702,125686,132682,139648,146656,153617,160621,167621,174593,181576,188549,195545,202544,209514,216487,223495,230485,237453,244448,251422,258411,265411,272380,279361,286361,293339,300324,307304,314290,321273,328248,335258,342220,349204,356191,363178,370149,377133,384107,391108,398111,405059,412070,419060,426018,433005,440016,446998,453962,460947,467944,474943,481924,488907,495878,502872,509848,516839,523835,530790,537777,544753,551756,558720,565710,572711,579698,586662,593647,600639,607612,614616,621581,628559,635542,642537,649509,656517,663517,670484,677457,684448,691443,698418,
6496,13026,19522,26062,32499,39009,45480,52022,58530,64979,71476,77963,84494,90973,97471,103966,110473,116992,123446,129920,136431,142926,149420,155924,162419,168935,175434,181920,188407,194918,201432,207890,214393,220899,227412,233918,240369,246875,253355,259844,266354,272852,279345,285879,292359,298857,305356,311825,318366,324847,331337,337854,344328,350830,357314,363806,370304,376801,383318,389810,396312,402801,409281,415771,422263,428759,435268,441756,448292,454778,461281,467770,474260,480753,487249,493769,500263,506746,513265,519748,526260,532734,539217,545699,552247,558732,565225,571705,578214,584728,591212,597725,604216,610705,617218,623731,630210,636729,643226,649724,
3985,8137,12316,16465,20675,24688,28894,32999,37061,41041,45034,49058,53081,57196,61177,65171,69351,73329,77402,81464,85500,89525,93538,97649,101691,105791,109818,113866,117923,122024,126012,130015,134134,138172,142121,146239,150294,154347,158426,162388,166495,170543,174558,178728,182783,186812,190843,194973,198927,203035,206999,211129,215189,219270,223260,227301,231384,235436,239564,243565,247619,251676,255764,259735,263780,267924,271943,276028,279959,284173,288149,292264,296326,300354,304425,308463,312558,316625,320650,324708,328809,332767,336941,340905,344961,349035,353135,357148,361185,365139,369177,373362,377424,381480,385506,389574,393584,397780,401751,405809,
7697,15388,23101,30780,38496,46177,53869,61558,69257,76964,84654,92352,100045,107730,115432,123126,130822,138510,146214,153931,161630,169310,177007,184705,192403,200093,207779,215501,223175,230898,238578,246277,253970,261686,269350,277054,284746,292457,300188,307866,315550,323269,330953,338642,346351,354052,361757,369442,377137,384849,392539,400215,407924,415605,423310,431003,438699,446379,454092,461796,469490,477182,484882,492577,500273,507986,515671,523379,531066,538756,546454,554169,561866,569549,577255,584947,592642,600369,608033,615747,623416,631143,638833,646555,654236,661946,669626,677334,685037,692719,700412,708109,715792,723522,731196,738901,746606,754281,761998,769685,
5695,11333,16992,22669,28350,34010,39682,45415,51067,56746,62399,68029,73665,79325,84965,90632,96287,101960,107615,113269,118925,124580,130219,135872,141581,147233,152888,158542,164206,169877,175537,181203,186834,192491,198165,203822,209484,215180,220815,226474,232153,237803,243460,249107,254819,260479,266112,271809,277426,283157,288802,294484,300106,305788,311467,317145,322787,328434,334111,339775,345465,351133,356779,362467,368166,373823,379498,385161,390820,396501,402155,407817,413457,419134,424814,430475,436119,441824,447456,453109,458781,464461,470130,475798,481434,487127,492784,498465,504114,509788,515432,521082,526751,532386,538054,543741,549404,555059,560749,566394,
7109,14183,21258,28328,35457,42533,49589,56645,63752,70846,77930,85034,92078,99147,106230,113293,120398,127473,134552,141619,148700,155798,162889,169989,177068,184149,191207,198312,205411,212483,219554,226649,233718,240792,247890,254945,262023,269123,276194,283258,290365,297434,304518,311599,318669,325775,332847,339921,347006,354117,361207,368282,375380,382440,389530,396629,403686,410798,417874,424974,432043,439126,446186,453310,460375,467472,474517,481615,488691,495783,502863,509941,517015,524105,531171,538283,545320,552408,559496,566582,573691,580741,587843,594930,602001,609082,616141,623246,630330,637403,644457,651586,658678,665739,672807,679872,686970,694073,701149,708221,
6435,12864,19310,25747,32136,38547,44981,51413,57853,64311,70758,77178,83583,89982,96415,102824,109252,115670,122110,128528,134944,141393,147803,154225,160626,167063,173512,179915,186347,192802,199228,205660,212077,218506,224897,231367,237770,244155,250642,257046,263487,269893,276332,282750,289200,295605,302047,308465,314879,321308,327732,334202,340593,347049,353442,359886,366311,372724,379142,385613,392003,398451,404878,411342,417734,424191,430583,437020,443448,449860,456269,462736,469139,475560,481992,488407,494842,501251,507702,514113,520544,526950,533432,539786,546252,552652,559100,565519,571938,578397,584820,591218,597659,604084,610483,616937,623362,629829,636196,642667,
7038,14086,21151,28169,35226,42266,49300,56325,63357,70417,77459,84497,91537,98552,105594,112632,119673,126715,133749,140816,147846,154888,161946,168963,175994,183028,190095,197082,204129,211197,218258,225266,232319,239342,246386,253453,260483,267503,274553,281630,288645,295700,302742,309778,316798,323855,330891,337946,344991,351976,359048,366057,373093,380152,387160,394209,401279,408290,415335,422381,429396,436471,443503,450538,457605,464632,471646,478689,485744,492770,499805,506875,513928,520964,528031,535055,542090,549152,556179,563264,570229,577301,584365,591406,598415,605463,612531,619575,626573,633616,640696,647713,654742,661769,668830,675892,682915,689970,696983,704011,
3878,7980,12104,16238,20364,24512,28638,32648,36749,40793,44821,48838,52920,56800,60839,64725,68674,72728,76730,80736,84754,88712,92811,96804,100720,104730,108774,112739,116766,120777,124791,128740,132776,136878,140822,144815,148852,152806,156803,160813,164853,168822,172883,176842,180745,184823,188861,192899,196897,200918,204906,208918,212884,216988,220939,224929,228987,232986,236950,240953,244964,248888,252899,256966,260974,265011,269028,273117,277067,281036,285009,288988,293039,297040,301111,305021,309071,313050,317160,321130,325174,329249,333184,337239,341212,345292,349240,353319,357299,361325,365321,369241,373356,377336,381387,385366,389402,393476,397363,401384,
7427,14867,22259,29677,37103,44545,51947,59337,66754,74163,81583,89011,96429,103853,111272,118666,126093,133531,140921,148361,155750,163180,170585,177993,185402,192821,200242,207670,215065,222491,229907,237326,244753,252140,259588,267017,274404,281856,289272,296672,304106,311518,318953,326361,333779,341172,348613,356008,363449,370863,378282,385700,393131,400548,407958,415359,422765,430185,437624,445033,452449,459855,467273,474703,482125,489551,496967,504378,511783,519205,526625,534041,541476,548877,556283,563736,571129,578533,585942,593384,600783,608198,615627,623052,630489,637913,645304,652730,660147,667535,674955,682378,689812,697206,704655,712052,719492,726877,734335,741727,
6303,12584,18848,25088,31345,37604,43886,50208,56469,62732,69046,75336,81619,87887,94173,100446,106671,112919,119172,125450,131725,137980,144257,150547,156793,163063,169347,175619,181871,188178,194397,200698,206945,213217,219513,225734,232040,238346,244587,250835,257073,263382,269661,275931,282197,288475,294734,301015,307303,313536,319813,326110,332354,338655,344915,351203,357475,363733,370013,376311,382539,388827,395117,401362,407632,413916,420173,426442,432759,439048,445289,451550,457849,464119,470359,476661,482932,489223,495475,501771,508020,514295,520526,526827,533125,539366,545681,551962,558237,564521,570771,577030,583314,589571,595842,602136,608428,614680,620953,627229,
7426,14849,22225,29674,37054,44465,51901,59297,66700,74094,81486,88931,96340,103761,111164,118592,125976,133382,140797,148200,155620,162998,170429,177859,185258,192667,200113,207489,214918,222328,229751,237172,244563,251934,259400,266786,274191,281608,289033,296422,303840,311250,318646,326042,333465,340910,348296,355697,363145,370558,377969,385366,392798,400207,407635,415039,422465,429851,437273,444661,452097,459512,466886,474322,481717,489149,496584,503930,511367,518806,526196,533615,541013,548442,555816,563257,570676,578083,585502,592887,600306,607708,615105,622535,629958,637373,644769,652165,659609,667017,674462,681831,689261,696653,704052,711448,718884,726327,733721,741108,
6426,12858,19314,25764,32218,38601,45002,51412,57846,64272,70691,77169,83572,90039,96445,102903,109310,115704,122127,128509,134968,141373,147793,154211,160642,167081,173492,179938,186364,192807,199236,205666,212041,218517,224928,231368,237778,244203,250620,257035,263471,269879,276306,282748,289169,295616,302024,308456,314847,321286,327734,334157,340584,347020,353460,359854,366290,372703,379120,385551,391965,398406,404827,411254,417665,424070,430530,436963,443377,449828,456245,462672,469106,475526,481955,488387,494795,501233,507673,514112,520532,526959,533388,539792,546244,552656,559105,565522,571960,578370,584787,591235,597649,604077,610500,616951,623340,629769,636224,642649,
6443,12941,19470,25942,32424,38905,45428,51905,58382,64798,71264,77715,84193,90711,97198,103664,110174,116634,123083,129526,136003,142484,148929,155426,161910,168338,174822,181321,187778,194257,200744,207211,213657,220166,226592,233129,239628,246060,252548,259012,265478,271952,278388,284934,291367,297813,304337,310794,317251,323746,330227,336685,343183,349644,356118,362603,369074,375535,382032,388457,394940,401439,407926,414377,420838,427326,433809,440281,446765,453216,459692,466190,472634,479108,485613,492077,498524,505029,511537,517993,524431,530923,537380,543862,550362,556811,563287,569793,576254,582748,589224,595676,602157,608666,615116,621559,628059,634521,641004,647501,
3807,7874,11979,16072,20143,24182,28280,32344,36427,40473,44411,48508,52537,56573,60533,64612,68629,72587,76461,80388,84332,88270,92156,96096,100051,103989,107982,111946,115922,119913,123828,127810,131810,135784,139779,143750,147707,151690,155682,159599,163621,167526,171474,175341,179454,183440,187344,191359,195313,199209,203184,207167,211102,215074,219111,223135,227064,231021,234981,239025,242935,246807,250838,254759,258799,262757,266683,270655,274593,278590,282560,286587,290493,294600,298499,302436,306467,310431,314326,318331,322275,326270,330247,334222,338141,342130,346055,350103,354031,358044,362127,366029,370004,374064,378006,382059,385901,389892,393834,397844,
7946,15874,23802,31724,39644,47564,55496,63443,71341,79273,87193,95122,103053,110960,118889,126826,134738,142685,150586,158547,166450,174405,182328,190253,198173,206106,214030,221954,229895,237811,245740,253669,261593,269532,277446,285373,293329,301244,309173,317100,325017,332958,340903,348824,356751,364687,372607,380526,388458,396387,404291,412241,420185,428079,436017,443957,451883,459815,467760,475677,483617,491554,499477,507407,515310,523259,531188,539107,547045,554962,562887,570805,578745,586699,594619,602539,610472,618409,626323,634268,642179,650066,658025,665971,673881,681814,689744,697670,705578,713501,721448,729391,737329,745253,753196,761100,769052,776981,784917,792816,
*/

詳細信息

Test #1:

score: 10
Accepted
time: 8ms
memory: 74156kb

input:

100 100
2 1
2 5
2 5
2 1
2 5
1 3
2 1
1 5
2 6
2 2
1 6
2 1
1 1
2 1
2 6
1 5
2 3
2 6
1 7
2 4
2 4
1 7
2 4
2 6
2 6
2 5
1 2
1 5
2 3
2 3
2 1
2 2
1 4
1 2
2 3
2 3
2 1
1 7
2 3
2 2
2 6
2 3
1 3
2 6
2 3
2 2
2 5
2 5
2 5
2 5
1 5
2 1
2 5
2 4
2 4
2 4
2 1
1 2
2 3
1 3
2 4
2 2
2 1
2 1
2 3
1 4
1 4
1 1
1 2
2 3
2 2
2 3
2 4
...

output:

0
0
0
2
0
0
1
0
0
0
0
1
2
0
0
0
0
0
0
1
1
1
2
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
2
0
1
1
0
0
2
0
1
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
2
0
1
0
0
0
1
0
0
0
0
1
0
0
2
0
0
0
0
1
0
0
1
0
0
3
0
0
0
0
0
0
1

result:

ok 100 numbers

Test #2:

score: 10
Accepted
time: 11ms
memory: 75720kb

input:

5000 5000
1 24
2 102
1 215
2 24
2 141
2 109
2 252
1 235
2 77
2 278
2 292
1 12
2 201
2 227
2 238
1 152
1 116
2 204
2 122
1 149
2 284
2 254
2 115
2 234
2 203
2 238
2 291
2 58
1 289
2 105
1 33
2 236
2 184
2 57
2 121
2 17
2 245
2 134
1 245
2 73
1 26
2 240
2 15
1 129
2 196
1 23
2 279
2 168
2 48
2 206
2 3...

output:

0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
1
0
0
1
0
1
1
0
0
0
1
0
1
0
0
0
1
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
1
1
0
0
0
0
0
0
...

result:

ok 5000 numbers

Test #3:

score: 10
Accepted
time: 12ms
memory: 76296kb

input:

5000 5000
2 230
2 243
2 77
2 149
2 298
2 176
1 103
2 131
1 127
2 110
1 115
1 220
1 23
2 259
2 290
2 77
2 211
2 249
2 232
2 163
2 55
2 277
2 148
2 171
2 14
2 226
2 70
1 194
1 269
2 277
2 4
2 107
1 246
2 226
2 79
2 219
1 21
2 203
2 4
2 129
2 87
1 114
2 180
2 37
2 202
2 5
2 39
1 28
2 168
2 35
1 184
2 1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 5000 numbers

Test #4:

score: 10
Accepted
time: 146ms
memory: 114164kb

input:

100000 100000
2 56
1 2499
2 5148
2 2178
2 106
2 5422
2 2276
1 1085
2 1681
1 528
1 4743
2 3591
2 4902
2 5943
1 2664
2 5377
2 1923
2 195
2 1765
2 3177
2 3947
2 649
2 4772
2 3331
2 547
2 2908
2 4684
2 2741
2 5343
2 2494
2 3140
2 3823
1 1817
1 5225
2 3689
2 2768
2 6070
1 3584
1 2328
1 1506
2 4544
2 3323...

output:

5205
2591
208
3767
2284
3926
1985
438
1821
416
2614
3977
96
1397
2536
322
1682
100
396
1550
3809
1219
0
594
2058
169
860
2089
2549
5999
1837
2585
23
424
3309
371
383
4510
446
1975
967
547
1136
5210
2279
3656
0
126
1893
311
7977
454
4762
258
2000
2440
3498
2989
7478
2691
608
2620
5296
4403
4699
1925
...

result:

ok 100000 numbers

Test #5:

score: 10
Accepted
time: 133ms
memory: 113632kb

input:

100000 100000
1 771
2 5185
2 1153
1 1611
2 2438
2 3680
2 5272
2 13
2 3069
2 3468
2 2209
2 6050
2 3287
2 1728
2 4981
2 1757
2 3630
2 1746
2 3057
1 726
2 2900
2 2033
2 2601
1 1478
2 214
1 5337
2 3948
2 1703
2 5112
2 5533
2 3558
2 1891
2 3887
2 2952
1 3425
1 177
1 1297
1 1916
2 1754
2 710
2 5212
1 1117...

output:

2149
1638
699
2224
2602
2596
401
1004
4
800
557
2105
3555
2186
2732
3767
1474
1972
3163
4410
2246
1899
1484
143
2349
388
1692
574
691
1414
3048
3147
1865
1487
1970
973
2104
1430
3776
618
750
887
3095
131
2560
3480
1730
3088
1026
3257
1164
122
3208
4370
3212
997
335
524
628
5280
1407
749
321
116
315
...

result:

ok 100000 numbers

Test #6:

score: 10
Accepted
time: 729ms
memory: 267512kb

input:

500000 1000000
1 64861
1 119062
1 65144
1 143894
1 73264
2 33253
2 173191
2 52204
1 40950
2 71504
1 94677
2 28492
2 212348
2 155025
1 189945
2 71636
2 137081
2 129336
1 150409
2 200735
1 127414
2 155968
1 83751
2 29575
1 25125
1 111882
2 83939
1 64246
1 195870
1 14834
2 10887
2 98830
1 197278
2 1160...

output:

16
1
15
4
9
21
36
70
11
24
53
18
2
62
16
30
24
51
32
10
59
122
16
8
5
55
53
22
11
12
17
12
42
70
37
26
13
34
6
101
11
22
18
21
84
30
35
39
67
24
11
8
0
25
40
1
30
42
38
121
23
37
9
9
37
45
30
33
24
5
22
43
43
20
20
14
41
6
10
20
54
36
19
97
32
19
6
48
14
48
48
80
33
2
3
12
18
11
33
1
47
27
54
17
93
...

result:

ok 1000000 numbers

Test #7:

score: 10
Accepted
time: 712ms
memory: 266040kb

input:

500000 1000000
2 99254
2 207080
2 40178
2 203616
2 143664
1 172563
1 235135
1 39267
2 34014
2 240014
2 122830
2 65547
1 190038
1 133892
1 195039
2 242508
1 16681
1 171326
1 179195
1 28872
2 91496
2 196836
1 12722
1 133176
1 49610
1 160238
2 137275
2 82747
2 22809
2 148101
2 18675
1 120676
1 86886
1 ...

output:

90
11
22
19
119
155
49
44
37
66
62
24
11
62
89
56
28
60
10
22
177
10
95
67
57
52
84
126
93
5
106
34
53
37
8
47
53
33
135
30
105
50
51
57
4
101
91
168
11
70
1
46
142
3
131
70
49
98
121
13
61
1
68
61
38
94
20
112
31
159
23
47
47
4
155
135
109
78
142
35
36
9
24
49
0
34
58
95
98
187
91
126
6
32
31
58
63...

result:

ok 1000000 numbers

Test #8:

score: 10
Accepted
time: 765ms
memory: 267200kb

input:

500000 1000000
1 89685
2 77808
2 60421
1 3478
1 174801
2 79073
1 171086
2 189510
2 141242
2 42469
2 197806
1 17953
2 165030
1 200212
2 65004
2 67818
2 86070
1 111422
1 229646
2 68851
1 14764
1 230949
2 71728
1 45456
1 5844
1 191082
1 54319
2 135488
2 24463
1 2976
2 226836
1 57817
2 45114
2 58082
1 3...

output:

21
33
31
22
54
59
25
2
38
39
7
42
45
132
98
12
18
24
5
34
38
36
4
11
41
14
36
36
18
2
33
8
35
42
28
8
13
64
18
41
12
29
67
32
6
34
26
22
33
80
39
66
8
11
84
52
45
120
74
53
9
37
28
59
65
36
29
11
4
38
18
10
6
66
20
22
38
32
21
27
12
37
35
22
29
37
31
6
39
33
38
13
36
68
39
21
77
28
46
38
33
30
12
7
...

result:

ok 1000000 numbers

Test #9:

score: 10
Accepted
time: 1074ms
memory: 290228kb

input:

500000 1000000
1 6055
2 7862
2 1392
2 1440
2 15064
2 460
1 29587
2 3993
2 29185
2 29543
2 583
1 19479
2 28783
2 26722
1 17041
2 10894
2 3234
2 25053
1 15206
1 6122
2 25838
1 28948
2 25858
2 27787
2 19146
2 27381
2 20541
2 24645
1 16937
2 3163
2 3194
2 25925
2 11649
2 20379
1 7937
2 1913
2 18048
1 94...

output:

411
2
789
108
281
204
76
509
45
647
9
16
279
164
433
63
173
217
324
86
107
43
202
535
464
94
64
227
267
46
13
350
216
218
575
73
128
230
365
285
131
200
75
364
9
46
8
35
271
81
100
563
436
225
545
129
255
115
150
854
115
133
119
108
517
108
726
255
32
147
292
190
78
319
79
64
176
100
360
100
289
349...

result:

ok 1000000 numbers

Test #10:

score: 10
Accepted
time: 1070ms
memory: 288448kb

input:

500000 1000000
1 21782
1 23178
2 3615
1 22855
2 689
2 18959
2 17609
2 21923
1 28277
2 16406
2 7256
1 10175
2 25925
2 15485
2 25959
2 25908
1 20117
2 14563
1 25592
2 15719
1 9408
2 9539
1 28533
2 14576
2 2884
2 2701
1 13792
1 4222
2 21169
1 9207
2 17859
2 21128
1 3543
1 25941
2 4987
2 2529
2 20743
2 ...

output:

22
96
178
186
24
410
355
316
152
349
7
628
247
152
573
216
101
30
172
189
76
8
127
95
351
69
181
139
204
175
261
6
195
96
211
39
159
550
126
40
259
324
252
48
126
342
143
513
235
331
142
173
153
257
133
120
252
318
178
775
161
216
146
18
221
78
214
248
180
172
196
180
262
501
155
149
149
228
127
187...

result:

ok 1000000 numbers

Extra Test:

score: 0
Extra Test Passed