QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#757535#7399. Balanced Binary StringStayAloneAC ✓7ms4052kbC++142.5kb2024-11-17 09:42:162024-11-17 09:42:16

Judging History

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

  • [2024-11-17 09:42:16]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:4052kb
  • [2024-11-17 09:42:16]
  • 提交

answer

#include <bits/stdc++.h>
#define rep1(i, l, r) for (int i = l; i <= int(r); ++i)
#define rep2(i, l, r) for (int i = l; i >= int(r); --i)
#define cop(i, l, r, a, b) rep1(i, l, r) a[i] = b[i]
#define rep(i, x) for (int i = pnt[x]; i; i = nxt[i])
#define rer(i, l, r, a) rep1(i, l, r) read(a[i])
#define ptc putchar
#define il inline
#define eb emplace_back
#define ef emplace_front
#define mp make_pair
#define fst first
#define snd second
#define sqr(x) ((x) * (x))
#define ls(x) x << 1
#define rs(x) x << 1 | 1
#define rout return 0
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
// typedef __int128 bll;
// typedef unsigned __int128 ubll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 2e5 + 10, inf = ~0U >> 2, INF = ~0U >> 1;
const int LOGN = log2(MAXN) + 1;
const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
namespace stupid_lrc {
	template <typename T> il bool read(T &x) {
		x = 0; bool f = false; char ch;
		while (!isdigit(ch = getchar())) {
			f ^= !(ch ^ '-');
			if (ch == EOF) return false;
		}
		while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch & 15), ch = getchar();
		if (f) x = ~x + 1; return true;
	}
	il int read() {int x; read(x); return x;}

	template <typename T> il bool read(pair <T, T> &x) {return read(x.fst) && read(x.snd);}
	
	template <typename T> il void gmin(T &x, T y) {x = x < y ? x : y;}
	
	template <typename T> il void gmax(T &x, T y) {x = x > y ? x : y;}

	template <typename T, typename ...L>
	il bool read(T &x, L &...y) {return read(x) && read(y...);}

	template <typename T> il T lowbit(const T &x) {return x & -x;}
}
using namespace stupid_lrc;
int n, a[1030], sum[1030]; char s[1030];
vector <int> pos[1030];

il bool check(int x) {
	return s[x] == '?' || s[x] == a[x] + '0';
}

int main() {
	for (int T = read(); T--; ) {
		scanf("%s", s + 1); n = strlen(s + 1);
		int ans = 0, cnt1 = 0, cnt2 = n;
		rep1(i, 1, n) {
			cnt1 += s[i] == '1';
			cnt2 -= s[i] == '0';
		}
		rep1(c, cnt1, cnt2) {
			rep1(i, 0, n) pos[i].clear();
			int q = 0;
			rep1(i, 1, n) {
				sum[i] = sum[i - 1] + c; a[i] = 0;
				if (sum[i] > 0) sum[i] -= n, a[i] = 1;
				q += check(i); pos[sum[i] + n].eb(i);
			}
			rep1(k, 1, n) {
				if (pos[k].size() && q == n) ++ans;
				for (auto v : pos[k]) {
					q -= check(v); q -= check(v + 1);
					a[v] = 0; a[v + 1] = 1;
					q += check(v); q += check(v + 1);
				}
			}
		} printf("%d\n", ans);
	}
	rout;
}

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

詳細信息

Test #1:

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

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: 3916kb

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: 0ms
memory: 3912kb

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: 0ms
memory: 3828kb

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: 0ms
memory: 3900kb

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: 0ms
memory: 3832kb

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: 0ms
memory: 3896kb

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: 0ms
memory: 3840kb

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: 0ms
memory: 3912kb

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: 0ms
memory: 3980kb

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: 0ms
memory: 3820kb

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: 0ms
memory: 3784kb

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: 3792kb

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: 1ms
memory: 3904kb

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: 1ms
memory: 3824kb

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: 1ms
memory: 3892kb

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: 1ms
memory: 3784kb

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: 1ms
memory: 3920kb

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: 1ms
memory: 3916kb

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: 1ms
memory: 3924kb

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: 1ms
memory: 3856kb

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: 2ms
memory: 3944kb

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: 0ms
memory: 3896kb

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: 3ms
memory: 3932kb

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: 0ms
memory: 3876kb

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: 6ms
memory: 3848kb

input:

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

output:

699052

result:

ok "699052"

Test #27:

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

input:

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

output:

349526

result:

ok "349526"

Test #28:

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

input:

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

output:

116514

result:

ok "116514"

Test #29:

score: 0
Accepted
time: 6ms
memory: 3896kb

input:

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

output:

58146

result:

ok "58146"

Test #30:

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

input:

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

output:

35344

result:

ok "35344"

Test #31:

score: 0
Accepted
time: 3ms
memory: 3872kb

input:

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

output:

174764
174764

result:

ok 2 tokens

Test #32:

score: 0
Accepted
time: 3ms
memory: 3860kb

input:

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

output:

87382
87382

result:

ok 2 tokens

Test #33:

score: 0
Accepted
time: 3ms
memory: 3948kb

input:

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

output:

29132
58263

result:

ok 2 tokens

Test #34:

score: 0
Accepted
time: 3ms
memory: 3928kb

input:

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

output:

14556
14379

result:

ok 2 tokens

Test #35:

score: 0
Accepted
time: 3ms
memory: 3884kb

input:

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

output:

5951
5779

result:

ok 2 tokens

