QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#882299#3505. Flightsduongnc00059.062561 48ms3840kbC++208.3kb2025-02-04 23:24:082025-02-04 23:24:10

Judging History

This is the latest submission verdict.

  • [2025-02-04 23:24:10]
  • Judged
  • [2025-02-04 23:24:08]
  • Submitted

Ali

#include "Ali.h"
#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define isz(x) (int)x.size()
using namespace std;

namespace {

int N, nn;
vector<bool> ig;
vector<vector<pair<int, int>>> g;
vector<vector<int>> group;
vector<pair<int, int>> lab;
vector<int> par, dep, sz, lst;

vector<string> six = {
    "000011001111",
    "000010110111",
    "000001110111",
    "000000111111",
    "000001011111",
    "000011100111",
    "000101100111",
    "000011011011",
    "000001111011",
    "000001101111",
    "000010111011",
};

int dfs1(int u, int p) {
    int sz = 1;
    for (auto [v, id] : g[u]) if (v != p) {
        dep[v] = dep[u] + 1;
        int val = dfs1(v, u);
        if (val >= 7) ig[id] = true;
        else sz += val;
    }
    return sz;
}

void get_group(int u, int p) {
    sz[u] = 1;
    lab[u] = {isz(group) - 1, isz(group.back())};
    group.back().emplace_back(u);
    for (auto [v, id] : g[u]) if (v != p and not ig[id]) {
        par[v] = lab[u].second;
        get_group(v, u);
        sz[u] += sz[v];
        lst[u] = lst[v];
    }
    if (lst[u] == -1) lst[u] = u;
}

void add_nodes(int u) {
    int cnt = 0;
    for (auto [v, id] : g[u]) if (not ig[id]) {
        ++cnt;
        int clst = lst[v];
        while (sz[v] < 6) {
            g.emplace_back();
            ig.emplace_back(0);
            g[clst].emplace_back(nn, nn - 1);
            g[nn].emplace_back(clst, nn - 1);
            clst = nn, sz[v]++, nn++;
        }
    }
    while (cnt < 2) {
        int clst = u;
        for (int i = 0; i < 6; ++i) {
            g.emplace_back();
            ig.emplace_back(0);
            g[clst].emplace_back(nn, nn - 1);
            g[nn].emplace_back(clst, nn - 1);
            clst = nn, nn++;
        }
        ++cnt;
    }
}

int get_centroid() {
    vector<int> sz(N);
    auto dfs_sz = [&](auto self, int u, int p) -> void {
        sz[u] = 1;
        for (auto [v, id] : g[u]) if (v != p) {
            self(self, v, u);
            sz[u] += sz[v];
        }
    };
    dfs_sz(dfs_sz, 0, -1);
    auto dfs_cen = [&](auto self, int u, int p) -> int {
        for (auto [v, id] : g[u]) if (v != p) {
            if (sz[v] > sz[0] / 2) return self(self, v, u);
        }
        return u;
    };
    int root = dfs_cen(dfs_cen, 0, -1);
    queue<int> q;
    vector<int> vis(N);
    q.emplace(root);
    vis[root] = true;
    while (not q.empty()) {
        int u = q.front();
        if (isz(g[u]) < 3) {
            root = u;
            break;
        }
        q.pop();
        for (auto [v, id] : g[u]) if (not vis[v]) {
            q.emplace(v);
            vis[v] = true;
        }
    }
    vis.assign(N, -1);
    q = queue<int>();
    vis[root] = 0;
    q.emplace(root);
    while (not q.empty()) {
        int u = q.front();
        q.pop();
        for (auto [v, id] : g[u]) if (vis[v] == -1) {
            vis[v] = vis[u] + 1;
            q.emplace(v);
        }
    }
    assert(*max_element(all(vis)) <= 5000);
    return root;
}

int callitacheck(int u, int p) {
    int sz = 1;
    for (auto [v, id] : g[u]) if (v != p and not ig[id]) {
        int val = callitacheck(v, u);
        if (p == -1) assert(val == 6);
        sz += val;
    }
    if (p == -1) assert(sz == 13);
    return sz;
}

string get_hash(int u, int p) {
    vector<string> vec;
    for (auto [v, id] : g[u]) if (v != p and not ig[id]) {
        vec.push_back(get_hash(v, u));
    }
    sort(all(vec));
    string res = "";
    res.push_back('0');
    for (auto s : vec) res += s;
    res.push_back('1');
    return res;
};

array<int, 3> bfs(int gX, int gY) {
    queue<int> q;
    vector<int> trace(N, -1), d(N, -1);
    d[group[gX][0]] = 0;
    q.emplace(group[gX][0]);
    while (not q.empty()) {
        auto u = q.front(); q.pop();

        if (lab[u].first == gY) {
            int len = 0, ou = u;
            while (lab[u].first != gX) {
                u = trace[u];
                ++len;
            }
            return {u, ou, len};
        }

        for (auto [v, id] : g[u]) {
            if (d[v] == -1) {
                d[v] = d[u] + 1;
                trace[v] = u;
                q.emplace(v);
            }
        }
    }
}

void dfs2(int u, int p, int d) {
    lab[u].first = d;
    for (auto [v, id] : g[u]) if (v != p and not ig[id]) {
        dfs2(v, u, d + 1);
    }
}

}

void Init(int N, vector<int> U, vector<int> V) {
    ::N = N;
    g.assign(N, {});
    for (int i = 0; i < N - 1; ++i) {
        int u = U[i], v = V[i];
        g[u].emplace_back(v, i);
        g[v].emplace_back(u, i);
    }

    dep.assign(N, 0);
    ig.assign(N - 1, false);
    int root = get_centroid();
    dfs1(root, -1);

    nn = N;
    vector<int> avec(N);
    iota(all(avec), 0);
    sort(all(avec), [&](int x, int y) {
        return dep[x] < dep[y];
    });
    group.clear();
    sz.assign(N, 0);
    lst.assign(N, -1);
    par.assign(N, -1);
    lab.assign(N, {-1, -1});
    for (int i : avec) if (lab[i].first == -1) {
        group.emplace_back();
        get_group(i, -1);
        // add_nodes(i);
        // get_hash(i, -1);
        // callitacheck(i, -1);
    }

    for (int i = 0; i < N; ++i) {
        // cout << i << " " << lab[i].first * 13 + lab[i].second << endl;
        SetID(i, lab[i].first * 13 + lab[i].second);
    }
}

