QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#225542#7399. Balanced Binary StringCrysflyAC ✓294ms3544kbC++171.6kb2023-10-24 19:31:412023-10-24 19:31:42

Judging History

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

  • [2023-10-24 19:31:42]
  • 评测
  • 测评结果:AC
  • 用时:294ms
  • 内存:3544kb
  • [2023-10-24 19:31:41]
  • 提交

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
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);
    if(f)x=-x;return x;
}

#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 200005
#define inf 0x3f3f3f3f

int n;
string str;

int nxt[maxn];
int period(string s){
	int n=s.size(); nxt[1]=0;
	int j=0;
	For(i,1,n-1){
		while(j&&s[j]!=s[i])j=nxt[j];
		if(s[j]==s[i])++j; nxt[i+1]=j;
	}
	int d=n-nxt[n];
	if(n%d==0)return d;
	else return n;
}

bool chk(string s){
	For(i,0,n-1) if(str[i]!='?' && s[i]!=str[i]) return 0;
	return 1;
}

void work()
{
	cin>>str;
	n=str.size();
	int res=0;
	For(x,0,n){
		int y=n-x;
		int nx=0,ny=0;
		string s="";
		auto up=[&](){
			++ny,s+='1';
		};
		auto ri=[&](){
			++nx,s+='0';
		};
		For(_,1,n){
			if(nx*y==ny*x){
				if(!y)ri();
				else up();
			}
			else if(nx*y<ny*x)ri();
			else up();
		}
		assert(nx==x);
		assert(ny==y);
		int t=period(s);
		For(i,0,t-1){
			if(chk(s))++res;
			rotate(s.begin(),s.begin()+1,s.end());
		}
	}
	cout<<res<<"\n";
}

signed main()
{
	int T=read();
	while(T--)work();
    return 0;
}
/*

*/

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3424kb

input:

10
?
??
??1
???0
????1
?????0
??????1
???????0
????????1
?????????0

output:

2
4
4
6
11
11
22
22
31
32

result:

ok 10 tokens

Test #2:

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

input:

1024
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0
1
?
0...

output:

1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
1
1
2
...

result:

ok 1024 tokens

Test #3:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

512
00
10
?0
01
11
?1
0?
1?
??
00
10
?0
01
11
?1
0?
1?
??
00
10
?0
01
11
?1
0?
1?
??
00
10
?0
01
11
?1
0?
1?
??
00
10
?0
01
11
?1
0?
1?
??
00
10
?0
01
11
?1
0?
1?
??
00
10
?0
01
11
?1
0?
1?
??
00
10
?0
01
11
?1
0?
1?
??
00
10
?0
01
11
?1
0?
1?
??
00
10
?0
01
11
?1
0?
1?
??
00
10
?0
01
11
?1
0?
1?
??...

output:

1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
...

result:

ok 512 tokens

Test #4:

score: 0
Accepted
time: 1ms
memory: 3476kb

input:

341
000
100
?00
010
110
?10
0?0
1?0
??0
001
101
?01
011
111
?11
0?1
1?1
??1
00?
10?
?0?
01?
11?
?1?
0??
1??
???
000
100
?00
010
110
?10
0?0
1?0
??0
001
101
?01
011
111
?11
0?1
1?1
??1
00?
10?
?0?
01?
11?
?1?
0??
1??
???
000
100
?00
010
110
?10
0?0
1?0
??0
001
101
?01
011
111
?11
0?1
1?1
??1
00?
10?
...

output:

1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
2
2
4
2
2
4
4
4
8
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
2
2
4
2
2
4
4
4
8
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
2
2
4
2
2
4
4
4
8
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
2
2
4
2
2
4
4
4
8
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
2
2
4
2
2
4
2
2
4
4
4
8
1
1
2
1
1
2
2
2
4
1
1
2
1
1
2
...

result:

ok 341 tokens

Test #5:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

256
0000
1000
?000
0100
1100
?100
0?00
1?00
??00
0010
1010
?010
0110
1110
?110
0?10
1?10
??10
00?0
10?0
?0?0
01?0
11?0
?1?0
0??0
1??0
???0
0001
1001
?001
0101
1101
?101
0?01
1?01
??01
0011
1011
?011
0111
1111
?111
0?11
1?11
??11
00?1
10?1
?0?1
01?1
11?1
?1?1
0??1
1??1
???1
000?
100?
?00?
010?
110?
?...

