QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#538134#9118. Flip or NotdlwlrmaAC ✓168ms3772kbC++142.9kb2024-08-31 05:58:042024-08-31 05:58:05

Judging History

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

  • [2024-08-31 05:58:05]
  • 评测
  • 测评结果:AC
  • 用时:168ms
  • 内存:3772kb
  • [2024-08-31 05:58:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define fi first
#define se second
int n;
typedef bitset<5001> pack;
pack zero;
void out(pack c){
	for(int i=0; i<=n ;i++){
		cout << c[i];
	}
	cout << endl;
}
void upshift(pack &s,pack &mod,int deg){
	s<<=1;
	if(s[deg]) s^=mod;
}
pack gcd(pack a,pack b,pack &q){
	q=zero;
	pack p=zero,r=zero,s=zero;
	p[0].flip();s[0].flip();
	int deg_a=n,deg_b=n;
	while(true){
		while(deg_a>=0 && !a[deg_a])  --deg_a;
		while(deg_b>=0 && !b[deg_b])  --deg_b;
		if(deg_a<deg_b){
			swap(a,b);
			swap(deg_a,deg_b);
			swap(p,r);
			swap(q,s);
		}
		if(deg_b==-1) return a;
		a^=b<<(deg_a-deg_b);
		p^=r<<(deg_a-deg_b);
		q^=s<<(deg_a-deg_b);
	}
}
void reduce(pack &s,pack &mod,int deg){
	for(int i=n; i>=deg ;i--){
		if(s[i]) s^=mod<<(i-deg);
	}
}
int deg(pack &g){
	int res=n;
	while(res>=0 && !g[res]) --res;
	return res;
}
pack s,t,a,b,g,q;

bool ans[1000001];

bool check(pack &fg,int k){
	int deg_fg = deg(fg);
	int deg_g = deg(g);
	if(deg_fg>=deg_g+k) return false;
	for(int i=deg_fg; i>=deg_g ;i--){
		if(fg[i]){
			ans[i-deg_g]=true;
			fg^=g<<(i-deg_g);
		}
	}
	cout << k << '\n';
	for(int i=k-1; i>=0 ;i--) cout << ans[i];
	cout << '\n';
	return true;
}

int frog[10005];
pack mul(pack &x,pack &y){
	for(int i=0; i<2*n ;i++){
		frog[i]=0;
	}
	for(int i=0; i<n ;i++){
		for(int j=0; j<n ;j++){
			if(x[i] && y[j]) frog[i+j]^=1;
		}
	}
	for(int i=2*n-1; i>=n ;i--){
		if(frog[i]){
			for(int j=0; j<=n ;j++){
				frog[j+i-n]^=a[j];
			}
		}
	}
	pack fun=zero;
	for(int i=0; i<n ;i++){
		if(frog[i]) fun.flip(i);
	}
	return fun;
}

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	//freopen("in.txt","r",stdin);
	cin >> n;
	for(int i=1; i<=n ;i++){
		char c;cin >> c;
		s[i-1]=c-48;
	}
	for(int i=1; i<=n ;i++){
		char c;cin >> c;
		t[i-1]=c-48;
	}
	int ac;cin >> ac;
	for(int i=1; i<=ac ;i++){
		int x;cin >> x;
		a[x-1].flip();
	}
	a[n].flip();a[0].flip();
	int bc;cin >> bc;
	for(int i=1; i<=bc ;i++){
		int x;cin >> x;
		b[x-1].flip();
	}
	g = gcd(a,b,q);
	int deg_g = deg(g);
	pack sg = s;reduce(sg,g,deg_g);
	pack tg = t;reduce(tg,g,deg_g);
	pack sa = s;reduce(sa,a,n);
	pack ta = t;reduce(ta,a,n);
	bool fst=false,snd=false;
	pack karina=zero,winter=zero;
	for(int k=0; k<=1e6 ;k++){
		if(sg!=tg){
			upshift(sg,g,deg_g);
			upshift(sa,a,n);
			if(snd) upshift(winter,a,n);
			continue;
		}
		if(!fst){//compute s^x
			fst=true;
			karina = sa^ta;
			karina = mul(karina,q);
			if(check(karina,k)) return 0;
		}
		else if(!snd){
			snd=true;
			winter = sa^ta;
			winter = mul(winter,q);
			if(check(winter,k)) return 0;
			winter^=karina;
			karina^=winter;
		}
		else{
			karina^=winter;
			if(check(karina,k)) return 0;
		}
		upshift(sg,g,deg_g);
		upshift(sa,a,n);
	
		if(snd) upshift(winter,a,n);
	}
	cout << "-1\n";
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3636kb

input:

5
00001
00111
3
1 2 3
2
3 5

output:

4
1001

result:

ok output is valid

Test #2:

score: 0
Accepted
time: 82ms
memory: 3724kb

input:

4
0110
1000
2
1 2
4
1 2 3 4

output:

-1

result:

ok output is valid

Test #3:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

1
0
1
1
1
1
1

output:

1
1

result:

ok output is valid

Test #4:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

8
11110000
10101011
6
2 3 5 6 7 8
3
4 7 8

output:

5
01110

result:

ok output is valid

Test #5:

score: 0
Accepted
time: 79ms
memory: 3632kb

input:

8
00010010
11000111
3
1 4 5
4
2 4 6 8

output:

-1

result:

ok output is valid

Test #6:

score: 0
Accepted
time: 108ms
memory: 3620kb

input:

8
00000111
10110100
6
3 4 5 6 7 8
4
1 3 7 8

output:

-1

result:

ok output is valid

Test #7:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

8
00101100
11100111
3
1 2 6
6
1 3 4 5 7 8

output:

8
10100111

result:

ok output is valid

Test #8:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

9
111001001
100001000
7
1 3 4 5 6 7 8
4
1 3 7 9

output:

2
01

result:

ok output is valid

Test #9:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

8
01100110
00000101
3
4 5 7
5
2 3 6 7 8

output:

13
0000000000000

result:

ok output is valid

Test #10:

score: 0
Accepted
time: 111ms
memory: 3716kb

input:

10
1001011001
0101100100
4
4 5 7 9
4
4 5 7 10

output:

-1

result:

ok output is valid

Test #11:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

7
1000010
1010101
4
3 4 5 6
4
1 2 4 5

output:

5
00110

result:

ok output is valid

Test #12:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

6
101011
101000
1
6
4
2 3 4 6

output:

2
11

result:

ok output is valid

Test #13:

score: 0
Accepted
time: 58ms
memory: 3696kb

input:

3
000
110
2
2 3
2
1 3

output:

-1

result:

ok output is valid

Test #14:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

19
1100010001111111100
0001101011001010110
10
2 3 4 5 6 7 9 14 15 19
10
3 5 6 8 10 11 12 17 18 19

output:

15
011001011010111

result:

ok output is valid

Test #15:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

7
0111111
0101011
6
2 3 4 5 6 7
4
1 3 5 7

output:

7
0000001

result:

ok output is valid

Test #16:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

17
10010100010100010
10101101101001101
8
3 5 8 9 12 14 15 17
8
1 3 5 8 10 12 14 15

output:

15
000001111100100

result:

ok output is valid

Test #17:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

13
1101000011011
1010001110110
4
3 5 6 13
8
2 3 4 7 8 10 11 13

output:

146
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010

result:

ok output is valid

Test #18:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

15
101011111011111
110110110101110
8
3 6 8 9 11 12 13 15
10
1 4 5 6 7 11 12 13 14 15

output:

13
0000010101111

result:

ok output is valid

Test #19:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

18
000000100100001110
011101100101001001
6
5 6 7 8 10 15
12
1 2 4 5 7 9 10 13 14 15 16 17

output:

13
1011100001110

result:

ok output is valid

Test #20:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

14
10111010011001
01010010010001
5
4 7 11 12 14
7
3 7 8 9 11 12 14

output:

485
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #21:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

11
00011011101
00100111111
3
2 4 10
7
3 4 5 7 8 10 11

output:

11
00001001101

result:

ok output is valid

Test #22:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

8
00101000
01010101
4
2 6 7 8
4
1 3 4 6

output:

7
0010110

result:

ok output is valid

Test #23:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

15
100101100001100
001111110110000
10
2 4 5 6 7 8 9 12 14 15
6
3 6 9 10 13 14

output:

12
111010011101

result:

ok output is valid

Test #24:

score: 0
Accepted
time: 100ms
memory: 3648kb

input:

1910
0100011011011000010100001001000111111011010010111110101110001001010100001011001110011000000100011000111011010100011000101111100110011110001111000011100110001011010101011001010001001001011001110100101100010110111100110101110101101010110011100101101000001111100000000011110011100110101000101011000...

output:

-1

result:

ok output is valid

Test #25:

score: 0
Accepted
time: 55ms
memory: 3612kb

input:

4123
1000001000000011111010101100100111001110111010001100010000000111101101101101011101100001110011111011101010011001011010010101100110100101110100101100110110110101000100011110111100111101010110001000110000101110011001111011011101111011100101111101000111011110110011110000111000001011000011111101000...

output:

4122
0011010000011100001001110010000111111010101011000100100111101010010111100010010100010001111100110000011011011000011111001010110000011011001110011101001000001100011011000001001101111100101101100010100101001101011010111001001111100111110000111010110100100000011000100000000010000100101110011010010...

result:

ok output is valid

Test #26:

score: 0
Accepted
time: 79ms
memory: 3676kb

input:

4474
1011011010101101101000001000000111010011100001101010100010100111111100011101001000010010010110000101010011100001010001011111101111110011011000011001101110010111110100111011010100101100001111101111111010000110001010110001111111011000110100101100000111110000110011010010001100110110011100010011100...

output:

4471
1100101001110000010101100100100011000101000000110010110011111111111111000000110001110101100111011110110111101100001100110011100000100000110100111110111011011111111001110101111010010100100100111110100000000011000001011100101100110101100000111100010010111010001011001101101001001000110111101111000...

result:

ok output is valid

Test #27:

score: 0
Accepted
time: 21ms
memory: 3728kb

input:

2514
0010101111011001011010111000011011011000001001110001111100011100100110111110101000000100011011000110010011011100010000110000101001000110000010110011011100001010101011100100011010011111011011100111011111111100011110001000000000110100001000111110111101010100110010000001001101000100101001110111111...

output:

2513
0001010100001010010010011011101010110011010111100010000101010100000111010101001011001111101000100101001011010100101101000101011111110001000101010001110100011101011100000100000101111110111010110101000111010110111011011000110000001001001101110000111110010001000011000010010101100001101111100110001...

result:

ok output is valid

Test #28:

score: 0
Accepted
time: 81ms
memory: 3772kb

input:

4813
0010010010001011101101000111110101101010100111111010001000001010011010110111000100101100010001110010100101010011111010001111110001110011010010111000111110001011011100111010110101100000101000110001010110111011000101011001000111000001011000000010111011010001101001011010001011100010010011011101101...

output:

4817
0000000010011000110101000011101011011101100110100111011101000111001000000110101111111111000010101011100010101010101110110101111010100001011111110000010100110100000101010101110001011001111100001000110111011111101000000101010111001110111000101100000001111001101110011001100100101001110110110111101...

result:

ok output is valid

Test #29:

score: 0
Accepted
time: 98ms
memory: 3632kb

input:

4352
0011111100110101100101000100100010000111101010000100001011111110011101011011001001110110001111011101101101010011111011011000101010100011110011010001011100111110111001010010101100111011111101011000101011011100101011010100000011110000010000100001000111101100001101101010000100110100101000111100100...

output:

-1

result:

ok output is valid

Test #30:

score: 0
Accepted
time: 97ms
memory: 3568kb

input:

3281
0010001100110001110100111011111010111010011010100011101101001000011001110010100000000000001110110001110101110001001011110101010110010100100110111010011100100010010101010111011110011000001011100111111110001010011101000001000011111110001001011101010000101101100011000110100011101011001010010011010...

output:

-1

result:

ok output is valid

Test #31:

score: 0
Accepted
time: 91ms
memory: 3728kb

input:

3520
1101100010110110001010100100011100001100001100010100101111111000010100011001110010110110001000101110011101001100010110001001101000101101110110010011100100001011011011111011000000100111111110111110111111110100001001011101111010100101100110011010001001001001101100011010000110101100111101111111010...

output:

-1

result:

ok output is valid

Test #32:

score: 0
Accepted
time: 95ms
memory: 3644kb

input:

3051
1011110101011100000100011100010100000011110001010011011011001111100101001000111101110011111000000001101010000100010100000110000011111101010000010111001011000001111111000010001100100011011011001111000010010010100100001110010000000111111001010000010011011111000010101101011110011001101101001110010...

output:

-1

result:

ok output is valid

Test #33:

score: 0
Accepted
time: 98ms
memory: 3720kb

input:

226
1001011011001011001110011000001000001101110110101110001111100011100001101011111100011011000110001100000000110010110100111101110101001001010001110010101101101100101000101010100010001100101100111111010100111010010010010111011001
011100010011011111111011001101001110101010001011111101000100010010001...

output:

-1

result:

ok output is valid

Test #34:

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

input:

3346
1010101010011101100001001100100101101000110010100010110100011001100100101111100011000111111101010011010100000011101110010111110111011011011001100001001000011001001001010001010001111110100100010100001011010011011001101000001110101010100100011100110011111100110010010100101110011010011000101000100...

output:

40284
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #35:

score: 0
Accepted
time: 26ms
memory: 3612kb

input:

3512
1111001111010100101010010010001101000010110111001110010101001110010011111001010100111110100001001011100011011000111010000010111011111001101100101010010111000000001101011000101100101110000010101110000011111110001000110011001111111000110001100111101001011010001001000101001101110011011010111111110...

output:

107254
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #36:

score: 0
Accepted
time: 67ms
memory: 3608kb

input:

1229
0001101010000100011110001101000010111101111010001100101000101101010010101111110101000100001011100100011011101010101111110001010111100011100000110101011100100100001110101001001000011100000100111011000010101110111111101110111001100001110000100111101000010110001110110110001000110101111011010011110...

output:

554058
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #37:

score: 0
Accepted
time: 99ms
memory: 3676kb

input:

1413
1100001101111110001001101100000001010110110101100111110100010010111101011000111111010011110001111001111001111001101011000000100101001001001010111011011111101110011001110001011000100000101000101100101011100010010110111100110001101011111111111110001001110001010001110110100001010101001101011011001...

output:

828897
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #38:

score: 0
Accepted
time: 95ms
memory: 3664kb

input:

2012
0010011100011101010000000000011110001110011101001001100101111111011011011111111110011000111100101111110011100110011101001111011101010101100110111101000000101100000000110000001000010100111000010001101000010011110010000100100101101000000111000101101111110111001010100000011010010010010110101000001...

output:

772524
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #39:

score: 0
Accepted
time: 100ms
memory: 3672kb

input:

5000
0010110110110101100000011110100001111011111100010101011001010000101100000111111111101010111111101100110100100001110010111101001011011011100011000101100000101110000100100001001111100000000100010100111000011111101000111101000110011100100100110111111100011011010001011000100000110110000110000001001...

output:

4997
1111011010110101001011111001100000110010101001011101001101010111101101111011110101011101101001111001011110000100001110100111010000001000101010000001010001011010100001000111001110110011011101101100011001100100001101111011011100000111110101111011010111101000100101001101000101001000000110100000111...

result:

ok output is valid

Test #40:

score: 0
Accepted
time: 107ms
memory: 3768kb

input:

5000
0100011111111000101011101101100110101110010100111100011100011001010011111000110101010110010101101010110000001011101111100010010110010111101111001101011000001010101011010010001101100010001100011001011010001000010011101001001110101011011100011110011110011101011010000000111101011100110001101001001...

output:

5000
1110000000110110110110111010011010000000100000011100111001000001001101111010101010100111110010101110111010101101100101000000000010100110101100110000101001011001010111000100100101000101010010110101000100011110100011110111111001110110101010101111001001001111110111011010110110110101000110010011011...

result:

ok output is valid

Test #41:

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

input:

5000
1100000110100010110110001010000111110010101001101011001111111100000101000101000001100110010110101110011010100101001000010001111010010001000010011011101010010100011100011110011100101111000101000100000001001111000011011100110000111101111000010001110001111110111011010001011101011011110010001001101...

output:

4999
1010111111010101110110101110100111100101110011000110101011100100111010011001001110111100010011110010110101110100101100100011110111101010000111010101111101100001100000100100111111010000010001011101111011101010000110110010000010011110000011100010001011000111110000000111111101111111001001110100000...

result:

ok output is valid

Test #42:

score: 0
Accepted
time: 107ms
memory: 3700kb

input:

5000
0011000100010111001100001101111101001111010110001000100011101110000111101000100011000001101111111100010011011111001111011001001010010100110010001010010010100010110101111011110011010111110101101010100111010011111000011110101010011101111111111110101010011100011100111001001010001110011000011000110...

output:

4998
0111010011100011000111001110110001010001001111110010011100010000101110000110110000111111001101010001011101101111010111111111011111001101100100110010110000011000010110011001101011111001110001111101000001101100001001001000100000101001001000110101010010100100111101011001000110111001011110001111100...

result:

ok output is valid

Test #43:

score: 0
Accepted
time: 95ms
memory: 3772kb

input:

5000
1110101110110100110111100110101010100001001101111000100111111000010101011110011000010101010001001011000111100111111101000110000011110110100111000100101110110010110000101100111001110101111110101000101111001001100001000100100111010010011100001001101010110011000000101111011011001000100111100101100...

output:

4997
0010101101100101010110101000111010011011101101001110010001010101010100010101101101101100000001011101011011111001101111000110110001101101101100101011100011100100110110000100010101001000101001100010010000001100010101011011100011100100001001100011111000000111101010001111001100000000011011011111001...

result:

ok output is valid

Test #44:

score: 0
Accepted
time: 97ms
memory: 3580kb

input:

5000
0001110110001011011100000001000110001111000010010001000000110000110101000011000000001100111000110110000001100000000001001110101110001000111001111110010101001000101011011001011001111000101000100000100101000000000111011000110101000000101101011111100000001000111101001100010111110110101001000101010...

output:

-1

result:

ok output is valid

Test #45:

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

input:

5000
1111001110111001001111010000111101100011101100001010111000001101100000001100100011110110000010110101111010101111011010000110110001101011110111011110001100011111100001101010101100100110111110011101101011101101101111010101101111111011001101010110110010011001001100000111100110001000001101000011000...

output:

1000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #46:

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

input:

5000
1011010010010111011110001100101001110111000111010111010011001001001101010101001100110111011110010111011111111100110000011110101100011110101001101011000011111001011011101100001011100111110010011010101101001110011110111100011101110110000000100111000011100011110000000010011111101111000011010010101...

output:

-1

result:

ok output is valid

Test #47:

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

input:

5000
0000101100001110000110000110000110010100111111011010110110110101000100100000010001100110001110100111011111010111010011010100011101101001000011001110010100000000000001110110001110101110001001011110101010110010100100110111010011100100010010101010111011110011000001011100111111110001010011101000001...

output:

1000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #48:

score: 0
Accepted
time: 140ms
memory: 3676kb

input:

5000
1001101111001100101001110100011110111011100101100011101000011000100110000001100010011110111111001010110111000001000010110111000001101111100110111001110110101100100111000110110011010001001110000100100010111111010001000010010110011011001110011101100010010100111001101001110000010001011110001011011...

output:

999999
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #49:

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

input:

4393
1001111101111001101101011101010111000101000000000001101010101010001101000011111111100111011101000010100111111101101110011110101001010000010101100100111110000000111001101111110000011101000100101111100100111101000111111111000101001001001001001001111010010000100001010100010011010110001001110101101...

output:

4724
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #50:

score: 0
Accepted
time: 65ms
memory: 3700kb

input:

4710
1001110101100001110110101111110111000001000110011100010010000111000110011111111110110110100000000100001010100110100100000101001111110110111101001011011000111110001111000101001111010111011010110110111000100011110010000011001110111110111000011000101100111111111101000110001001011110001011001010000...

output:

5807
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #51:

score: 0
Accepted
time: 55ms
memory: 3644kb

input:

4655
1010111101111011010100000110010010111001101000010100010001000100001000001001101001110010011001100111011000011001011100011010001100101110000010000011110111100110110001100110010000000110001111001011000011101100010011011111010000001100101111011011001101010001111000100101101010010000101101100001010...

output:

4652
0000000000101110111111110001111100000000110100100110111101011001000000000010000101111011010011011111011110000101110110111110000110000010110110110000010100001010000110001000000001010010000111000101001110111001011001101011100010110101000110100100011010000010001100001101111000110110010000111010111...

result:

ok output is valid

Test #52:

score: 0
Accepted
time: 47ms
memory: 3636kb

input:

4400
1010110111000011001010010011000011011101000001010000000011011011111001001100000110111011001011001011110011010110001110011111001100111110100111111011101010101100100101100000001100101001000110010011010010000111100000001101000010010010110001100000000110011001101000101111101111111001011100011011010...

output:

8604
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #53:

score: 0
Accepted
time: 74ms
memory: 3644kb

input:

4630
1001010101000111111001101000011111011011011000101110110110100010101001010101000010111011001011001010011110011111011011000011100001111010100111101000011101001111110011010000010111100001110100001000100001000000111010001000010101110101011000001010110101101010010101101001100011011000111000101011111...

output:

5004
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #54:

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

input:

5000
1111011000010110001111110011111001110011110101110111101001110111010010101110101010111010110110111101101011000011110111111001010001100111011010100001110010100110000101110100000001110110011101001011000010000000011110010010111110011001010010001010001110011011111100010000001010001111010100110101110...

output:

999999
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #55:

score: 0
Accepted
time: 167ms
memory: 3680kb

input:

5000
0000010010000111001100111011101110110101101010011110110111111101111111011111001000100101101001110101111111011010101111100010011101001011111101111001000111110100000001010010011010011000001001011111011100000110000001111011001110101101011000001010000010000100111100110000001010101111111100001111010...

output:

1000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #56:

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

input:

5000
0000100110010100101001010000000001101101100100101100000111101111010011100000110000010101011001010000110110000011100000000111010111011011101010011111010101011111110000000001001010100001110000110001110000110111001110000011011111100000000000011110111001111101111110100100001001111001011011010010111...

output:

1000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Test #57:

score: 0
Accepted
time: 102ms
memory: 3596kb

input:

5000
0111010101110101010100011011111111111101001110101011000000011100011110001100001100101101111101011101110001000100110011001101100000010111111000010010110100011111101000010001000010100011111100010010001101110111010000111111011001100000000010101101111100100100010101100111111011000001010011000011110...

output:

-1

result:

ok output is valid

Test #58:

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

input:

5000
0000010001101010111111001011011011010010101111100101011101000011000011110000011100110000111010101110100100001111010110001000010011101001010110111010101001111111001001000110100011101110000111001100011010111100011001101110001111010110110011010100001101100010001110110110010000101110010001110011101...

output:

1000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok output is valid

Extra Test:

score: 0
Extra Test Passed