Test #36:

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

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: 2ms
memory: 3936kb

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: 3ms
memory: 3948kb

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: 6ms
memory: 3848kb

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: 2ms
memory: 3952kb

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: 1ms
memory: 3860kb

input:

1
1110111011110111011110111011110111011110111011110111011110111011110111011110111011110111011101111011101111011101111011101111011101111011101111011101111011101111011101110111101110111101110111101110111101110111101110111101110111101110111101110111011110111011110111011110111011110111011110111011110111...

output:

1

result:

ok "1"

Test #42:

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

input:

1
0110101101011010110101101011010101101011010110101101011010110101101010110101101011010110101101011010110101011010110101101011010110101101011010110101011010110101101011010110101101011010101101011010110101101011010110101101010110101101011010110101101011010110101011010110101101011010110101101011010101...

output:

1

result:

ok "1"

Test #43:

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

input:

1
000000?010000000000100000000010000000000100000000001000000000010000000000100000000010000000000100000000001000000000010000000001000000000010000000000100000000001000000000010000000001000000000010000000000100000000001000000000010000000001000000000010000000000100000000001000000000100000000001000000000...

output:

1

result:

ok "1"

Test #44:

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

input:

1
1?01000100100010010001001000100010010001001000100100010010001000100100010010001001000100100010001001000100100010010001001000100010010001001000100100010010001000100100010010001001000100100010001001000100100010010001001000100010010001001000100100010010001000100100010010001001000100100010001001000100...

output:

1

result:

ok "1"

Test #45:

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

input:

1
10101010110101010101010101101010101010101101010101010101011010101010101010110101010101010101101010101010101101010101010101011010101010101010110101010101010101101010101010101101010101010101011010101010101010110101010101010101?0101010101010101101010101010101101010101010101011010101010101010110101010...

output:

1

result:

ok "1"

Test #46:

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

input:

1
1111110111110111110111111011111011111011111101111101111101111110111110111111011111011111011111101111101111101111110111110111110111111011111?11111101111101111101111110111110111110111111011111011111011111101111101111101111110111110111111011111011111011111101111101111101111110111110111110111111011111...

output:

1

result:

ok "1"

Test #47:

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

input:

1
1011011011011011011010110?10110110110110110110110101101101101101101101101101101011011011011011011011011011010110110110110110110110110110101101101101101101101101101101101011011011011011011011011011010110110110110110110110110110101101101101101101101101101101011011011011011011011011011010110110110110...

output:

1

result:

ok "1"

Test #48:

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

input:

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

output:

1

result:

ok "1"

Test #49:

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

input:

1
00100010000100001000100001000010001000010000100010000100010000100001000100001000010001000010?00100010000100001000100001000010001000010000100010000100001000100001000010001?0001000010001000010001000010000100010000100001000100001000010001000010000100010000100001000100001000010001000010000100010000100...

output:

1

result:

ok "1"

Test #50:

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

input:

1
01011010110101?0101101011010110101101011010110101101010110101101011010110101101011010110101101011010110101101010110101101011010110101101011010110101101011010110101101011010101101011010110101101011010110101101011010110101101011010110?010110101?0101101011010110101101011010110101101011010110101011010...

output:

1

result:

ok "1"

Test #51:

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

input:

3
0101001010010010100101001010010100101001001010010100101001010010100100101001010010100101001010010010100101001010010100101001001010010100101001010010100100101001010010100101001010010010100101001010010100101001001010010100101001010010100101001001010010100101001010010100100101001010010100101001010010...

output:

1
1
1

result:

ok 3 tokens

Test #52:

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

input:

3
101010101010101011010101010101010101101010101010101010110101010101010101010110101010101010101011010101010101010101101010101010101010101101010101010101010110101010101010101011010101010101010101101010101010101010101101010101010101010110101010101010101011010101010101?101010110101010101010101011010101...

output:

1
1
2

result:

ok 3 tokens

Test #53:

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

input:

3
00100010001001000100010001001000100010010001000100010010001000100010010001000100010010001000100100010001000100100010001000100100010001001000100010001001000100010001001000100010010001000100010010001000100010010001?00100010010001000?0010001000100010010001000100010010001000100100010001000100100010001...

output:

1
1
4

result:

ok 3 tokens

Test #54:

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

input:

3
1000100001000?00001000100001000010001000010001000010001000010001000010001000010000100010000100010000100010000100?10000100010000100001000100001000100001000100001000100001000100001000010001000010001000010001000010001000010001000010000100010000100010000100010000100010000100010000100001000100001000100...

output:

1
1
1

result:

ok 3 tokens

Test #55:

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

input:

3
1111011111101111101111101111110111110111110111111011111011111011111101111101111101111?101111?0111110111111011111011111011111101111101111101111110111110111110111110111111011111011111011111101111101111101111110111110111110111111011111011111011111101111101111101111110111110111110111111011111011111011...

output:

1
1
3

result:

ok 3 tokens

Test #56:

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

input:

3
11101110111011110111011101110111011101111?1110111011101110111101110111011101110111101110111011101110111101110111011101110111101110111011101110111011110111011101110111011110111011101110111011110111011101110?11011110111011101110111011101111011101110111011101111011101110111011101111011101110111011101...

output:

1
1
2

result:

ok 3 tokens

Test #57:

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

input:

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

output:

1
1
9

result:

ok 3 tokens

Test #58:

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

input:

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

output:

1
1
2

result:

ok 3 tokens

Test #59:

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

input:

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

output:

1
1
12

result:

ok 3 tokens

Test #60:

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

input:

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

output:

1
1
9

result:

ok 3 tokens

Extra Test:

score: 0
Extra Test Passed