output:

1
1
2
1
0
1
2
1
3
1
1
2
0
1
1
1
2
3
2
2
4
1
1
2
3
3
6
1
0
1
1
1
2
2
1
3
0
1
1
1
1
2
1
2
3
1
1
2
2
2
4
3
3
6
2
1
3
2
1
3
4
2
6
1
2
3
1
2
3
2
4
6
3
3
6
3
3
6
6
6
12
1
1
2
1
0
1
2
1
3
1
1
2
0
1
1
1
2
3
2
2
4
1
1
2
3
3
6
1
0
1
1
1
2
2
1
3
0
1
1
1
1
2
1
2
3
1
1
2
2
2
4
3
3
6
2
1
3
2
1
3
4
2
6
1
2
3
1
2
3...

result:

ok 256 tokens

Test #6:

score: 0
Accepted
time: 1ms
memory: 3432kb

input:

204
1?001
11?10
0?1?1
0?0?1
110?1
0??00
?10?1
?0?01
??011
1001?
11??0
00001
10???
0?110
1?101
0?1??
00101
?011?
????1
?0101
1??01
10010
?1010
01011
000??
1000?
011??
?0110
10111
110?1
00?01
??101
10010
00001
?0?0?
01111
10110
1?0?0
0101?
1?010
11111
11111
???00
001??
???01
0?1??
10110
?0?10
??1??
00...

output:

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

result:

ok 204 tokens

Test #7:

score: 0
Accepted
time: 1ms
memory: 3496kb

input:

170
?01??0
00?10?
????0?
1?0?00
?1?110
101000
1?0?1?
010?01
00010?
100?01
01?101
111100
??0?1?
1?11?0
00?111
01?110
00?10?
101101
0?01?1
01?101
0?1100
00110?
?10???
?000??
?1?10?
01?111
01?101
1???1?
0000?1
01??11
?10?1?
10?0??
?1010?
010110
0111??
1??0?1
1??100
010011
11?001
01??11
01??01
?000?1
11...

output:

2
1
11
2
2
0
2
1
1
0
1
0
4
1
0
0
1
1
1
1
0
0
5
4
2
1
1
7
1
2
3
2
1
0
1
1
1
0
0
2
1
1
1
1
3
1
2
1
0
4
5
11
5
1
1
2
11
1
1
1
0
1
2
1
0
3
1
5
2
0
0
1
1
1
11
2
0
0
2
3
2
1
1
1
0
1
2
3
4
0
1
2
2
1
1
0
3
0
3
0
2
2
3
1
1
1
1
1
3
1
5
1
0
1
1
0
4
2
1
2
0
0
2
2
2
1
2
8
0
0
0
3
1
1
2
1
1
6
1
3
0
2
11
2
0
3
0
2...

result:

ok 170 tokens

Test #8:

score: 0
Accepted
time: 1ms
memory: 3472kb

input:

146
1010001
1100010
11001?1
001??11
101?011
0??1011
?111??0
1110011
10?0?0?
11?10?0
??11???
??1?00?
0??1000
??01??1
1101?00
0?01?11
0001???
?001?0?
??011?0
?010?0?
0011001
0??1?11
11011?0
0?001?1
10?110?
?11011?
1110101
??1?10?
11??0?0
0110?00
1?11101
??1?10?
1010100
?10?11?
?101010
?000100
?0001??
...

output:

0
0
0
0
1
2
1
0
4
1
10
2
1
6
0
1
2
3
1
5
0
3
1
1
1
3
0
6
1
0
2
6
1
2
2
2
2
4
0
10
2
4
3
6
4
6
0
3
0
0
3
2
1
3
0
1
0
0
4
0
1
3
3
0
0
0
0
14
4
6
5
8
0
4
2
1
1
1
5
4
1
1
1
2
1
2
1
14
1
1
3
1
6
3
8
0
0
1
0
2
4
12
4
6
4
2
0
6
2
0
5
8
0
14
8
0
4
1
4
5
2
2
2
0
6
0
1
1
1
10
8
2
2
6
8
8
3
3
0
0
2
1
10
2
6
2