string SendA(string S) {
    int val = 0, cnt = 0;
    for (int i = 0; i < 20; ++i) {
        val += (S[i] - '0') << i;
    }
    int gX = -1, gY = -1;
    for (int i = 0; i < 1429; ++i) for (int j = i; j < 1429; ++j) {
        if (val == cnt) gX = i, gY = j;
        ++cnt;
    }

    if (gX == gY) {
        string res = "";
        for (auto u : group[gX]) for (int i = 0; i < 4; ++i) {
            res.push_back((par[u] >> i & 1) + '0');
        }
        return res;
    }

    auto [vX, vY, len] = bfs(gX, gY);
    dfs2(vX, -1, 0); dfs2(vY, -1, 0);

    string res = "";

    sort(all(group[gX]), [&](const auto &lhs, const auto &rhs) {
        return lab[lhs].second < lab[rhs].second;
    });
    for (auto u : group[gX]) for (int i = 0; i < 4; ++i) {
        res.push_back((lab[u].first >> i & 1) + '0');
    }
    while (isz(res) < 52) res.push_back('0');

    sort(all(group[gY]), [&](const auto &lhs, const auto &rhs) {
        return lab[lhs].second < lab[rhs].second;
    });
    for (auto u : group[gY]) for (int i = 0; i < 4; ++i) {
        res.push_back((lab[u].first >> i & 1) + '0');
    }
    while (isz(res) < 104) res.push_back('0');

    for (int i = 0; i < 14; ++i) {
        res.push_back((len >> i & 1) + '0');
    }

    return res;
}

Benjamin

#include "Benjamin.h"
#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define isz(x) (int)x.size()
using namespace std;

namespace {

int gX, nX, gY, nY;

}

string SendB(int N, int X, int Y) {
	if (X > Y) swap(X, Y);

	gX = X / 13, nX = X % 13;
	gY = Y / 13, nY = Y % 13;

	int val = -1, cnt = 0;
	for (int i = 0; i < 1429; ++i) for (int j = i; j < 1429; ++j) {
		if (i == gX and j == gY) val = cnt;
		++cnt;
	}

	string res = "";
	for (int i = 0; i < 20; ++i) {
		res.push_back((val >> i & 1) + '0');
	}
	return res;
}

