QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#613817#9449. New School Termucup-team3161#AC ✓203ms80128kbC++144.8kb2024-10-05 14:49:052024-10-05 14:49:07

Judging History

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

  • [2024-10-05 14:49:07]
  • 评测
  • 测评结果:AC
  • 用时:203ms
  • 内存:80128kb
  • [2024-10-05 14:49:05]
  • 提交

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
//#define int long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	for(;!isdigit(c);c=getchar())f^=!(c^45);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	return f?-x:x;
}

#define mod 998244353
struct modint{
	unsigned int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x<o.x?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,modint b){return a.x==b.x;}
	friend bool operator !=(modint a,modint b){return a.x!=b.x;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

vector<modint> fac,ifac,iv;
inline void initC(int n)
{
	if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
	int m=iv.size(); ++n;
	if(m>=n)return;
	iv.resize(n),fac.resize(n),ifac.resize(n);
	For(i,m,n-1){
		iv[i]=iv[mod%i]*(mod-mod/i);
		fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
	}
}
inline modint C(int n,int m){
	if(m<0||n<m)return 0;
	return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 2000005
#define inf 0x3f3f3f3f

int n,m,a[maxn],b[maxn];
int fa[maxn],s[maxn];

int gf(int x){
	while(x!=fa[x])x=fa[x]=fa[fa[x]];
	return x;
}
void mg(int u,int v){
	u=gf(u),v=gf(v);
	if(u!=v) {
		fa[u]=v;
		s[v]+=s[u];
		s[u]=0;
	}
}
int c[maxn];

bool f[20005];
int ct[20005],pre[20005];
int szf=0;

bool chk(){
	int sum=0;
	For(i,1,n*2)sum+=c[i]*i;
	sum=szf;
	if(sum&1) assert(0);
	sum/=2;
	memset(f,0,sizeof f);
	f[0]=1;
	For(i,1,sum)if(c[i]){
		memset(ct,0,sizeof ct);
		For(j,i,sum){
			if(!f[j] && f[j-i] && ct[j-i]<c[i]){
				f[j]=1;
				ct[j]=ct[j-i]+1;
				pre[j]=i;
			}
		}
	}
	return f[sum];
}
int nd[maxn];

int vis[maxn];
vi  buc[maxn];

int ck[maxn];

signed main()
{
//	freopen("data.in","r",stdin);
//	freopen("my.out","w",stdout);
	n=read(),m=read();
	For(i,1,m)a[i]=read(),b[i]=read();
	For(i,1,n*4) {
		fa[i]=i;
		if(i<=n*2) s[i]=1; else s[i]=-1;
	}
	c[1]=n*2;
	szf=n*2;
	Rep(i,m,1){
		ck[i]=-1;
		if(gf(a[i])==gf(b[i]) || gf(a[i])==gf(b[i]+n*2)) continue;
		int u=gf(a[i]),v=gf(b[i]+n*2);
		int w1=abs(s[u]),w2=abs(s[v]),w3=abs(s[u]+s[v]);
		--c[w1],--c[w2],++c[w3];
		szf+=w3-w2-w1;
		bool ok=chk();
		if(ok){
	//		cout<<"dif "<<i<<"\n";
			mg(a[i],b[i]+n*2);
			mg(b[i],a[i]+n*2);
			ck[i]=1;
		}else{
	//		cout<<"sam "<<i<<"\n";
			++c[w2],--c[w3]; szf+=w2-w3;
			
			v=gf(b[i]);
			w2=abs(s[v]),w3=abs(s[u]+s[v]);
			--c[w2],++c[w3]; szf+=w3-w2;
			
			mg(a[i],b[i]);
			mg(a[i]+n*2,b[i]+n*2);
			ck[i]=0;
		}
	}
	
	int sum=0;
	For(i,1,n*2)sum+=c[i]*i; sum/=2;
	cerr<<"sum "<<sum<<"\n";
	chk();
	assert(f[sum]);
//	exit(0);
	
	int now=sum;
	while(now) /*cout<<"pre "<<pre[now]<<"\n",*/nd[pre[now]]++,now-=pre[now];
	
	For(i,1,n*4) vis[i]=-1,buc[gf(i)].pb(i);
	For(ii,1,n*2) {
		int i=gf(ii);
		if(vis[(i<=n*2?i:i-n*2)]!=-1) continue;
		
		int sz=abs(s[i]);
		int s1=0,s0=0;
		for(int x:buc[i]){
			if((x<=n*2)) vis[x]=1,++s1;
			else vis[x-n*2]=0,++s0;
		}
		if(s1>s0){
			for(int x:buc[i]) {
				if(x<=n*2) vis[x]^=1;
				else vis[x-n*2]^=1;
			}
		}
		if(nd[sz]){
		//	cout<<"flip "<<i<<"\n";
			--nd[sz];
			for(int x:buc[i]) {
				if(x<=n*2) vis[x]^=1;
				else vis[x-n*2]^=1;
			}
		}
	}
	For(i,1,n*2) cout<<vis[i];
	int ss=0;
	For(i,1,n*2) assert(vis[i]!=-1),ss+=(vis[i]!=0);
	assert(ss==n);
	Rep(i,m,1){
		if(ck[i]!=-1){
			if(ck[i]==1) assert(vis[a[i]]!=vis[b[i]]);
			else assert(vis[a[i]]==vis[b[i]]);
		}
	}
	return 0;
}
/*
3 1
1 2


3 2
5 6
4 6

6 3
1 2
2 3
3 4
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 13ms
memory: 63080kb

input:

2 4
1 3
2 4
1 4
1 2

output:

1010

result:

ok Output is valid. OK

Test #2:

score: 0
Accepted
time: 4ms
memory: 65056kb

input:

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

output:

110010

result:

ok Output is valid. OK

Test #3:

score: 0
Accepted
time: 10ms
memory: 60924kb

input:

1 0

output:

10

result:

ok Output is valid. OK

Test #4:

score: 0
Accepted
time: 4ms
memory: 65052kb

input:

1 1
1 2

output:

10

result:

ok Output is valid. OK

Test #5:

score: 0
Accepted
time: 8ms
memory: 62952kb

input:

2 3
2 4
3 4
1 2

output:

1001

result:

ok Output is valid. OK

Test #6:

score: 0
Accepted
time: 7ms
memory: 63008kb

input:

3 8
4 6
3 5
1 4
2 4
1 6
1 2
3 4
4 5

output:

101010

result:

ok Output is valid. OK

Test #7:

score: 0
Accepted
time: 7ms
memory: 62968kb

input:

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

output:

10101001

result:

ok Output is valid. OK

Test #8:

score: 0
Accepted
time: 8ms
memory: 65024kb

input:

5 16
3 6
9 10
2 7
1 10
1 5
2 10
3 5
5 6
3 4
2 5
4 5
3 8
4 7
6 8
1 6
7 10

output:

1101000101

result:

ok Output is valid. OK

Test #9:

score: 0
Accepted
time: 14ms
memory: 65144kb

input:

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

output:

001001110110

result:

ok Output is valid. OK

Test #10:

score: 0
Accepted
time: 4ms
memory: 63100kb

input:

12 153
1 24
16 18
7 14
1 16
20 21
9 14
21 22
4 5
17 24
4 12
5 17
13 24
14 15
12 23
12 16
8 11
14 24
9 16
2 5
6 19
11 17
4 22
4 7
6 16
7 20
8 15
5 24
2 10
10 21
21 24
1 12
11 19
18 21
18 24
12 17
13 22
7 9
13 23
4 9
11 13
15 21
5 7
2 4
15 16
17 19
11 16
11 20
7 8
4 15
13 14
6 18
2 19
9 13
23 24
4 21
...

output:

111100011001101110000001

result:

ok Output is valid. OK

Test #11:

score: 0
Accepted
time: 8ms
memory: 65216kb

input:

259 33757
472 500
65 336
138 469
307 442
427 458
43 239
17 508
460 466
108 393
79 92
250 483
44 277
17 132
35 57
155 499
184 474
246 272
274 418
457 458
338 372
196 514
31 208
117 187
90 229
153 284
189 355
16 337
146 456
269 271
279 412
305 336
303 441
399 472
85 286
91 97
157 437
137 379
71 360
27...

output:

111000110010111001101110000111000000011111100010101100100010001110101101111110000111000101111100010110101110111100011010101100111010010011101010011010011010011101100111001011110001100111000010101011100110110001001010010010101010010110011001100001010110000100001110101110000010110001010010000110110011...

result:

ok Output is valid. OK

Test #12:

score: 0
Accepted
time: 28ms
memory: 67604kb

input:

811 265557
217 1153
383 1609
165 177
612 1602
1057 1428
37 436
135 1200
368 684
448 722
145 1583
325 1052
246 480
74 148
122 1111
1256 1327
304 1070
1285 1542
802 813
454 1563
265 1193
94 848
432 1156
429 1194
427 1230
1152 1406
1329 1355
702 845
591 1232
877 1288
1257 1549
340 659
1080 1333
910 137...

output:

110111111101000111011111111101011110100101000101001000000001111000101111010100100101110100110101000111110100111100100110111110100101110101111100011110101010011001101010100110010011011111011011110101111111011000001100001101110111111110100010011100011110111111010001011111110110011111100001010011011101...

result:

ok Output is valid. OK

Test #13:

score: 0
Accepted
time: 42ms
memory: 67792kb

input:

1691 323743
1246 2397
1445 2647
2010 2806
2001 2896
802 2258
2679 2976
2203 2875
2445 2698
137 3004
536 1800
2316 2520
594 1517
279 1558
1934 2871
57 1358
357 976
1764 2672
869 2137
1694 2201
491 1906
1177 1414
1304 1377
2454 2653
626 2637
1425 1677
620 876
1326 2085
404 874
626 1565
136 597
2885 31...

output:

111010001000000110110000100100010011101101011001011100101110000011100010001111000001000010100101111010111000111000110011100100110000110001001101110010110111110110110010100101010101000100100010111001011011111110010011000011110101000111011010010110101011011001001110100100110001100101111100111011101010...

result:

ok Output is valid. OK

Test #14:

score: 0
Accepted
time: 64ms
memory: 64248kb

input:

2891 285302
2273 3206
2376 4737
1075 5673
2493 5453
548 1902
603 1376
1948 2985
108 4730
2172 2948
947 1758
762 1558
2813 5701
2287 3502
297 1501
568 4247
4569 5071
832 3005
412 4226
1813 4519
726 3017
1658 3990
1771 3230
1705 2149
765 4782
5420 5652
3089 4727
4362 5054
1578 3729
1111 5740
2234 5691...

output:

110001001000000110011000111101001110110111100101011110101001010100100000100100000111010001100111111110000101010101101110111000010001001011000100110000000111001101010111111001011100000001001110101111110101010111000111000000000101011000110101011110001011100001000000000101011001001110001100001000110001...

result:

ok Output is valid. OK

Test #15:

score: 0
Accepted
time: 127ms
memory: 70216kb

input:

4413 717147
1990 3721
2169 8724
2894 5350
4689 5732
274 3456
3149 5664
463 6517
3482 7460
1820 5440
2995 6364
5476 7590
5989 8692
4286 7015
7520 8630
524 7821
3335 7017
1491 4477
6238 8230
6339 8087
565 8666
6188 6930
4280 7015
4393 8825
3686 6189
3711 6905
888 1997
2488 8544
9 3914
5135 5322
2778 6...

output:

101101100111010000110001100011010100101110101111100111111001010100010110110001010001100100001010011100001001011011100110011000000101000011111100011001101011101100001010111001111101110001011100001011101001101000011100110101011100101110110010100010111111110011011011010101001000000111100101110110001111...

result:

ok Output is valid. OK

Test #16:

score: 0
Accepted
time: 52ms
memory: 75400kb

input:

707 998991
16 83
733 1195
318 945
9 385
764 1338
396 833
408 1331
541 1405
167 1351
572 838
16 334
36 1071
765 873
445 930
48 168
857 1306
1066 1408
270 720
116 698
737 1136
460 1074
585 1195
492 690
1103 1122
698 1239
623 1355
30 140
952 1088
776 1138
71 525
690 1194
357 1062
366 632
46 744
312 520...

output:

110110010110010001001101110000000111110101010001100010101010010001101011001110011110101101100100001101010001001101000011010101001101001010110010101101001110111001000000010111010100000100011011011010101101110101111000100001101000000000001001111111000010110011110000100111010110110110000000010011101100...

result:

ok Output is valid. OK

Test #17:

score: 0
Accepted
time: 4ms
memory: 61592kb

input:

5000 0

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Output is valid. OK

Test #18:

score: 0
Accepted
time: 18ms
memory: 67664kb

input:

5000 1
5104 7449

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Output is valid. OK

Test #19:

score: 0
Accepted
time: 11ms
memory: 65768kb

input:

5000 13
8215 9259
4067 7015
4171 6513
1958 9790
5814 6551
711 3995
4392 8567
224 285
4618 4637
2864 8137
1910 2618
1881 5086
5503 9167

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110111111111111111...

result:

ok Output is valid. OK

Test #20:

score: 0
Accepted
time: 8ms
memory: 67692kb

input:

5000 55
7866 9685
3869 9188
3142 5921
1328 5189
1186 4841
2865 4732
5504 5634
983 5412
6630 7625
6123 9142
2937 5558
1344 5103
5443 9618
3579 6083
1044 3407
1028 6125
2895 5649
2986 3484
3659 6044
5673 7508
276 5982
694 4033
1089 6272
2661 2831
6962 9163
2717 8822
4363 5916
249 8966
9331 9920
1551 2...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Output is valid. OK

Test #21:

score: 0
Accepted
time: 49ms
memory: 65408kb

input:

5000 5000
4509 6534
1710 4635
1694 2754
3105 5501
6490 6786
4306 6866
483 6111
9513 9773
217 5738
4794 5634
2466 9426
4015 6665
596 4471
1608 8259
5463 5568
5672 5975
5791 6415
150 3738
487 9066
4093 6191
534 3270
2444 5041
4873 7509
6286 7749
3655 5175
414 9604
4068 9379
884 3731
3797 5637
6712 752...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111111110111111111111111111111111111111111110111111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Output is valid. OK

Test #22:

score: 0
Accepted
time: 172ms
memory: 78616kb

input:

5000 1000000
536 2549
4636 9544
1417 8603
2634 4970
511 8885
7042 9446
1807 2806
4633 8212
1638 8794
2918 8150
1423 5343
2615 6301
7023 8526
2950 7562
6777 7968
4787 9333
4122 9857
993 6039
5459 6837
5589 7246
1644 9641
1778 7305
1334 1568
1436 9323
4902 6285
5497 6384
1584 4996
6710 8356
1371 9492
...

output:

000001011111110111110110001011101100100100000101011010000010001110100001110111111001001111110101001100000001011100111001110011110011001111001100010010101000110001100101011011011100000011001011110111101100101100011111001011001110100000000110110100000000111111110110101001100000101010101001110101010101...

result:

ok Output is valid. OK

Test #23:

score: 0
Accepted
time: 195ms
memory: 72412kb

input:

5000 495000
1927 6272
319 8402
7428 7719
289 7279
5807 8628
6140 8646
4075 8413
696 5688
7701 9351
750 1728
6564 9033
6745 8163
966 3952
237 4595
354 6037
1298 9484
4760 6554
6813 7184
2000 5589
6527 7736
4393 4431
1085 5833
961 2976
1825 5871
7586 7938
2821 6067
2614 3037
4690 7071
1379 2915
2549 5...

output:

000010101110001110011100111010011110010011011111010010111001101111110101000111110100010101101001110001011111110011011111011011101111000001000001101010011010111101001101000111010000101011111000010011100100010101001001101000011011010000101001100010001001100001100111011110111010011100111001011101110111...

result:

ok Output is valid. OK

Test #24:

score: 0
Accepted
time: 119ms
memory: 79572kb

input:

5000 1000000
3687 8461
3809 9814
337 886
3428 9892
942 2973
8524 8951
925 9543
6849 8148
2376 3949
4190 4259
4199 6096
8339 9711
6516 7797
5545 7674
209 3223
662 5715
5678 8384
2169 7775
3548 7901
4428 9843
7170 8981
298 7908
4289 7413
8303 8786
995 7546
2742 6757
6629 8339
9288 9984
2515 3621
3395 ...

output:

110111110111101011111011011101101011111101111111110111111011101111101110111111110111111101101101011110011111111111000001011001111100111111110111011111011011111110111101111011011101110111011111111011111011111111110110101111101010011011111101011110111010111111111110111011110101011111110101001111111011...

result:

ok Output is valid. OK

Test #25:

score: 0
Accepted
time: 75ms
memory: 63136kb

input:

5000 9999
737 5889
737 4882
1887 4882
848 1887
8 848
8 5179
1297 5179
1297 9208
3815 9208
3815 3829
3829 9033
2270 9033
2270 4697
4697 7133
5327 7133
5327 7338
5589 7338
161 5589
161 3595
3049 3595
3049 4758
4758 5690
5381 5690
3553 5381
3553 9020
444 9020
444 9065
4259 9065
141 4259
141 4156
4156 4...

output:

101101000000011011010001001110101011000111110001000111101111110101110000011001110011110111000110111110011111010110000111100101100001111011000000101000000100011011000011000011110111010010011100111001000101001110010011000011000001001001001001001001110010011010100100000110111100111111001010000001000111...

result:

ok Output is valid. OK

Test #26:

score: 0
Accepted
time: 179ms
memory: 72952kb

input:

5000 1000000
319 8267
8030 8267
5231 8267
3908 8267
2559 8267
4944 8267
6340 8267
3107 8267
4472 8267
5497 8267
8267 9008
8267 9327
6568 8267
4094 8267
3208 8267
2123 8267
5123 8267
7920 8267
3334 8267
597 8267
1555 8267
1776 8267
3302 8267
458 8267
2460 8267
8087 8267
4228 8267
2656 8267
1427 8267
...

output:

111001000011011011000000110000000001111100100010110000101001011111011011111111101101000111100001010011111100111111110001110101111010011010001000100101011000000001110111001010111101110010010111001010111111111100001101010111000011011011010111001101010100001000110100000000110000010000001111100110010100...

result:

ok Output is valid. OK

Test #27:

score: 0
Accepted
time: 189ms
memory: 77168kb

input:

4999 1000000
1945 9713
2776 5105
5767 7670
2100 5473
3738 8249
5250 8261
2562 4814
4236 7034
2759 9809
1694 2258
6762 8267
478 7929
7509 8920
2821 7747
1443 8354
5120 7961
1265 9374
1358 1653
3249 3272
2454 3235
6815 9797
4779 5118
256 2040
5358 9038
2108 6963
2100 2691
948 5754
1077 9015
4637 9604
...

output:

110011010101001100100000101100101111100111100001110001001111101001000100011100010000111000100001001001111010000011111110010011111110001110100110010100001110111100110100010111101001111000011110011100011110011101011100000110010100100000001011001100011100000010111101101010001001000110100000110011001000...

result:

ok Output is valid. OK

Test #28:

score: 0
Accepted
time: 195ms
memory: 80008kb

input:

5000 1000000
4980 8636
1052 3782
7313 9788
374 6889
3746 9997
461 681
7184 9385
2132 4804
7844 9531
7148 8934
2509 4526
6073 6224
5981 7708
3066 4740
1769 8879
680 8142
3104 4153
5770 7300
9068 9797
5065 9659
1635 3293
3971 9835
261 5325
1700 6717
8220 9097
3576 7780
1890 8103
375 8874
8241 9797
208...

output:

111011101001010111100100000101111000100010111111101110010010001111100101110010001101001101101000111111110100000101110001101011010000001000011111110001001001001011010001111000010101101111101010101011010000100101000111001000000011011010110000100110110110101011101010111000110000010110111111101100110110...

result:

ok Output is valid. OK

Test #29:

score: 0
Accepted
time: 189ms
memory: 78068kb

input:

5000 1000000
74 9153
4917 5790
4122 6469
1392 9264
1162 1632
1197 2061
7323 9433
4370 9733
4373 8630
4049 9485
3642 6161
1723 4342
6700 9774
1449 5884
2114 9928
8673 9179
863 2883
8565 9042
2661 8507
3660 6765
740 863
3398 9983
147 890
2620 4485
7225 7616
1585 3182
9766 9780
2193 3702
18 7854
5503 6...

output:

101111101010100111111111101000111110010000010101110001100000000110110101000100101011101100100100010001101100000011001100000011001100000101001001001101001000100100011111000111010000011100010011011101000100010010001011110101111011010111100011010011110110010101100001110100101110110001110111001011000101...

result:

ok Output is valid. OK

Test #30:

score: 0
Accepted
time: 185ms
memory: 80116kb

input:

5000 1000000
3050 6455
3939 8403
1874 6162
2986 9941
852 5801
386 8466
495 7499
2459 9308
1686 4443
987 9119
4630 9635
176 1818
2640 4939
2486 8111
40 2084
2082 9813
1667 4883
3483 7503
2102 7413
8936 9473
346 4056
3327 6577
1735 2825
219 3217
2254 2724
1248 3728
1351 2485
3190 6930
82 2364
2423 636...

output:

110110010101101111101000100001001001000101101011100010110001100001110001010110111110101010111011010011011101010011011101001001010101101010111110110010000111100101101101010101110001111011010000011010011101000011000100111100011110101100101011000100110110110101011110000001110100001101100100000001101010...

result:

ok Output is valid. OK

Test #31:

score: 0
Accepted
time: 195ms
memory: 77724kb

input:

5000 1000000
6538 8438
4304 6693
7065 9302
3037 6801
4095 8249
1276 4477
2408 4434
2478 6247
6004 8935
4466 4715
1151 6515
1250 1889
2978 9379
1037 2639
7076 9796
169 586
3736 8350
868 1764
3907 7679
7664 9936
828 2117
4033 9026
5491 9378
5238 9408
5088 9303
4869 7800
1637 8981
264 8603
2800 5449
36...

output:

110111101101101000011100010111101010101000111011100111100010111101001101111001111010001101011010010111110111000011001011100110110011011001001111111101001000101001110010111011111001000001111000111000001101001111011111001010001011101100111111011001100100011110000111100111011111101111100100001111011101...

result:

ok Output is valid. OK

Test #32:

score: 0
Accepted
time: 195ms
memory: 77476kb

input:

5000 1000000
152 9616
1878 6998
7011 8703
7012 7957
8663 9347
377 1848
2810 8371
5223 7129
5963 7439
3732 9489
6426 6946
864 4359
3238 3410
2484 4641
3483 9331
1922 6128
3317 4347
324 4982
5504 6662
2721 8761
2458 2659
2368 5704
4627 7763
2387 5113
2579 4441
1442 3001
2839 8264
7684 8096
6554 9437
8...

output:

001111100000101001100100101001100011001110100111100110110100111100011100011110011011011111101101010100000010000001000010011101000001101000101001000100110110101001010110111011100011010101001110101000001100001111001111011000100101010010101101111101110000101100111000001010101111100010111101101011011101...

result:

ok Output is valid. OK

Test #33:

score: 0
Accepted
time: 193ms
memory: 77664kb

input:

5000 1000000
6363 8874
2676 6983
2507 9814
2321 6709
5513 9479
758 3802
9174 9303
7570 9399
1423 5184
2375 7455
4267 7936
1276 5976
266 8988
3255 3705
1558 8265
4726 9077
48 5976
1698 3731
2252 4859
1812 5083
1232 7595
900 8956
352 1881
4008 8624
1571 9422
1558 9355
6453 9026
5316 5885
4216 6621
298...

output:

100001100000110110001001011010111011100101110111011010000100000010000010000101101001010001110111101101010111000001000010000010100000100001001101101000100000001100101111110000010011110011101100000100010110110011000011001111111000110111010110111010000001000011001100010101111110111011000111001011100111...

result:

ok Output is valid. OK

Test #34:

score: 0
Accepted
time: 189ms
memory: 79356kb

input:

5000 1000000
5592 8823
558 8973
3456 9325
989 6727
2728 5609
159 8441
2163 6138
2860 5609
222 1961
3402 5663
5540 8423
2359 5363
1308 6363
7222 9634
5873 5885
1628 4692
7493 9959
6685 9965
990 6787
1823 9071
3839 6841
613 1071
673 8872
147 7105
4082 4633
2485 6375
217 5938
3840 6542
4515 7914
1520 6...

output:

001101100110110000110110000000100100010111010011100000111001100100110110001001110100011101100000011101101111100101110101011010101000001111001100111000100010111110011100010011100111011010110111000001110011010110010011110001000001011110010110101110110101111101111110110001101111001111010111101111110001...

result:

ok Output is valid. OK

Test #35:

score: 0
Accepted
time: 194ms
memory: 80128kb

input:

5000 1000000
1512 4189
7097 7367
192 8916
281 6863
6620 7934
2332 3221
388 3532
1174 1192
110 1581
5932 7670
2408 3278
2082 6702
3532 7992
426 7807
3394 8390
3705 7989
2339 5543
177 7407
5035 9000
3341 4549
1813 8938
7684 9075
5743 5783
2272 3928
9209 9435
1581 8409
30 2352
1420 2927
3714 7892
1404 ...

output:

011001010110101000100111000101111010011111101110010101011110011101010100101001010001000010001011010011111000010110010011010111011011000000001101111000011011001101100000110101101110110000101111001101100110011010111100011010001101111100011110111110111110111111101001111001000001111010100001010100011011...

result:

ok Output is valid. OK

Test #36:

score: 0
Accepted
time: 192ms
memory: 80064kb

input:

5000 1000000
1545 5876
1896 8371
7435 9094
4668 8702
2100 6691
1229 1240
131 6938
2175 5121
1236 1952
1900 7209
2991 7327
1433 1569
5409 5735
3172 7452
443 5807
1962 5929
1021 6314
1553 5980
4858 9394
4624 6587
5000 5255
650 2134
6695 7151
7423 8793
1564 5828
4020 6259
336 6229
6483 6495
3602 9751
1...

output:

111100010011001111100001110011111001000001011000011001100110111011101110110110100111011111001010010010111000000101101110101001010010000001110001110100101000010101110101100010001011101100011110101010000111111000000100111000100111010100100110000000000011101110010101110100000011001010001010010101111101...

result:

ok Output is valid. OK

Test #37:

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

input:

5000 1000000
4031 7636
2710 8599
1847 3793
3022 5832
3254 5604
1560 9907
76 2375
6979 9429
1669 7410
3578 5803
1510 7209
2981 7862
1847 2141
7433 7995
1881 8693
3793 5739
6089 7660
6548 7767
2961 8216
1532 9092
9504 9507
6979 7304
563 7127
435 3028
7283 9777
5304 7302
3463 5286
1442 9716
3439 6414
4...

output:

101110000110010010000101101011100001001101111100010101101011011101110001001101111100100101001000001010000011010100100011001010010111111000100010101000001000000000111001000011100000110101001000001101101101011101010100100111100100111111000010110110011000000011000010010000011011011011001101101011110010...

result:

ok Output is valid. OK

Test #38:

score: 0
Accepted
time: 197ms
memory: 77344kb

input:

5000 1000000
1991 3681
7662 7810
1492 3512
5242 5846
3955 4823
5456 9277
5901 6044
3805 8683
1324 7913
1964 2455
885 8157
3162 3932
6849 8831
1417 2184
3220 9562
1813 4698
7917 9125
2449 7498
5274 9525
127 4338
2517 6373
3648 4394
2019 2194
5903 8896
5137 7615
1263 4179
6055 6322
1233 1973
6914 8987...

output:

001010111110001110110001100001101010001011001100000000110000001100100111000011010000111110011011010100111100010110110111100101100000011011011000111110010000001010110001101000000010000011011101010011110111000000010100111110101000000010010100000001101101101011011110111011110000011000100010100111101010...

result:

ok Output is valid. OK

Test #39:

score: 0
Accepted
time: 203ms
memory: 69316kb

input:

5000 192643
1651 2284
1275 2284
1275 1592
1027 2284
1027 1592
1027 1216
843 2284
843 1592
843 1216
843 968
691 2284
691 1592
691 1216
691 968
691 784
555 2284
555 1592
555 1216
555 968
555 784
555 632
427 2284
427 1592
427 1216
427 968
427 784
427 632
427 496
303 2284
303 1592
303 1216
303 968
303 7...

output:

111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111...

result:

ok Output is valid. OK

Test #40:

score: 0
Accepted
time: 163ms
memory: 77676kb

input:

5000 1000000
7710 9828
3419 8943
6873 8522
483 8368
1358 4886
1392 8682
5871 9778
6239 9414
4905 7202
364 9391
3701 9368
7651 9022
3260 9758
1885 9887
894 2006
1105 4554
2281 4875
2045 8552
4445 7162
161 6908
1721 3309
3352 5539
7963 8600
402 2008
1720 6606
3402 5029
1455 2927
8557 9203
146 1702
134...

output:

101101101010010111000111111011000011100100100110110001011110001011110011110010110110101101111101111010011010011000010101000011001010100011100001101111000001100111100100101001010101100010011011000101100111111010100010011101000011100010111011001111011111010100100101011101101110100110111111011011001000...

result:

ok Output is valid. OK

Test #41:

score: 0
Accepted
time: 179ms
memory: 76000kb

input:

5000 1000000
3420 6333
2013 3592
1358 9366
1759 8622
757 8951
1785 7499
8985 9206
1475 6110
6161 6785
5009 5172
4778 8463
5690 6912
3897 6128
969 7380
416 8184
544 2675
3049 5270
5118 9305
3874 6942
3845 8315
810 1551
5058 7576
7994 9175
2449 8068
7694 8084
1282 4753
741 8495
3737 9174
4656 5293
262...

output:

110000110011010110010011101101110011100010111100001001010100010110101011001010010001001110001100010000011011110001100111000110111010100110010000100000111100111100110100111000010110010001010011011111110101111111011001101101110100010101010001111000011101111100011100111111110001000111000111010101001100...

result:

ok Output is valid. OK

Test #42:

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

input:

5000 1000000
4485 5659
4251 8327
3032 9771
1212 6150
6162 7038
5511 7556
431 5575
125 1024
5183 9691
3049 9866
3319 9057
7378 9590
2433 6119
6487 6604
4825 5723
1298 5093
1982 5060
7658 9662
3939 8488
902 5122
1082 6614
2293 3432
4787 7443
3217 8326
4857 6751
2046 3085
2346 8018
5836 9377
2467 5164
...

output:

111101011010000101000001111011111010101011000101001111010101010110110101010000111100110101101011000000110001010110011110010000010001100011110111101010110100100010111010111111100001010010101110100111110011000011000001101000000001011111010010100111011110001110000010011110110001001011111010101110111110...

result:

ok Output is valid. OK

Test #43:

score: 0
Accepted
time: 168ms
memory: 74864kb

input:

5000 1000000
1990 3328
77 5833
1068 7006
4354 7677
1059 7321
1882 3532
1356 6651
4074 7318
7528 9355
4873 9462
1216 6079
388 978
3194 3416
3218 5532
2347 4391
5837 9596
4645 9522
4950 9719
7824 8794
79 8993
9 7002
2137 4299
2344 9511
1430 9299
1397 4095
398 1576
6847 8051
4557 6738
5086 6595
1613 69...

output:

111010110101001000101010011110100100011000011001011010001010010110010110101001100110000101000100111100101111111111100000111110110111011011111100001001010101011110110100001111110000100000000010101001111110101101101001001010010010111010111000100010010101111101110010001111110001001100101001111010101110...

result:

ok Output is valid. OK

Test #44:

score: 0
Accepted
time: 164ms
memory: 75156kb

input:

5000 1000000
5589 6328
8651 9590
6036 9666
722 3584
4071 9148
1198 7337
160 5495
3219 4037
2050 4910
4951 9951
1682 5349
1962 3099
470 3183
185 541
1621 3261
1201 6766
989 2699
2207 6246
1848 5354
3827 9426
164 2273
8472 8942
3397 9354
1750 1838
2411 8253
813 9704
6436 7519
7095 8448
2990 9301
5143 ...

output:

101000010011011010011001001101111100100000001001100101100110111000111010101110000000101110011001001001110001011001101001001101000011011011010101101100001100110100111111011100100010010111111101101100111100010110111010100001100110010110011110111011000111111111100010001010110000011101000100101001101111...

result:

ok Output is valid. OK

Extra Test:

score: 0
Extra Test Passed