result:

ok 146 tokens

Test #9:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

128
?11?10?0
11?11110
?11001??
??1?0??1
01011011
?100?01?
???0?11?
?1?1?000
??11?000
???000?1
011111??
1??1?10?
00??0?1?
?1000010
0?0???0?
01101110
11010??0
11??10?1
?0?000?0
100?0011
0???110?
1?010001
?10?0??0
0?01?01?
?0??0000
0?0001?0
000101?1
0?1?001?
1?01??01
0???01??
0100??0?
??01???0
10110010...

output:

0
1
0
4
1
1
2
0
0
1
1
4
2
0
10
0
1
1
5
0
1
0
4
2
4
2
0
1
1
5
3
6
0
0
0
0
3
1
1
0
0
1
3
0
0
1
4
0
0
1
1
1
0
0
0
1
0
0
3
0
2
2
2
0
1
9
0
0
0
1
8
0
1
0
0
3
0
1
14
9
4
0
0
5
1
0
1
5
6
0
1
1
1
3
3
0
2
0
3
0
2
0
2
3
0
5
2
4
8
1
1
2
1
2
0
0
0
7
0
1
2
0
1
2
1
0
0
2

result:

ok 128 tokens

Test #10:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

113
1110??1?0
??0?101?1
10?001000
00???01??
01?01??1?
00??11?0?
000?1011?
?0110?001
00111??0?
???0???00
??0100?0?
?0000?000
?00?01???
0????1?01
??000?11?
00???01?1
1?0?0111?
?11?0011?
11?0?00?0
??111?11?
?1101010?
0?1101001
000?10011
?011101??
1?1?11??1
?1001?1?1
001010?00
1?0?01010
0????1000
001??1...

output:

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

result:

ok 113 tokens

Test #11:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

102
1?10?0?011
?1??11????
?001?01?01
0??100?010
0000???101
11111100?1
1?01?011?0
0011011010
?11?1?0?01
?1?1110?10
011?001110
1?101011?0
?0?1100?1?
111?0110??
1??00??010
??1?1?11?0
1??01001??
11??00?0?0
0???00??00
00??1011?1
1011001?00
1001?0?1?1
??0001101?
?10?110100
10?00?0011
??100????1
?0?01110?1...

output:

0
14
1
2
0
0
1
0
0
1
0
0
0
0
0
1
1
0
8
0
0
0
0
0
0
2
0
2
0
1
0
0
1
2
0
0
0
0
0
0
2
3
20
0
0
0
0
1
0
1
2
0
3
1
0
0
11
0
2
10
0
5
0
2
0
0
0
0
2
0
2
0
2
5
1
2
0
0
0
1
0
5
1
0
14
1
0
0
1
1
0
4
0
3
0
0
1
3
1
0
0
1

result:

ok 102 tokens

Test #12:

score: 0
Accepted
time: 1ms
memory: 3428kb

input:

103
?????0????
??????0???
????????0?
???????0??
?????????1
??0???????
????1?????
?1????????
???1??????
???????1??
????0?????
????1?????
????????1?
???????1??
??????1???
????????1?
??1???????
??0???????
1?????????
?1????????
1?????????
???0??????
????0?????
???0??????
??0???????
?1????????
???1??????...

output:

32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
32
...

result:

ok 103 tokens

Test #13:

score: 0
Accepted
time: 1ms
memory: 3472kb

input:

103
0??0??????
1??1??????
?1???0????
???0????1?
??0??1????
????1?1???
???0?????1
????????1?
?????0????
?????01???
???0???1??
????????1?
??0??1????
?????????1
??0????1??
?0????1???
???0?0????
?0??1?????
0?????0???
????1????0
1??????0??
???1??1???
?????1?0??
?0???????0
??????0???
?0???????1
00????????...

output:

23
23
12
9
9
20
12
32
32
15
12
32
9
32
9
9
20
9
20
9
9
23
12
20
32
12
17
32
15
23
9
12
12
20
12
12
12
15
17
32
17
20
23
23
17
17
15
20
12
20
15
9
20
9
15
20
17
23
20
23
12
20
17
9
15
32
20
12
9
23
12
12
23
23
12
9
23
17
15
9
23
20
20
15
23
20
12
23
17
23
32
12
9
17
20
20
20
9
20
20
9
17
6