int Answer(string T) {
	int res = 0;

	if (gX == gY) {
		int N = isz(T) / 4;
		vector<vector<int>> g(N);
		for (int i = 1; i < N; ++i) {
			int p = 0;
			for (int j = 0; j < 4; ++j) {
				p += (T[i * 4 + j] - '0') << j;
			}
			g[p].emplace_back(i);
			g[i].emplace_back(p);
		}
		vector<int> d(N, -1);
		queue<int> q;
		d[nX] = 0;
		q.emplace(nX);
		while (not q.empty()) {
			auto u = q.front(); q.pop();
			for (auto v : g[u]) if (d[v] == -1) {
				d[v] = d[u] + 1;
				q.emplace(v);
			}
		}
		return d[nY];
	}

	// cout << gX << " " << gY << " " << nX << " " << nY << endl;

	for (int i = nX * 4; i < (nX + 1) * 4; ++i) {
		res += (T[i] - '0') << (i - nX * 4);
	}
	for (int i = 52 + nY * 4; i < 52 + (nY + 1) * 4; ++i) {
		res += (T[i] - '0') << (i - 52 - nY * 4);
	}
	for (int i = 104; i < 104 + 14; ++i) {
		res += (T[i] - '0') << (i - 104);
	}
	return res;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 1ms
memory: 3712kb

input:

1
2 1 0
11110000

output:

00000000000000000000
1

input:


output:

1
8

result:

points 1.0 L = 8 (test case 1)

Test #2:

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

input:

1
3 2 1
111100000000

output:

00000000000000000000
2

input:


output:

2
12

result:

points 1.0 L = 12 (test case 1)

Test #3:

score: 15
Accepted
time: 1ms
memory: 3840kb

input:

1
4 2 0
1111000000000100

output:

00000000000000000000
1

input:


output:

1
16

result:

points 1.0 L = 16 (test case 1)

Test #4:

score: 15
Accepted
time: 1ms
memory: 3840kb

input:

1
5 3 1
11110000100010000000

output:

00000000000000000000
1

input:


output:

1
20

result:

points 1.0 L = 20 (test case 1)

Test #5:

score: 15
Accepted
time: 1ms
memory: 3840kb

input:

1
10000 5370 14587
0000100001000100110010000100000000000000000000000000000010000100010011001100100000000000000000000000000001011000000000

output:

00001011111011011110
28

input:


output:

28
118

result:

points 1.0 L = 118 (test case 1)

Test #6:

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

input:

1
10000 11505 1628
0000100001001100010011001100000000000000000000000000000010000100010011001000010000000000000000000000000010001000000000

output:

11001110011110010100
20

input:


output:

20
118

result:

points 1.0 L = 118 (test case 1)

Test #7:

score: 15
Accepted
time: 1ms
memory: 3712kb

input:

1
10000 11648 10064
0000100001001100100001000100000000000000000000000000000010000100110011000010010010000100110011000000000011011000000000

output:

10010110000010100011
29

input:


output:

29
118

result:

points 1.0 L = 118 (test case 1)

Test #8:

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

input:

1
10000 12702 6917
0000100001001000010011000100000000000000000000000000000010000100100001001100110000000000000000000000000010111000000000

output:

11000101110011101001
31

input:


output:

31
118

result:

points 1.0 L = 118 (test case 1)

Test #9:

score: 15
Accepted
time: 2ms
memory: 3712kb

input:

1
10000 6025 7587
0010110000100100100000000100000000000000000000000000000010000100110000100010100001001100001011000000000011010111000000

output:

01010100111011100001
240

input:


output:

240
118

result:

points 1.0 L = 118 (test case 1)

Test #10:

score: 15
Accepted
time: 1ms
memory: 3712kb

input:

1
8191 11896 2164
0000100001000100100001000100000000000000000000000000000010000100010010000100010000000000000000000000000000101000000000

output:

00110000001101101100
23

input:


output:

23
118

result:

points 1.0 L = 118 (test case 1)

Test #11:

score: 15
Accepted
time: 2ms
memory: 3584kb

input:

1
9996 5854 4246
0000100001001100110001001000010011001100010000000000000010000100110011000100110010000100110011000100110000001100000000

output:

11010010101100100110
54

input:


output:

54
118

result:

points 1.0 L = 118 (test case 1)

Test #12:

score: 15
Accepted
time: 2ms
memory: 3712kb

input:

1
9996 7334 10259
0000100001001100110001001100100001001100010011000000000010000100110011000100110010000100110001001100000001000010000000

output:

11101111000001111001
70

input:


output:

70
118

result:

points 1.0 L = 118 (test case 1)

Test #13:

score: 15
Accepted
time: 1ms
memory: 3840kb

input:

1
10000 9663 9637
0000100001001100001010100110000000000000000000000000000010000100110000101010011000000000000000000000000000011010000000

output:

10001010100111111101
96

input:


output:

96
118

result:

points 1.0 L = 118 (test case 1)

Test #14:

score: 15
Accepted
time: 1ms
memory: 3712kb

input:

1
10000 18557 18570
0000100001001100001010100110000000000000000000000000000010000100110000101010011000000000000000000000000011000000111001

output:

10100100111010011111
9999

input:


output:

9999
118

result:

points 1.0 L = 118 (test case 1)

Test #15:

score: 15
Accepted
time: 2ms
memory: 3840kb

input:

1
9997 2754 5482
1000000010000100110000101010010011000010101001101110000010000100110000101010011010000100110000101010011010001011000000

output:

01101000001000100010
218

input:


output:

218
118

result:

points 1.0 L = 118 (test case 1)

Subtask #2:

score: 44.0626
Acceptable Answer

Test #16:

score: 44.0626
Acceptable Answer
time: 15ms
memory: 3712kb

input:

15
2 0 1
11110000
3 2 0
111100000000
4 1 3
1111000010000000
5 4 0
11110000000001000100
10000 4843 4543
0000100010000100110011000100000000000000000000000000000010000100110011000100100001000000000000000000000000001000000000
10000 2631 7690
00001000010011000010101001101000010011001100001000100000100001...

output:

00000000000000000000
1
00000000000000000000
1
00000000000000000000
2
00000000000000000000
2
01000000111101010110
20
01010011100110000010
24
11000111000101001010
20
01101000000110010000
21
00000000111001000110
1866
00000000001011011011
20
01010001100100100010
50
10101000001010001110
62
10110011110100...

input:


output:

1
1
2
2
20
24
20
21
1866
20
50
62
172
9999
659
118

result:

points 0.51838307230 L = 118 (test case 15)

Test #17:

score: 44.0626
Acceptable Answer
time: 44ms
memory: 3840kb

input:

50
2 1 0
11110000
3 0 1
111100000000
4 0 3
1111000010000000
5 3 1
11110000100000001100
6 3 1
111100001000000011000010
7 4 2
1111000010000100010010000000
8 15 14
1111000010000000110000100010
9 15 14
11110000100010000000001010100010
10 19 15
11110000100001001000000010101010
11 14 16
111100001000100011...

output:

00000000000000000000
1
00000000000000000000
1
00000000000000000000
1
00000000000000000000
2
00000000000000000000
2
00000000000000000000
1
10101001101000000000
1
10101001101000000000
1
10101001101000000000
4
10101001101000000000
1
10000000000000000000
3
10000000000000000000
3
10101001101000000000
3
1...

input:


output:

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

result:

points 0.51838307230 L = 118 (test case 50)

Test #18:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3840kb

input:

50
10000 11030 5948
0000100001001100001001001000010001001100001000100000000010000100100001001100010000000000000000000000000010011000000000
10000 8078 1237
0000100001001100001010101100000000000000000000000000000010000100110011000010010000000000000000000000000010110000000000
10000 970 11846
0000100001...

output:

00000001100001100001
29
00010111010000000100
19
01010011101010011000
26
10101001111100100101
32
01011110000010000100
21
10001110000100110010
23
11101001011100011110
29
00101100001001110010
26
10110100001001100100
21
00100111110110000110
29
01000010111000100011
28
00100010111101101110
29
101000000100...

input:


output:

29
19
26
32
21
23
29
26
21
29
28
29
24
16
25
27
27
22
26
23
29
24
30
28
30
23
21
19
19
35
28
34
23
23
30
23
17
24
34
26
21
32
27
36
22
28
28
28
25
15
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #19:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3840kb

input:

50
10000 13325 7748
0000100001000100110000101100100001001100000000000000000010000100110000100010110010000100110000000000000010101000000000
10000 8296 783
0000100010000100010011001100000000000000000000000000000010000100110011001000010011000000000000000000000011001000000000
10000 4644 9637
00001000010...

output:

11001111110100100101
21
00100010010100101000
23
11110000010010110110
29
11101111101000111000
18
01001110001010111101
29
10000110010101000110
25
10111101000010011101
30
10001011100001100010
25
10011011100010110110
27
00100101001010110100
26
00011111001001100001
27
01110001010111001100
25
111110110011...

input:


output:

21
23
29
18
29
25
30
25
27
26
27
25
38
21
24
35
34
37
22
23
30
27
26
25
27
39
29
25
26
33
18
25
20
30
20
32
28
29
20
20
25
15
35
28
25
20
20
15
28
30
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #20:

score: 44.0626
Acceptable Answer
time: 47ms
memory: 3712kb

input:

50
10000 6268 10172
0000100001001100010010000100110000101100000000000000000010000100010011000010110010000100000000000000000010010000000000
10000 1328 694
0000100001001100100001001100010000000000000000000000000010000100110011000010001010000100110001000000000011110000000000
10000 9781 4610
00001000010...

output:

10100111011111010001
14
00010101010001001000
19
11100001101000110110
29
10100101100010110010
25
10001101000110110111
41
10101000010111101010
23
11111001101000101000
25
01100011010101001100
20
11001101000111110110
28
01101011010011110101
21
00111010101000000010
23
01001000000001101101
27
110101100111...

input:


output:

14
19
29
25
41
23
25
20
28
21
23
27
29
27
25
29
18
27
18
27
19
27
20
25
26
18
21
26
23
24
25
16
28
39
22
25
30
23
4
20
29
24
25
19
22
31
30
26
32
27
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #21:

score: 44.0626
Acceptable Answer
time: 45ms
memory: 3712kb

input:

50
10000 12795 6129
0000100001001100001010100110000000000000000000000000000010000100110000101010011000000000000000000000000011111011110010
10000 12746 11572
0010110001001000000010001010011000000000000000000000000010000100110011000010101000000000000000000000000010111011000000
10000 11375 3796
1010011...

output:

11100011011010010001
5096
11100000111110101011
228
10100010010111011010
1178
11101000111101111011
422
11111110100100000100
1510
00001100111101110001
1743
01010010011000100111
2292
01001111000110110001
1293
01011010011111010010
137
00110010100010000110
244
00000110010111110000
562
0100110101011001100...

input:


output:

5096
228
1178
422
1510
1743
2292
1293
137
244
562
433
800
881
782
360
320
697
116
475
216
107
489
724
424
152
365
192
99
333
304
338
476
382
423
99
104
241
347
276
286
346
508
335
198
276
266
153
124
352
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #22:

score: 44.0626
Acceptable Answer
time: 48ms
memory: 3712kb

input:

50
10000 586 11367
0000100001000100110010000100010011001100000000000000000010001000010011001100001010100000000000000000000000000001000000
10000 15215 10024
0000100001001100110010000100110000101010000000000000000010000100110000101010010010000100110000101100000000101110000000
10000 8233 2848
000010000...

output:

00001001010111110000
132
11010011100100100011
122
01101011010101100010
53
11011110110110110010
57
11101111000111000111
83
00110100000001010110
45
01101101010100010001
50
10001000001001101000
28
01110101100100111000
35
01000110111110101110
38
01000010010000001010
46
00001110101011001100
23
1011010001...

input:


output:

132
122
53
57
83
45
50
28
35
38
46
23
20
36
29
34
39
27
18
30
31
28
34
21
21
26
19
35
31
22
24
33
27
29
27
28
32
37
27
18
25
28
26
23
27
31
31
17
17
27
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #23:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3840kb

input:

50
10000 7984 13523
1100001001001100100001000000100000000000000000000000000010001000010001001100110000100000000000000000000010001010110000
10000 9523 11481
0000100001001100001010000100110000000000000000000000000010000100110010000100110000100000000000000000000011110010011000
9996 10040 8086
100000001...

output:

10010111101000010101
853
10010001100001111101
1620
10001100011110010101
154
10001101100101101011
849
00110010000010101001
559
10011101101111011110
80
00110010010011110100
131
01111110011001011010
163
10000000000011110101
101
11001000110101011011
91
11000111010011001110
149
10010110100010001110
227
0...

input:


output:

853
1620
154
849
559
80
131
163
101
91
149
227
253
142
194
215
80
167
89
261
185
192
168
87
182
74
98
79
175
64
75
153
34
134
93
155
34
101
187
91
96
105
166
228
143
151
125
115
183
95
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #24:

score: 44.0626
Acceptable Answer
time: 45ms
memory: 3840kb

input:

50
10000 9243 13551
0000100001001100001010100110000000000000000000000000000010000100110000101010011000000000000000000000000001001111111010
10000 2863 14148
0110101000101100010010000000000000000000000000000000000010000100110000101010011000000000000000000000000010010111101000
9996 17075 12457
00001000...

output:

10010100000101011101
6135
01101010100011100010
1520
01101010011001111011
2649
01100111001101001110
920
01110001001111101101
1025
11100100100111101011
1280
01111111111101110110
652
11011011010100011000
397
11101011100000101110
457
11101111110011101101
521
00010011100100011100
379
00110000100110100111...

input:


output:

6135
1520
2649
920
1025
1280
652
397
457
521
379
721
359
543
436
283
248
267
99
312
231
178
186
282
95
303
144
129
335
146
267
216
25
119
184
78
269
128
96
137
164
204
125
78
103
72
140
85
182
159
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #25:

score: 44.0626
Acceptable Answer
time: 45ms
memory: 3840kb

input:

50
10000 3043 837
0000100001000100100001000100000000000000000000000000000010000100110000101100100001001100001000100000000011110000000000
10000 13771 1983
0000100001001100001011000100100001001100000000000000000010001000010011001100010000000000000000000000000001110000000000
10000 13396 8547
0000100001...

output:

01010000011110101000
18
11110100111001001100
18
01001000110100001101
34
10011100111101111100
26
01101101000010001011
36
10100011100000001101
35
01111100100010010101
17
01000011111110101110
26
10010111001111100111
38
11110100110000001100
24
01111101011111110001
36
10101101000000111000
31
010001010001...

input:


output:

18
18
34
26
36
35
17
26
38
24
36
31
28
22
30
30
35
15
25
36
30
13
31
26
30
34
26
27
4
34
13
34
17
28
29
33
16
23
23
29
27
15
29
26
27
27
23
25
23
25
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #26:

score: 44.0626
Acceptable Answer
time: 45ms
memory: 3840kb

input:

48
3 1 0
111100000000
7 3 2
1111000010001000000000100010
15 26 19
0000100001000100100001000100000000000000000000000000000010000100010010000100010000000000000000000000000001000000000000
31 26 18
0000100001000100100001000100000000000000000000000000000010000100010010000100010000000000000000000000000001...

output:

00000000000000000000
1
00000000000000000000
2
01101001101000000000
4
01101001101000000000
4
00010000000000000000
5
10011010011010000000
12
10010000111001000000
14
01111100110100000000
5
00100010000101101000
18
00011101111011100100
15
00111011100000111010
22
01101010010000100100
18
000000000000000000...

input:


output:

1
2
4
4
5
12
14
5
18
15
22
18
2
1
5
3
9
7
13
11
13
17
17
18
2
1
3
3
3
9
14
13
16
19
16
22
1
2
4
2
7
2
5
14
13
15
17
21
118

result:

points 0.51838307230 L = 118 (test case 48)

Test #27:

score: 44.0626
Acceptable Answer
time: 43ms
memory: 3712kb

input:

48
60 44 14
1000010011000010000010000100000000000000000000000000000010000100110010000100110000000000000000000000000010000000000000
60 83 30
0100110000101010011010000100110000000000000000000000000010000100110000101100001000000000000000000000000011000000000000
60 0 53
000010000100110011000000000000000...

output:

11101001101000000000
5
10110100110100000000
12
00100000000000000000
5
01110100110100000000
11
01011001101000000000
6
11101001101000000000
7
11110010011010000000
11
10111101000010000000
11
10101001101000000000
6
10111101000010000000
9
00110100110100000000
6
00110001001101000000
2
10010100110100000000...

input:


output:

5
12
5
11
6
7
11
11
6
9
6
2
1
6
8
7
33
50
52
53
55
49
48
68
68
61
62
48
53
59
65
55
32
44
53
48
32
53
37
55
66
48
38
63
60
55
51
65
118

result:

points 0.51838307230 L = 118 (test case 48)

Test #28:

score: 44.0626
Acceptable Answer
time: 42ms
memory: 3712kb

input:

48
60 26 0
0000100000000000000000000000000000000000000000000000000010000100100001001100001011000000000000000000000011000000000000
60 18 43
0100110000101010001010101000010011000000000000000000000010000100110001001100100001001100010011000000000010000000000000
60 41 3
1100001010100110011001001000010011...

output:

01000000000000000000
3
11101001101000000000
8
11000000000000000000
9
00000111110110000000
12
11111101000010000000
16
00011001101000000000
7
10011001101000000000
10
10111101000010000000
14
11110010011010000000
13
11101001101000000000
7
01111101000010000000
9
11010100110100000000
8
0000101001101000000...

input:


output:

3
8
9
12
16
7
10
14
13
7
9
8
9
8
7
10
45
67
62
27
51
57
78
60
62
38
78
50
44
29
52
69
46
64
55
59
33
51
20
66
38
68
75
64
53
47
41
67
118

result:

points 0.51838307230 L = 118 (test case 48)

Test #29:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3840kb

input:

50
4 2 0
1111000010001000
7 3 4
1111000000000100110001001010
10 14 18
1111000010001000000000100010
13 16 14
111100001000010010000000101001101010
16 23 22
11110000100001001000001000000110111001101001
19 16 4
100000001000010001000100000000000000000000000000000000001000010011001100010011001000010011001...

output:

00000000000000000000
2
00000000000000000000
1
10101001101000000000
3
10101001101000000000
2
10101001101000000000
1
10000000000000000000
6
00111101000010000000
2
00111101000010000000
3
01101001101000000000
5
01010100110100000000
8
00111101000010000000
4
11000000000000000000
8
01101001101000000000
7
0...

input:


output:

2
1
3
2
1
6
2
3
5
8
4
8
7
8
8
8
4
7
9
8
8
5
6
9
6
5
4
8
10
9
8
9
7
4
9
4
9
6
10
10
8
9
8
8
11
9
10
10
2
6
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #30:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3840kb

input:

50
10000 15873 15006
0000100001001100001010100110000000000000000000000000000010000100110000101010011000000000000000000000000011001110000001
10000 15122 15450
0000100001001100001010100110000000000000000000000000000010000100110000101010011000000000000000000000000011111000000001
10000 18499 16744
00001...

output:

00110100110000001111
8311
10010001001100001111
8232
11001001000011101111
9483
01101011000110101111
9299
10110100000011001111
9103
11111001000100101111
9284
00111000000100011111
9619
01000001011101101111
9120
10010111011010101111
8821
10001011110010101111
9239
10111101110010011111
9811
11100110011100...

input:


output:

8311
8232
9483
9299
9103
9284
9619
9120
8821
9239
9811
8984
8961
8830
9081
8820
8968
8551
8900
8774
9137
9142
9647
9346
9173
9302
9065
8626
9195
9105
9668
8908
8705
9318
9776
9097
8813
8679
9520
9501
9288
8882
9696
8858
8436
9466
9525
9681
8480
8759
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #31:

score: 44.0626
Acceptable Answer
time: 45ms
memory: 3584kb

input:

50
10000 18557 0
1000000001001100000000000000000000000000000000000000000010000100110000101010011000000000000000000000000000000001110010
10000 2 18570
0100110010000000000000000000000000000000000000000000000010000100110000101010011000000000000000000000000000000001110010
10000 14942 1941
01101010001011...

output:

11001001101000000000
4999
00101001101000000000
4999
11110001000110001100
3501
01011001101000110000
4085
00001011000001000010
3357
01110000100011110000
4080
11101111011101010010
3523
01011011011111010100
4363
11001001001111011000
4557
10011111000011110100
4002
00000111010110100010
4121
10010100001000...

input:


output:

4999
4999
3501
4085
3357
4080
3523
4363
4557
4002
4121
3501
3550
3643
3335
4092
3928
3860
4228
3464
3446
3884
3859
3951
4608
3979
3683
4508
4457
4365
4047
4003
3518
4324
4152
4284
4075
4115
4782
3810
1
1
1
1
1
1
1
1
1
1
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #32:

score: 44.0626
Acceptable Answer
time: 45ms
memory: 3712kb

input:

50
10000 16031 16905
0000100001001100001010100110000000000000000000000000000010000100110000101000010011000000000000000000000010010000110110
10000 15565 14157
0000100001001100001010100110000000000000000000000000000010000100010011000010101000000000000000000000000000100100000110
10000 16719 15565
00001...

output:

00000000001100101111
6924
10000100101011010111
6183
00110111101101001111
6782
01111010010101110111
6181
00000110010011010111
6085
10110111111111010111
6513
00011101010101010111
6451
00010101100010010111
6449
10011000001111010111
6450
10000100111111001111
6737
11100101010001110111
6496
11101111000101...

input:


output:

6924
6183
6782
6181
6085
6513
6451
6449
6450
6737
6496
6143
6361
6883
6082
6441
6689
6117
6391
6514
6582
6624
6694
6392
6158
6004
6553
6535
6319
6516
6426
7243
6280
6633
6312
6145
6509
6538
6158
6203
6296
6342
6558
5934
6883
6810
6685
6897
6074
6560
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #33:

score: 44.0626
Acceptable Answer
time: 47ms
memory: 3840kb

input:

50
10000 17049 0
0000000000000000000000000000000000000000000000000000000010000100110000101010011000000000000000000000000010011100011100
10000 21 17101
0000100001001100001010100110100001001100000000000000000010000100110000101010011000000000000000000000000011111111101100
10000 15421 1823
0110101000101...

output:

11111000101000000000
3647
11101101010100000000
3591
00001001110101110100
2870
00010001110100010100
3058
01000011101000101100
2920
10011010111111111000
2623
01000101000011110100
2855
10011011100001111100
2391
01010000100010100010
2999
10110110111101010000
2950
10001100111100101100
2672
11000000010011...

input:


output:

3647
3591
2870
3058
2920
2623
2855
2391
2999
2950
2672
3250
2963
3299
2605
2214
2897
2434
3007
3558
3023
2879
2645
2723
2530
2771
3270
2732
2628
2978
2594
2722
2419
2690
2899
3079
2291
3542
2412
2930
1
3
1
1
1
5
1
1
1
1
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #34:

score: 44.0626
Acceptable Answer
time: 44ms
memory: 3712kb

input:

48
100 148 65
1100010010000000100001001100001000000000000000000000000010000100110000101100010010000000000000000000000010010000000000
100 67 28
0000100001001100010011001000000000000000000000000000000010000100110001001100100000000000000000000000000000010000000000
96 105 18
0000100001001100001001001100...

output:

10100111110110000000
15
00110100110100000000
12
00111001101000000000
15
01100000000000000000
10
00100111110110000000
19
11001010011010000000
16
10110100110100000000
8
01001010011010000000
6
10010100110100000000
2
10000000000000000000
3
11100000000000000000
14
01111111011001000000
1
01010000000000000...

input:


output:

15
12
15
10
19
16
8
6
2
3
14
1
12
10
9
7
2930
2639
1158
216
614
1622
951
445
608
326
821
767
422
115
6
103
2473
1369
1460
804
1359
572
469
269
370
240
458
400
40
1019
574
309
118

result:

points 0.51838307230 L = 118 (test case 48)

Test #35:

score: 44.0626
Acceptable Answer
time: 44ms
memory: 3712kb

input:

48
10000 1874 17125
0000100001001100001010100110000000000000000000000000000010000100110001001000010011000100000000000000000010001001100010
10000 3368 12337
0110101000101100010010000000000000000000000000000000000010000100110001001000010011000100000000000000000001100010100100
10000 12820 15799
0000100...

output:

10110100000000001100
4501
01110111101001001010
2379
01000111111010000111
7003
01001011100011010110
2016
10001011101100001110
1904
01000000000011000111
7044
00100101010001111001
1773
01100001100011110011
497
11000101110010110010
4349
01001110110001111011
6724
11010101100100001010
1736
100010110010001...

input:


output:

4501
2379
7003
2016
1904
7044
1773
497
4349
6724
1736
1956
5687
5335
3231
446
904
3051
1019
423
613
2333
42
227
3048
3048
2274
42
26
51
21
2947
141
150
43
158
40
40
154
52
49
44
36
39
58
173
44
164
118

result:

points 0.51838307230 L = 118 (test case 48)

Test #36:

score: 44.0626
Acceptable Answer
time: 44ms
memory: 3712kb

input:

50
9828 2024 3771
0000100001001100001011000010100001001100001011000010000010000100110000101010011000000000000000000000000011000011000000
9828 4760 4886
1000000010000100110001001100010011000010101000101010000010000100110000101010011010000100110000101010011010000000000000
9828 4301 4578
00101100010010...

output:

11111000110011001100
199
00100100011011110110
7
11011000011110100110
10
10110101001001001101
6
10010101111011011100
12
01101011010100100011
7
00101111101111100101
9
10000100100101000011
7
10010100000000110101
9
00011001001101000000
12
00011011000010100101
6
11010010000110011001
6
0011001101000010000...

input:


output:

199
7
10
6
12
7
9
7
9
12
6
6
14
423
7
4
5
6
10
7
5
6
6
15
9
7
514
6
4
10
8
13
6
6
7
10
10
7
12
325
5
8
6
6
4
7
7
7
5
12
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #37:

score: 44.0626
Acceptable Answer
time: 45ms
memory: 3840kb

input:

50
9828 1035 1399
1010011011100001100100011001001011000100100000001000000010000100110000101010011010000100110000101010011010000000000000
9828 7175 7589
0110111000011001010110010101101000101100010010000000000010000100110000101010011010000100110000101010011010000000000000
9828 3699 4593
00001000010011...

output:

01110000101101011000
6
01110111110011011001
5
11101001001010011010
285
01110010001110111000
9
10010000101111010101
13
01010101011001100110
5
01100011010011101000
10
00010000111001000000
9
01011000011010111101
7
11100000011110010110
5
00011100111110011100
6
10110010100011111101
3
00110011111011100110...

input:


output:

6
5
285
9
13
5
10
9
7
5
6
3
10
12
8
588
3
9
12
13
5
9
10
7
7
10
6
6
260
8
10
9
3
9
10
6
2
2
9
3
10
174
8
8
14
7
12
8
4
5
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #38:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3840kb

input:

50
9828 4649 4890
1100001010100110111001101110010010000000100011000010000010000100110000101010011010000100110000101010011010000000000000
9828 3362 3621
0010101001101110000111100001110001001000000000101010000010000100110000101010011010000100110000101010011010000000000000
9828 2359 2492
01001100001010...

output:

01000101000010110110
4
10111101011110001010
4
10000011010011011100
10
10001001100001000110
11
00000100001001100100
213
10010110000011011001
9
11111001111010110001
11
01111100111110011100
10
01011010100110101001
12
00000111101100011001
10
01100100110101101101
14
00110011100110010110
3
011100010011011...

input:


output:

4
4
10
11
213
9
11
10
12
10
14
3
10
12
13
1
13
4
5
4
7
7
8
8
11
11
2
1
15
11
295
4
3
6
10
14
10
10
4
8
9
11
9
205
4
9
6
10
10
7
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #39:

score: 44.0626
Acceptable Answer
time: 48ms
memory: 3840kb

input:

50
9828 4752 4871
1000010011000010101010100010000010000100110011000100000010000100110000101010011010000100110000101010011010000000000000
9828 2233 2355
1000010011000010101010100010000010000100110011000100000010000100110000101010011010000100110000101010011010000000000000
9828 5167 5464
00101100010010...

output:

00111111100011110110
4
01010011100000011100
6
01011000101011101110
8
10001011101011001001
6
10111110001001111110
8
10001110010100010000
12
10010011001010010101
620
10000001100111101101
4
11100110000011011001
5
01010100101110000010
12
10001001110011001101
12
00000000001011111101
10
101010101100001000...

input:


output:

4
6
8
6
8
12
620
4
5
12
12
10
8
5
10
8
6
7
8
118
3
13
12
9
10
5
7
7
7
8
12
13
61
6
7
8
9
10
9
8
5
5
7
8
8
163
7
8
6
10
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #40:

score: 44.0626
Acceptable Answer
time: 47ms
memory: 3840kb

input:

50
9828 6866 7153
0010110001001000010000001100101001101110000111100110000010000100110000101010011010000100110000101010011010000000000000
9828 5816 6038
1100010010000100110011000000001010100110111001101010000010000100110000101010011010000100110000101010011010000000000000
9828 4614 4799
01001100001010...

output:

01110111110001101001
6
11011011100111000001
10
00010000001000110110
3
01001011001110101110
11
11011001011101000110
8
00100010000011000010
5
10010100010011000001
10
10101111111100100011
9
10001110001010010010
88
00001000000110101000
6
10101101011011111100
6
01001000111000100101
6
01000011100001010010...

input:


output:

6
10
3
11
8
5
10
9
88
6
6
6
11
2
9
7
13
8
6
6
13
286
11
3
10
4
9
9
11
12
13
10
3
6
278
5
4
9
12
14
8
9
2
7
14
13
13
555
9
4
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #41:

score: 44.0626
Acceptable Answer
time: 47ms
memory: 3840kb

input:

50
9828 1403 1671
0010110001001000010000001100101001101110000110010110000010000100110000101010011010000100110000101010011010000000000000
9828 8234 8528
0010110001001000000001001100101001101110000110010110000010000100110000101010011010000100110000101010011010000000000000
9828 6947 7167
00101100010010...

output:

10101100111111000100
8
00010100000000110101
3
00011111000111101001
5
11011110011011111000
4
11110000000000111101
13
10110101101000001100
13
00101101000101111010
11
01110100000011000101
6
10010010001001101100
7
11100110110110001110
7
00110101110111110100
19
11000110101100101000
8
00100001100100100100...

input:


output:

8
3
5
4
13
13
11
6
7
7
19
8
5
12
12
11
3
5
6
4
10
9
6
496
4
8
4
10
11
6
7
8
9
10
15
9
267
13
14
6
9
6
6
4
8
2
7
10
6
414
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #42:

score: 44.0626
Acceptable Answer
time: 47ms
memory: 3712kb

input:

50
9828 1205 1335
1000000010000100110000100100010011000010101001100110000010000100110000101010011010000100110000101010011010000000000000
9828 2115 2299
0100110000101010011011101010100000001000010011001100000010000100110000101010011010000100110000101010011010000000000000
9828 3590 3856
11000100100000...

output:

00111100100011111000
8
11100110101010101100
7
01011110000011101010
4
10110010001001111010
6
10111010010100100101
17
00110100101110110110
11
11110111001000111001
7
11000000011010011101
8
10011001100100010001
13
10101110100011110101
2
11010001000111110001
12
01111000001010100101
7
10010010010111010001...

input:


output:

8
7
4
6
17
11
7
8
13
2
12
7
458
11
10
9
13
6
10
7
9
6
9
8
9
529
7
8
9
6
8
7
7
7
6
12
12
7
124
4
6
7
4
2
7
4
7
6
15
9
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #43:

score: 44.0626
Acceptable Answer
time: 44ms
memory: 3840kb

input:

50
9828 5038 5285
1100001010100110111000010110010011000010101010000000000010000100110000101010011010000100110000101010011010000000000000
9828 373 473
0000100001001100001010101100100001001100001010100010000010000100110000101010011000000000000000000000000010111000000000
9828 204 326
100000001000010011...

output:

11110001001100101110
4
01011011010110010000
37
00111010110010100000
6
01111010100111001001
6
01100011010101010110
8
01100001000111110001
12
11101111011001011101
13
01111101111001011000
9
11010110010000011010
5
00111101010011100010
10
10110010100011111101
8
10001010011110111101
9
10110011001110111001...

input:


output:

4
37
6
6
8
12
13
9
5
10
8
9
9
6
168
11
7
6
4
2
6
9
3
10
9
6
10
232
5
6
4
10
13
14
11
8
8
7
8
10
324
8
7
3
11
8
12
9
6
4
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #44:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3712kb

input:

50
9828 9434 9718
0010101001101110000110010101110001001000000010000100000010000100110000101010011010000100110000101010011010000000000000
9828 8800 9091
1010011011100001100101011101001011000100100000001000000010000100110000101010011010000100110000101010011010000000000000
9828 1709 2111
01101110000110...

output:

10111011101100111101
3
10101010010000101101
6
11011000010111010100
18
01000110000111011100
260
01100110100000000011
7
10001111010101100110
9
00001010000000010110
12
01011001101000000000
12
01111000100010010001
8
10011111001001101110
16
11100011101010110101
7
01100010110010000001
5
101111011000010100...

input:


output:

3
6
18
260
7
9
12
12
8
16
7
5
7
8
11
9
165
6
9
5
5
6
2
10
9
4
11
6
8
403
5
10
7
13
8
8
6
10
15
8
5
8
366
8
7
10
5
12
10
6
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #45:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3840kb

input:

50
9828 4621 4809
0100110000101010011011100001100000001000010001001100000010000100110000101010011010000100110000101010011010000000000000
9828 1624 1792
1100001010100110111000011001010010000000100011000010000010000100110000101010011010000100110000101010011010000000000000
9828 3010 3280
00101010011011...

output:

01011100000100110110
15
11110110011010010100
10
11000011100001010010
8
01001101000110001101
9
01000001011110011101
9
10011001100010111110
92
10011110110100101100
5
11100000100001100101
7
11101110101110110100
6
01000001011110011101
8
11000101111000001000
6
11111101110001001100
9
00101100110000110101
...

input:


output:

15
10
8
9
9
92
5
7
6
8
6
9
4
9
11
9
12
9
64
8
5
3
9
14
8
11
7
10
9
10
11
379
10
11
7
5
5
7
5
7
14
10
8
9
239
8
7
11
10
16
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #46:

score: 44.0626
Acceptable Answer
time: 44ms
memory: 3840kb

input:

50
9828 5074 5383
1010001011000100100001000000011011100001100101010101000010000100110000101010011010000100110000101010011010000000000000
9828 7461 7538
1000010011000010101001100110000010000100110000100010000010000100110000101010011010000100110000101010011010000000000000
9828 9029 9216
01001100001010...

output:

11100011000110101110
3
10000110011111111001
10
10100101011011101101
8
01011101011110001100
12
01011101111011000000
13
10000011011110001100
7
10110110001111101101
7
01010010110011011000
124
11001000111001010101
8
11111101010101010110
4
11000000010111000101
2
11100110011110101010
11
011001010000000011...

input:


output:

3
10
8
12
13
7
7
124
8
4
2
11
3
7
9
8
8
6
13
11
283
8
9
11
11
8
8
10
3
12
14
8
11
404
2
6
6
8
7
9
13
9
4
5
7
6
316
9
6
6
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #47:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3840kb

input:

50
9828 8664 9011
1010001011000100100001000000011011100001100101011001000010000100110000101010011010000100110000101010011010000000000000
9828 1524 1900
1010001011000100100000000100011011100001100101011001000010000100110000101010011010000100110000101010011010000000000000
9828 3385 3730
10100010110001...

output:

00011101001001001101
3
00101101010011100100
5
00010111111001001010
9
11101110110101000010
9
00010001110110010100
6
01100010100101100010
6
11001101101101001100
4
01011111111111101001
14
10110011110011101101
14
10001001100011110100
136
11111001110011010101
3
11000111110010101101
7
01011001110011011010...

input:


output:

3
5
9
9
6
6
4
14
14
136
3
7
7
4
8
4
12
8
5
16
7
10
55
9
5
8
7
9
11
5
13
14
9
7
9
35
13
3
4
11
11
13
5
6
11
12
10
12
173
7
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #48:

score: 44.0626
Acceptable Answer
time: 47ms
memory: 3712kb

input:

50
9828 4228 4385
0100110000101010011010100010100001001100110000001000000010000100110000101010011010000100110000101010011010000000000000
9828 6712 6960
1100010010000000100001001100001010100110011010100110000010000100110000101010011010000100110000101010011010000000000000
9828 8319 8589
00101100010010...

output:

11010001000100100110
10
10000110100111001001
7
11111101010010110101
11
10000101010000001110
6
11111110010001110100
9
00110100101000110001
10
00011101101010001101
11
00100110001010011010
9
00100000100001111101
10
10111000001001011101
7
11101000111010111000
11
00110101100100001101
15
01001001100000101...

input:


output:

10
7
11
6
9
10
11
9
10
7
11
15
5
3
9
7
10
10
10
4
7
7
5
7
169
5
6
5
10
14
10
7
5
15
3
9
13
566
6
14
7
10
4
9
11
7
8
5
15
9
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #49:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3840kb

input:

50
9828 9905 9572
0000100001001100001010100110000000000000000000000000000010000100110000101100010010000100110000100010010000001001010000
9828 5736 5923
0100110000101010011010100010100000001000010001000100000010000100110000101010011010000100110000101010011010000000000000
9828 7132 7309
01001100001010...

output:

10010111110101111101
662
11111101010001000001
8
00110001100101011001
4
01101110010001011000
11
01100111000000010010
5
01100010011100001001
14
01101000001100000011
9
00011001001000010110
8
01010001001001100010
7
11111100101111011101
1
10000000101000111001
13
00011101100001001101
14
111110010011101011...

input:


output:

662
8
4
11
5
14
9
8
7
1
13
14
11
196
11
6
7
10
3
5
7
9
11
10
4
5
344
7
12
7
9
6
13
8
9
9
9
1
9
11
7
9
8
15
5
9
9
7
1
7
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #50:

score: 44.0626
Acceptable Answer
time: 45ms
memory: 3712kb

input:

50
9828 3437 3799
1010011011100001000111100001001011000100100000001100000010000100110000101010011010000100110000101010011010000000000000
9828 3999 4295
0010101001101110111001101110110001001000010011000000000010000100110000101010011010000100110000101010011010000000000000
9828 7479 4218
00001000010011...

output:

00010100010111001010
11
11010010010111111010
8
10010100101000100110
403
10101111101101100101
3
00101110001111101001
6
01010100010011000000
13
11111011001100100110
5
10001100111110011001
9
01001010011101000001
4
11010110111000000110
9
10100100111010000001
6
01001110111001101010
6
10111000100110001001...

input:


output:

11
8
403
3
6
13
5
9
4
9
6
6
12
8
4
221
3
9
10
9
9
8
9
8
13
4
9
7
198
13
9
5
13
7
7
11
10
11
7
8
11
194
7
5
9
8
11
5
7
9
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #51:

score: 44.0626
Acceptable Answer
time: 45ms
memory: 3840kb

input:

50
9828 3524 3742
1100010010000000100011000010001010100110111000011110000010000100110000101010011010000100110000101010011010000000000000
9828 7558 7850
0010101001101110000101101110110001001000000010000100000010000100110000101010011010000100110000101010011010000000000000
9828 9056 9382
10100110111000...

output:

01000111100110101010
8
10101000100110000101
12
10110110001111101101
7
10011101000101001100
8
11010011100011100000
343
01001000111000100101
8
00011001010001110001
8
10101011100010111000
5
00010101010101001101
14
01010011010000100000
1
01100111110001000011
13
10010010000110011001
10
000101111010010001...

input:


output:

8
12
7
8
343
8
8
5
14
1
13
10
7
6
6
8
8
123
6
5
5
3
3
5
5
8
8
3
13
5
395
12
5
5
10
11
10
5
8
8
8
9
6
172
7
9
9
8
10
9
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #52:

score: 44.0626
Acceptable Answer
time: 46ms
memory: 3712kb

input:

50
9828 9512 9854
1010011011100001100101011001001011000100100000001010000010000100110000101010011010000100110000101010011010000000000000
9828 652 827
0100110000101010011011100110100000001000010011000100000010000100110000101010011010000100110000101010011010000000000000
9828 1673 1855
1100001010100110...

output:

11001010011110111101
3
01111010010010001000
7
01110011010101010100
4
01001101100100001101
9
01110111101101011100
4
10010111010110000100
6
01100000011100100101
579
10011001110000001101
9
10101001101010010110
5
10010000111000110010
6
01010010111011000110
9
01100110000001010000
12
11010111100111010101
...

input:


output:

3
7
4
9
4
6
579
9
5
6
9
12
3
7
7
10
3
9
14
279
10
5
9
9
12
1
4
4
11
10
6
5
462
9
10
10
7
10
10
10
8
13
4
7
7
344
8
5
9
4
118

result:

points 0.51838307230 L = 118 (test case 50)

Test #53:

score: 44.0626
Acceptable Answer
time: 8ms
memory: 3712kb

input:

8
9828 4574 4826
0010110001001000010000000010101001101110000100010110000010000100110000101010011010000100110000101010011010000000000000
9828 4788 4937
0100100001001100001000100000110000101010011001100010000010000100110000101010011010000100110000101010011010000000000000
9828 4650 4804
010011000010101...

output:

01110110111011010110
12
11001110011111110110
9
11011001000010110110
3
10011101010011100010
9
11111000010011011101
6
00010010011001110001
6
01000011010111100101
3
01111000110101101101
9

input:


output:

12
9
3
9
6
6
3
9
118

result:

points 0.51838307230 L = 118 (test case 8)

Test #54:

score: 44.0626
Acceptable Answer
time: 47ms
memory: 3840kb

input:

50
10000 18555 18569
0000100001001100001010100110000000000000000000000000000010000100110000101010011000000000000000000000000001111111100110
10000 18557 18569
0000100001001100001010100110000000000000000000000000000010000100110000101010011000000000000000000000000001111111100110
10000 18540 18554
00001...

output:

10100100111010011111
6663
10100100111010011111
6665
01000100111010011111
6659
01000100111010011111
6663
01000100111010011111
6661
01011101110111000111
5795
10101110110011110111
6646
00011100100111111101
5786
00100101101001100111
6355
01110010010011101111
6106
11100011101010111011
5831
11001010011010...

input:


output:

6663
6665
6659
6663
6661
5795
6646
5786
6355
6106
5831
6753
7414
6634
7070
5875
6062
6746
6382
7441
7068
5700
5793
6383
6595
5762
6919
6687
6492
7106
6962
6282
6787
6284
5916
7248
7048
5893
6113
7323
5992
6503
7237
7392
6388
5715
7597
7187
5710
5730
118

result:

points 0.51838307230 L = 118 (test case 50)