result:

ok 103 tokens

Test #14:

score: 0
Accepted
time: 2ms
memory: 3432kb

input:

21
???????????????????????????????????????1??????????
0?????????????????????????????????????????????????
??????????1???????????????????????????????????????
???????????????????????????????????????????????1??
?????????????????????????????????????????0????????
??????????????????????????????????????????...

output:

782
782
782
782
782
782
782
782
782
782
782
782
782
782
782
782
782
782
782
782
151

result:

ok 21 tokens

Test #15:

score: 0
Accepted
time: 2ms
memory: 3536kb

input:

21
????????????????????????????0?????0???????????????
?0????????????????????????????1???????????????????
???0????????0?????????????????????????????????????
?????????????????????????????????????0?????0??????
???????????????????????????????????0????????????0?
?????????????????0?????????????0??????????...

output:

518
239
543
518
525
518
239
518
257
257
482
257
518
264
525
482
525
239
525
543
104

result:

ok 21 tokens

Test #16:

score: 0
Accepted
time: 2ms
memory: 3508kb

input:

21
???11????????????????????????0????????????????????
?????1????????1???????????????0???????????????????
???????1??????????????????????????1???????????????
??1?0????????????????????????????????0????????????
????????????????????????????????????00???????????0
?????????????0????1???????1???????????????...

output:

66
141
525
132
327
125
123
123
264
150
123
375
368
123
402
132
150
132
386
132
63

result:

ok 21 tokens

Test #17:

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

input:

21
?????????1???????????????10?????1?????????????????
????????????????????????0?01?????????????????????0
?????????????????????0????0????????0???????0??????
??????????????????????????????1???????????1???0?1?
????????????????01???????????0??????????0?????????
???????1?1?????????????????????????0??????...

output:

109
110
321
83
119
78
45
49
310
50
150
23
42
68
86
66
150
64
78
313
6

result:

ok 21 tokens

Test #18:

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

input:

11
????????????????????????????????0???????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????0??????????????
???????????????????????????????????????????????????????0??????????????????????????????????????????
?...

output:

2391
3386
3152
3386
3602
4657
3386
3245
3386
1922
1220

result:

ok 11 tokens

Test #19:

score: 0
Accepted
time: 2ms
memory: 3532kb

input:

11
??1???????????????????????????????????????????????1???????????????????????????????????????????????
??????????????????????????1????????????????????????????????????????????????????????1????????????????
???????????????????????????????????????????????????0???????????????????????1???????????????????
?...

output:

2096
1919
1158
1072
954
3089
1906
2141
1059
1112
629

result:

ok 11 tokens

Test #20:

score: 0
Accepted
time: 2ms
memory: 3472kb

input:

11
??????0????????0????????????????????????????????????????????????????????1???????????????????????
????????????????1???????????1?????????????1????????????????????????????????????????????????
???????????????0???????1??????1???????????????????????????????????????????????????????????????
?????????????...

output:

406
1658
552
404
312
560
558
552
552
783
238

result:

ok 11 tokens

Test #21:

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

input:

11
?????0????????????????????????????????????0???????????????????????????????1???0????????????
??????????????????????????????0????????????????0????????????????????????????????????????1???????0???
?????????1??????????????0????????????????????????????????00??????????????????????????????????
?????????1...

output:

337
291
225
216
172
1262
666
347
467
165
212

result:

ok 11 tokens

Test #22:

score: 0
Accepted
time: 16ms
memory: 3416kb

input:

4
??????????????????????????????????1????????????????????????????????0?????0??????????????????????????????????????0????????????????????????????????????????????????????????????????????????????????????????????????????1????????????1???????????????????????0???????????????0??????????0????????????????????...

output:

2
75
15
3

result:

ok 4 tokens

Test #23:

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

input:

4
??????1???1????????????????????????????????0?????????1?????????????????0??????????????????????????????????????????????????????????????????1?????1??????????????????1????????????0????????????????????????????????????????0???????????????????????????????????????????????????????0????????????????????????...

output:

0
0
0
0

result:

ok 4 tokens

Test #24:

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

input:

4
????????????????????????0???????????0?????0???????0??0?0????1?0?1??????????????1???????????????????????????????0???????????????????????????1??????1???????0?????????????????????????????0?1??????????????0????????1???????00??????????1????0???1??0??1?????0???1???????????0????????????????????1?
???????...

output:

0
0
0
1

result:

ok 4 tokens

Test #25:

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

input:

4
??????1???????????????????????1???1??????????????????0??10?????1?????????????????????????0?????1?????1??????????????????????1??????0????????????????????????????????01??1??????????????????1??1????????????????1????1??????????????0??????1???1?????????1??????????????????????1??1??1???????????1????????...

output:

0
0
0
0

result:

ok 4 tokens

Test #26:

score: 0
Accepted
time: 294ms
memory: 3428kb

input:

1
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

699052

result:

ok "699052"

Test #27:

score: 0
Accepted
time: 223ms
memory: 3428kb

input:

1
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

349526

result:

ok "349526"

Test #28:

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

input:

1
?????????????????????????????????????????????????????????????????????????????????????????????????????0?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????1??????????????????????????????????????????????...

output:

116514

result:

ok "116514"

Test #29:

score: 0
Accepted
time: 87ms
memory: 3512kb

input:

1
?????????????????????????????????????????????????????????????????????????????1?????????????????????????????????????????????????????????????????????0??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

58146

result:

ok "58146"

Test #30:

score: 0
Accepted
time: 145ms
memory: 3544kb

input:

1
????????????????????????????????????????????????????????????????????????????????????????????????????1?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

35344

result:

ok "35344"

Test #31:

score: 0
Accepted
time: 80ms
memory: 3480kb

input:

2
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

174764
174764

result:

ok 2 tokens

Test #32:

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

input:

2
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

87382
87382

result:

ok 2 tokens

Test #33:

score: 0
Accepted
time: 44ms
memory: 3536kb

input:

2
?????????????????????1????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

29132
58263

result:

ok 2 tokens

Test #34:

score: 0
Accepted
time: 56ms
memory: 3532kb

input:

2
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????0????????????????????????????????????????????????????????...

output:

14556
14379

result:

ok 2 tokens

Test #35:

score: 0
Accepted
time: 36ms
memory: 3436kb

input:

2
??????????0????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????1??????????????????????????????????????????...

output:

5951
5779

result:

ok 2 tokens

Test #36:

score: 0
Accepted
time: 2ms
memory: 3412kb

input:

20
?010100?11000?00???0?1110010000?0?11??1?0??00?110????1????0?0?0??010?000?10?10?00?10?0?001110?10?1
00101101?1?10100
0101010?011??1?1100101?001???01?00?1?010?100011?01??0?10?000000100010??
1????11111?00???0001??1?1?1????????0?111?00?1??00010000??1000?101?111?00?0?110?0
??1?110?011??0010?0??0?1011?...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 20 tokens

Test #37:

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

input:

4
1?0?01?1?001??1?0000?0??11??00??00?1001??100?1?000?0100?01?11?10?0?????100??1?0?11?100000011001?1????111?00001?0?1????010?000??11111??00???010011?1011011?0?0?0000?000?0100000?????000?01?1??10?100?0?0??110?0????????00?100010110?011?1??1?110?0110?0?1010011??00?0?000?111110001??110?111?10?1?00??1?110...

output:

0
0
0
0

result:

ok 4 tokens

Test #38:

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

input:

3
??011?1000????001????011?0101??1100?001000??01011000101?110?01100?1???01??0101101?11??0?0??10?1??10?100010?01101?011??101000111?1010?0?1001??010?0??111?000??000?000????1?0000111?????000000?111????1?1011100???011?0??100?10??0???110?0011??11?1?1?0?01?1011??1?00100010???0?1?1?111??11?0?010?10?0??0010...

output:

0
0
0

result:

ok 3 tokens

Test #39:

score: 0
Accepted
time: 30ms
memory: 3484kb

input:

1
?0?1100?1111010?1?00?0???00000?10??10?111?01?0??010110?1111?00?11?11??01?1101?0??0?0??10?010?1?00???10??1??1??0001010?00??01?1?0??0????001??111?10?0?00?0001????1110???11?1000?010?010???00?011?0000?11?0??11110011100?0?1??001???001?10?1?00?1?1??1?00?00011100?110000?0?00?1011?0?????01??10?1?0100??0??...

output:

0

result:

ok "0"

Test #40:

score: 0
Accepted
time: 31ms
memory: 3424kb

input:

1
100???10??11?0110??010?1000??00?10???10???110??010101?11101??001000?0?001?1?11??1?001110101?????00?10000101??0??111?01?1000??00100001?00000???00?1101?1?101?11?111110011100?0?1??011??0??10111???11?11?11011100?01100?01?0??110111?1?1?11?1???0110??10?0?01??1?100???01?000?11?1111?00100??11?1?1?0111??00...

output:

0

result:

ok "0"

Test #41:

score: 0
Accepted
time: 31ms
memory: 3436kb

input:

1
1110111011110111011110111011110111011110111011110111011110111011110111011110111011110111011101111011101111011101111011101111011101111011101111011101111011101111011101110111101110111101110111101110111101110111101110111101110111101110111101110111011110111011110111011110111011110111011110111011110111...

output:

1

result:

ok "1"

Test #42:

score: 0
Accepted
time: 30ms
memory: 3424kb

input:

1
0110101101011010110101101011010101101011010110101101011010110101101010110101101011010110101101011010110101011010110101101011010110101101011010110101011010110101101011010110101101011010101101011010110101101011010110101101010110101101011010110101101011010110101011010110101101011010110101101011010101...

output:

1

result:

ok "1"

Test #43:

score: 0
Accepted
time: 34ms
memory: 3440kb

input:

1
000000?010000000000100000000010000000000100000000001000000000010000000000100000000010000000000100000000001000000000010000000001000000000010000000000100000000001000000000010000000001000000000010000000000100000000001000000000010000000001000000000010000000000100000000001000000000100000000001000000000...

output:

1

result:

ok "1"

Test #44:

score: 0
Accepted
time: 31ms
memory: 3476kb

input:

1
1?01000100100010010001001000100010010001001000100100010010001000100100010010001001000100100010001001000100100010010001001000100010010001001000100100010010001000100100010010001001000100100010001001000100100010010001001000100010010001001000100100010010001000100100010010001001000100100010001001000100...

output:

1

result:

ok "1"

Test #45:

score: 0
Accepted
time: 30ms
memory: 3484kb

input:

1
10101010110101010101010101101010101010101101010101010101011010101010101010110101010101010101101010101010101101010101010101011010101010101010110101010101010101101010101010101101010101010101011010101010101010110101010101010101?0101010101010101101010101010101101010101010101011010101010101010110101010...

output:

1

result:

ok "1"

Test #46:

score: 0
Accepted
time: 36ms
memory: 3484kb

input:

1
1111110111110111110111111011111011111011111101111101111101111110111110111111011111011111011111101111101111101111110111110111110111111011111?11111101111101111101111110111110111110111111011111011111011111101111101111101111110111110111111011111011111011111101111101111101111110111110111110111111011111...

output:

1

result:

ok "1"

Test #47:

score: 0
Accepted
time: 30ms
memory: 3480kb

input:

1
1011011011011011011010110?10110110110110110110110101101101101101101101101101101011011011011011011011011011010110110110110110110110110110101101101101101101101101101101101011011011011011011011011011010110110110110110110110110110101101101101101101101101101101011011011011011011011011011010110110110110...

output:

1

result:

ok "1"

Test #48:

score: 0
Accepted
time: 29ms
memory: 3480kb

input:

1
0000000000000000000000000000001000000000000000000000000000000000000010000000000000000000000000000?0000000100000000000000000000000000000000000001?0000000000000?000000000000000000000010000000000000000000000000000000000?001000000000000000000000000000000000000010000000000000000000000000000000000000100...

output:

1

result:

ok "1"

Test #49:

score: 0
Accepted
time: 30ms
memory: 3488kb

input:

1
00100010000100001000100001000010001000010000100010000100010000100001000100001000010001000010?00100010000100001000100001000010001000010000100010000100001000100001000010001?0001000010001000010001000010000100010000100001000100001000010001000010000100010000100001000100001000010001000010000100010000100...

output:

1

result:

ok "1"

Test #50:

score: 0
Accepted
time: 27ms
memory: 3440kb

input:

1
01011010110101?0101101011010110101101011010110101101010110101101011010110101101011010110101101011010110101101010110101101011010110101101011010110101101011010110101101011010101101011010110101101011010110101101011010110101101011010110?010110101?0101101011010110101101011010110101101011010110101011010...

output:

1

result:

ok "1"

Test #51:

score: 0
Accepted
time: 15ms
memory: 3540kb

input:

3
0101001010010010100101001010010100101001001010010100101001010010100100101001010010100101001010010010100101001010010100101001001010010100101001010010100100101001010010100101001010010010100101001010010100101001001010010100101001010010100101001001010010100101001010010100100101001010010100101001010010...

output:

1
1
1

result:

ok 3 tokens

Test #52:

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

input:

3
101010101010101011010101010101010101101010101010101010110101010101010101010110101010101010101011010101010101010101101010101010101010101101010101010101010110101010101010101011010101010101010101101010101010101010101101010101010101010110101010101010101011010101010101?101010110101010101010101011010101...

output:

1
1
2

result:

ok 3 tokens

Test #53:

score: 0
Accepted
time: 15ms
memory: 3480kb

input:

3
00100010001001000100010001001000100010010001000100010010001000100010010001000100010010001000100100010001000100100010001000100100010001001000100010001001000100010001001000100010010001000100010010001000100010010001?00100010010001000?0010001000100010010001000100010010001000100100010001000100100010001...

output:

1
1
4

result:

ok 3 tokens

Test #54:

score: 0
Accepted
time: 15ms
memory: 3420kb

input:

3
1000100001000?00001000100001000010001000010001000010001000010001000010001000010000100010000100010000100010000100?10000100010000100001000100001000100001000100001000100001000100001000010001000010001000010001000010001000010001000010000100010000100010000100010000100010000100010000100001000100001000100...

output:

1
1
1

result:

ok 3 tokens

Test #55:

score: 0
Accepted
time: 15ms
memory: 3436kb

input:

3
1111011111101111101111101111110111110111110111111011111011111011111101111101111101111?101111?0111110111111011111011111011111101111101111101111110111110111110111110111111011111011111011111101111101111101111110111110111110111111011111011111011111101111101111101111110111110111110111111011111011111011...

output:

1
1
3

result:

ok 3 tokens

Test #56:

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

input:

3
11101110111011110111011101110111011101111?1110111011101110111101110111011101110111101110111011101110111101110111011101110111101110111011101110111011110111011101110111011110111011101110111011110111011101110?11011110111011101110111011101111011101110111011101111011101110111011101111011101110111011101...

output:

1
1
2

result:

ok 3 tokens

Test #57:

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

input:

3
010010101010010101001010101001010100101010100101010100101010010101010010101001?1010100101010010101010010101010010101001010101001010100101010100101010010101010010101001010101001010101001?10100101010100101010010101010010101001010101001010101001010100101010100101010010101010?101010010101010010101001?...

output:

1
1
9

result:

ok 3 tokens

Test #58:

score: 0
Accepted
time: 13ms
memory: 3480kb

input:

3
11111111011111111111111110111111111111111110111111111111111101111111111111111011111111111111110111111111111111110111111111111111101111111111111111011111111111?11110111111111111?11110?1111111111111110111111111111111101111111111?11111101111111111111111011111111111111110111111111111111101111111111111...

output:

1
1
2

result:

ok 3 tokens

Test #59:

score: 0
Accepted
time: 17ms
memory: 3420kb

input:

3
010101010101011010101010101010110101010101010101101010101010101010110101010101010101101?1010101010101101010101010101010110101010101010101101010101010101011010101010101010101101010?010101010110101010101010101101010101010101010110101010101010101101010101010101011010101010101010110101010101010101?11?...

output:

1
1
12

result:

ok 3 tokens

Test #60:

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

input:

3
101101?011011010110110110110110110110110110110110110110110110110110110110110?01101101101101101101101?011011011011011011011011011011011011011010110110110110110110110110110110110110110110110110110110110110?01101101101101101101101?0110110110110110110110110110110110110110101101101101101101101101101101...

output:

1
1
9

result:

ok 3 tokens

Extra Test:

score: 0
Extra Test Passed