QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#862189#9980. Boolean Function Reconstructionucup-team2796#AC ✓418ms4224kbC++175.3kb2025-01-18 22:43:362025-01-18 22:43:36

Judging History

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

  • [2025-01-18 22:43:36]
  • 评测
  • 测评结果:AC
  • 用时:418ms
  • 内存:4224kb
  • [2025-01-18 22:43:36]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) sort(ALL(v)), (v).erase(unique(ALL(v)), (v).end())
#define SZ(v) (int)v.size()
#define MIN(v) *min_element(ALL(v))
#define MAX(v) *max_element(ALL(v))
#define LB(v, x) int(lower_bound(ALL(v), (x)) - (v).begin())
#define UB(v, x) int(upper_bound(ALL(v), (x)) - (v).begin())

using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;
const int inf = 0x3fffffff;
const ll INF = 0x1fffffffffffffff;

template <typename T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T, typename U> T ceil(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U> T floor(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T> int popcnt(T x) {
    return __builtin_popcountll(x);
}
template <typename T> int topbit(T x) {
    return (x == 0 ? -1 : 63 - __builtin_clzll(x));
}
template <typename T> int lowbit(T x) {
    return (x == 0 ? -1 : __builtin_ctzll(x));
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "P(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#ifdef LOCAL
#define show(...) _show(0, #__VA_ARGS__, __VA_ARGS__)
#else
#define show(...) true
#endif
template <typename T> void _show(int i, T name) {
    cerr << '\n';
}
template <typename T1, typename T2, typename... T3>
void _show(int i, const T1 &a, const T2 &b, const T3 &...c) {
    for (; a[i] != ',' && a[i] != '\0'; i++)
        cerr << a[i];
    cerr << ":" << b << " ";
    _show(i + 1, a, c...);
}

/**
 * @brief template
 */

ll Counting(string S) {
    int COUNT = 0;
    for (char C : S) {
        if (C == '&' || C == '|') COUNT++;
    }
    return COUNT;
}

void Solve() {
    int N;
    cin >> N;
    vector<int> B(1<<N);
    {
        string S;
        cin >> S;
        rep(i,0,1<<N) B[i] = S[i]-'0';
    }
    auto A = B;
    {
        rep(i,0,N) {
            rep(j,0,1<<N) {
                if (j&(1<<i)) continue;
                A[j|(1<<i)] += A[j];
            }
        }
        rep(i,0,1<<N) {
            if (B[i] == 0 && A[i] > 0) {
                cout << "No" << endl;
                return;
            }
        }
    }
    if (A.back() == 0) {
        cout << "Yes" << endl;
        cout << 'F' << endl;
        return;
    }
    if (A.back() == (1<<N)) {
        cout << "Yes" << endl;
        cout << 'T' << endl;
        return;
    }
    vector<int> V;
    rep(i,0,1<<N) if (A[i] == 1) V.push_back(i);
    auto DFS = [&](auto self, int Dep, vector<int>& X) -> string {
        char C = 'a' + (Dep-1);
        if (X.empty()) return "F";
        if (X[0] == 0) return "T";
        vector<int> XL, XR;
        int MID = 1<<(Dep-1);
        for (auto x : X) {
            if (x < MID) XL.push_back(x);
            else XR.push_back(x-MID);
        }
        string SL = self(self, Dep-1, XL);
        string SR = self(self, Dep-1, XR);
        if (SL == "F") {
            if (SR == "F") {
                return "F";
            }
            else if (SR == "T") {
                return string(1,C);
            }
            else {
                return '(' + SR + '&' + C + ')';
            }
        }
        else if (SL == "T") {
            return "T";
        }
        else {
            if (SR == "F") {
                return SL;
            }
            else if (SR == "T") {
                return '(' + SL + '|' + C + ')';
            }
            else {
                return '(' + SL + '|' + '(' + SR + '&' + C + ')' + ')';
            }
        }
    };
    cout << "Yes" << endl;
    string ANS = DFS(DFS,N,V);
    cout << ANS << endl;
    //cout << Counting(ANS) << endl;
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
int _;
cin >> _;
while(_--) {
    Solve();
}
}

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

详细

Test #1:

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

input:

7
2
0001
2
0111
2
1111
3
00010111
1
10
2
0101
5
00000000000000000000000000000001

output:

Yes
(a&b)
Yes
(a|b)
Yes
T
Yes
((a&b)|((a|b)&c))
No
Yes
a
Yes
((((a&b)&c)&d)&e)

result:

ok 7 lines, tightest: 4 out of 14 (7 test cases)

Test #2:

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

input:

4
1
00
1
10
1
01
1
11

output:

Yes
F
No
Yes
a
Yes
T

result:

ok 4 lines, tightest: 0 out of 11 (4 test cases)

Test #3:

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

input:

16
2
0000
2
1000
2
0100
2
1100
2
0010
2
1010
2
0110
2
1110
2
0001
2
1001
2
0101
2
1101
2
0011
2
1011
2
0111
2
1111

output:

Yes
F
No
No
No
No
No
No
No
Yes
(a&b)
No
Yes
a
No
Yes
b
No
Yes
(a|b)
Yes
T

result:

ok 16 lines, tightest: 1 out of 12 (16 test cases)

Test #4:

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

input:

256
3
00000000
3
10000000
3
01000000
3
11000000
3
00100000
3
10100000
3
01100000
3
11100000
3
00010000
3
10010000
3
01010000
3
11010000
3
00110000
3
10110000
3
01110000
3
11110000
3
00001000
3
10001000
3
01001000
3
11001000
3
00101000
3
10101000
3
01101000
3
11101000
3
00011000
3
10011000
3
01011000...

output:

Yes
F
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 256 lines, tightest: 4 out of 14 (256 test cases)

Test #5:

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

input:

65536
4
0000000000000000
4
1000000000000000
4
0100000000000000
4
1100000000000000
4
0010000000000000
4
1010000000000000
4
0110000000000000
4
1110000000000000
4
0001000000000000
4
1001000000000000
4
0101000000000000
4
1101000000000000
4
0011000000000000
4
1011000000000000
4
0111000000000000
4
1111000...

output:

Yes
F
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 65536 lines, tightest: 8 out of 18 (65536 test cases)

Test #6:

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

input:

168
4
0000000000000000
4
0000000000000001
4
0000000000000011
4
0000000000000101
4
0000000000000111
4
0000000000001111
4
0000000000010001
4
0000000000010011
4
0000000000010101
4
0000000000010111
4
0000000000011111
4
0000000000110011
4
0000000000110111
4
0000000000111111
4
0000000001010101
4
000000000...

output:

Yes
F
Yes
(((a&b)&c)&d)
Yes
((b&c)&d)
Yes
((a&c)&d)
Yes
(((a|b)&c)&d)
Yes
(c&d)
Yes
((a&b)&d)
Yes
(((a&b)|(b&c))&d)
Yes
(((a&b)|(a&c))&d)
Yes
(((a&b)|((a|b)&c))&d)
Yes
(((a&b)|c)&d)
Yes
(b&d)
Yes
((b|(a&c))&d)
Yes
((b|c)&d)
Yes
(a&d)
Yes
((a|(b&c))&d)
Yes
((a|c)&d)
Yes
((a|b)&d)
Yes
(((a|b)|c)&d)
Ye...

result:

ok 168 lines, tightest: 8 out of 18 (168 test cases)

Test #7:

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

input:

7581
5
00000000000000000000000000000000
5
00000000000000000000000000000001
5
00000000000000000000000000000011
5
00000000000000000000000000000101
5
00000000000000000000000000000111
5
00000000000000000000000000001111
5
00000000000000000000000000010001
5
00000000000000000000000000010011
5
0000000000000...

output:

Yes
F
Yes
((((a&b)&c)&d)&e)
Yes
(((b&c)&d)&e)
Yes
(((a&c)&d)&e)
Yes
((((a|b)&c)&d)&e)
Yes
((c&d)&e)
Yes
(((a&b)&d)&e)
Yes
((((a&b)|(b&c))&d)&e)
Yes
((((a&b)|(a&c))&d)&e)
Yes
((((a&b)|((a|b)&c))&d)&e)
Yes
((((a&b)|c)&d)&e)
Yes
((b&d)&e)
Yes
(((b|(a&c))&d)&e)
Yes
(((b|c)&d)&e)
Yes
((a&d)&e)
Yes
(((a|(...

result:

ok 7581 lines, tightest: 18 out of 26 (7581 test cases)

Test #8:

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

input:

14
1
01
2
0111
3
00010111
4
0001011101111111
5
00000001000101110001011101111111
6
0000000100010111000101110111111100010111011111110111111111111111
7
00000000000000010000000100010111000000010001011100010111011111110000000100010111000101110111111100010111011111110111111111111111
8
00000000000000010000...

output:

Yes
a
Yes
(a|b)
Yes
((a&b)|((a|b)&c))
Yes
(((a&b)|((a|b)&c))|(((a|b)|c)&d))
Yes
((((a&b)&c)|(((a&b)|((a|b)&c))&d))|((((a&b)|((a|b)&c))|(((a|b)|c)&d))&e))
Yes
(((((a&b)&c)|(((a&b)|((a|b)&c))&d))|((((a&b)|((a|b)&c))|(((a|b)|c)&d))&e))|(((((a&b)|((a|b)&c))|(((a|b)|c)&d))|((((a|b)|c)|d)&e))&f))
Yes
((((...

result:

ok 14 lines, tightest: 68 out of 74 (14 test cases)

Test #9:

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

input:

14
1
01
2
0001
3
00010111
4
0000000100010111
5
00000001000101110001011101111111
6
0000000000000001000000010001011100000001000101110001011101111111
7
00000000000000010000000100010111000000010001011100010111011111110000000100010111000101110111111100010111011111110111111111111111
8
00000000000000000000...

output:

Yes
a
Yes
(a&b)
Yes
((a&b)|((a|b)&c))
Yes
(((a&b)&c)|(((a&b)|((a|b)&c))&d))
Yes
((((a&b)&c)|(((a&b)|((a|b)&c))&d))|((((a&b)|((a|b)&c))|(((a|b)|c)&d))&e))
Yes
(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))|(((((a&b)&c)|(((a&b)|((a|b)&c))&d))|((((a&b)|((a|b)&c))|(((a|b)|c)&d))&e))&f))
Yes
((((...

result:

ok 14 lines, tightest: 68 out of 74 (14 test cases)

Test #10:

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

input:

14
1
00
2
0001
3
00000001
4
0000000100010111
5
00000000000000010000000100010111
6
0000000000000001000000010001011100000001000101110001011101111111
7
00000000000000000000000000000001000000000000000100000001000101110000000000000001000000010001011100000001000101110001011101111111
8
00000000000000000000...

output:

Yes
F
Yes
(a&b)
Yes
((a&b)&c)
Yes
(((a&b)&c)|(((a&b)|((a|b)&c))&d))
Yes
((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))
Yes
(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))|(((((a&b)&c)|(((a&b)|((a|b)&c))&d))|((((a&b)|((a|b)&c))|(((a|b)|c)&d))&e))&f))
Yes
((((((a&b)&c)&d)&e)|(((((a&b)&c)...

result:

ok 14 lines, tightest: 33 out of 42 (14 test cases)

Test #11:

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

input:

14
1
00
2
0000
3
00000001
4
0000000000000001
5
00000000000000010000000100010111
6
0000000000000000000000000000000100000000000000010000000100010111
7
00000000000000000000000000000001000000000000000100000001000101110000000000000001000000010001011100000001000101110001011101111111
8
00000000000000000000...

output:

Yes
F
Yes
F
Yes
((a&b)&c)
Yes
(((a&b)&c)&d)
Yes
((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))
Yes
(((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))&f))
Yes
((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))&f))|((((((a&b)&c)&d)|((((a&b)&c)|(((a...

result:

ok 14 lines, tightest: 0 out of 11 (14 test cases)

Test #12:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)&c)&d)&e)&f)&g)&h)|((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))&f))&g))&h))&i))|(((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&...

result:

ok 1 lines, tightest: 12868 out of 16394 (1 test case)

Test #13:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000100000000000000010000000100010111000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))&f))&g))&h))|((((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))&f))&g))|(((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&...

result:

ok 1 lines, tightest: 11438 out of 16394 (1 test case)

Test #14:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)&c)&d)&e)&f)&g)&h)&i)|(((((((((a&b)&c)&d)&e)&f)&g)&h)|((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))&f))&g))&h))&i))&j))|((((((((((a&b)&c)&d)&e)&f)&g)&h)|((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d...

result:

ok 1 lines, tightest: 11438 out of 16394 (1 test case)

Test #15:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)&c)&d)&e)&f)&g)&h)&i)&j)|((((((((((a&b)&c)&d)&e)&f)&g)&h)&i)|(((((((((a&b)&c)&d)&e)&f)&g)&h)|((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))&f))&g))&h))&i))&j))&k))|(((((((((((a&b)&c)&d)&e)&f)&g)&h)&...

result:

ok 1 lines, tightest: 8006 out of 16394 (1 test case)

Test #16:

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

input:

65536
6
0000001101111111000111111111111101111111111111111111111111111111
6
0000000000000000000100110011011100000000000000000001001100111111
6
0101010101110111011101111111111101110111111111111111111111111111
6
0000001100000011000000110001011100011111001111110011111100111111
6
000000010001011100000001...

output:

Yes
((((b&c)|(((a|b)|c)&d))|((((a&b)|c)|d)&e))|(((((a|b)|c)|d)|e)&f))
Yes
(((((a&b)|(b&c))|((b|(a&c))&d))&e)|(((c&d)&e)&f))
Yes
(((a|(b&d))|((b|d)&e))|(((b|d)|e)&f))
Yes
(((b&c)|((((a&b)|(a&c))&d)&e))|(((((a&b)|c)|(b&d))|(b&e))&f))
Yes
((((a&b)&c)|(((a&b)|((a|b)&c))&d))|((((a&b)|((a|b)&c))|(b&d))&f)...

result:

ok 65536 lines, tightest: 33 out of 42 (65536 test cases)

Test #17:

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

input:

65536
7
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
7
00000001000100010001000101110111000100010111011101110111011111110001000101110111011101110111111100010001011101110111011111111111
7
000000010001001100000001001101...

output:

Yes
((((((a&b)&c)&d)&e)&f)&g)
Yes
((((((a&b)&c)|((a&b)&d))|(((a&b)|((a|b)&d))&e))|((((a&b)|((a|b)&d))|(((a|b)|(c&d))&e))&f))|(((((a&b)|((a|b)&d))|(((a|b)|(c&d))&e))|((d&e)&f))&g))
Yes
((((((a&b)&c)|(((a&b)|(b&c))&d))|(((b|(a&c))&d)&e))|(((((a&b)|(b&c))|(((a|b)|c)&d))|((b|(a&c))&e))&f))|((((b&c)&e)|(...

result:

ok 65536 lines, tightest: 68 out of 74 (65536 test cases)

Test #18:

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

input:

16384
8
0000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000100010000000000010001000100010011011100000000000000000000000000010001000000000001000100010001011101110000000000000001000100010011011100010001000101110011011101111111
8
000101010101011100010101011101110...

output:

Yes
((((((a&b)&d)&e)&f)|(((((a&b)&d)&e)|((((a&b)&d)|(((a&b)|((b|(a&c))&d))&e))&f))&g))|((((((a&b)&d)&e)|((((a&b)&d)|(((a&b)|((a|b)&d))&e))&f))|((((((a&b)&c)&d)|(((a&b)|((b|(a&c))&d))&e))|((((a&b)|(((a|b)&c)&d))|(((b|(a&c))|(c&d))&e))&f))&g))&h))
Yes
(((((((a&b)|(a&c))|((a|(b&c))&d))|((b&d)&e))|((((a...

result:

ok 16384 lines, tightest: 119 out of 138 (16384 test cases)

Test #19:

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

input:

4096
9
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000010001011100000...

output:

Yes
((((((((a&b)&c)&d)&e)&f)|((((((a|b)&c)&d)&e)&f)&g))|(((((((a&b)&c)|((a&b)&d))&e)&f)&g)&h))|((((((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e)|(((((a&b)&c)&d)|((((a|b)|c)|d)&e))&f))|((((((a&b)|((a|b)&c))|(((a|b)|c)&d))&e)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&f))&g))|((((c&d)&e)|((e&f)&g))&h))&i))
Yes
((((((...

result:

ok 4096 lines, tightest: 237 out of 266 (4096 test cases)

Test #20:

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

input:

1024
10
0000000000000000000000000000000100000000000000110000000000000011000000000000000100000000000000110000000000000011000000010000001100000000000000110000000000000011000000000000001100000011000001110000000000000011000000000000001100000011000001110000001100011111000000000000001100000000000000110000...

output:

Yes
(((((((((a&b)&c)&d)&e)|(((b&c)&d)&f))|((((((a&b)&c)&d)|(((b&c)&d)&e))|((((a&b)&c)&e)&f))&g))|(((((b&c)&d)|((((b&c)|((a&c)&d))&e)&f))|(((((b&c)|((a&c)&d))|((((a&b)|c)&d)&e))&f)&g))&h))|((((((b&c)&d)|(((((a&b)&c)|((a&c)&d))|(((b&c)|(c&d))&e))&f))|(((((b&c)|(((a&b)|c)&d))|((b&d)&e))&f)&g))|((((((b&...

result:

ok 1024 lines, tightest: 370 out of 522 (1024 test cases)

Test #21:

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

input:

256
11
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((((((((((a&b)&c)|((b&c)&d))|(((b&c)|((a&b)&d))&e))&f)|((((b&c)|((b&d)&e))&f)&g))&h)&i)|((((((((b&c)|((a&b)&d))|(((b|(a&c))&d)&e))&f)|((((a&b)&e)&f)&g))&h)|((((((b&c)|((b&d)&e))&f)|((((a&b)&d)&f)&g))|(((((b&c)|((b&d)&e))|((((b|c)|d)|(a&e))&f))|((e&f)&g))&h))&i))&j))|(((((((((b&c)|((a&b)&d))|(((b...

result:

ok 256 lines, tightest: 665 out of 1034 (256 test cases)

Test #22:

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

input:

64
12
000101011111111101111111111111110001011111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001010111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001011111111111111111111111111101111111111111111111111111111111011111...

output:

Yes
(((((((((((a&b)|(a&c))|d)|(((a|b)|c)&e))|((b&c)&f))|((b&c)&g))|(((e&f)&g)&h))|((((a|b)|c)|e)&i))|((((b&c)|e)|(((f&g)|(f&h))&i))&j))|((((((((a|b)|c)|e)|f)|(g&h))|i)|j)&k))|((((((((b&c)|e)|(a&f))|(((a|(c&f))&g)&h))|i)|((a|c)&j))|k)&l))
Yes
(((((((((((a&b)&c)&d)&e)&f)|(((((a&b)&c)&e)|(((((a&b)&c)&d...

result:

ok 64 lines, tightest: 1266 out of 2058 (64 test cases)

Test #23:

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

input:

16
13
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000...

output:

Yes
(((((((((((b&c)&d)&e)&f)|(((((b|c)|d)|e)&f)&g))&h)|(((((((b&c)|((a&c)&d))&e)&f)&g)|((((((b&c)|((a&c)&d))|(((b|c)|d)&e))&f)|(((((b&c)&d)|((((a|b)&c)|((b|c)&d))&e))|f)&g))&h))&i))|(((((((((a&b)&c)&d)&e)&f)|(((((b&c)|((b|c)&d))|e)&f)&g))|(((((((a&b)&c)|((b&c)&d))&e)|f)|((((b|c)|d)|e)&g))&h))|((((((...

result:

ok 16 lines, tightest: 1774 out of 4106 (16 test cases)

Test #24:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
(((((((((((b&c)&e)&f)|((((a&b)&e)&f)&g))|(((((a&b)&c)|((b|(a&c))&e))&f)&h))&i)&j)|(((((((b&c)&e)&f)|((((a&b)&e)&f)&h))&i)|(((((b&c)&e)&f)|((((((a&b)|(b&c))|(((a|b)|c)&e))&f)|((((((a&b)&c)&e)|(((b|(a&c))|e)&f))|(((c&d)&f)&g))&h))&i))&j))&k))|((((((((((a&b)&c)&e)&f)|((((b&c)&e)&f)&g))&h)|((((b&c)|...

result:

ok 4 lines, tightest: 2231 out of 8202 (4 test cases)

Test #25:

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

input:

4
14
0000000000000000000000000000000000000000000000000001000100010101000000000000000101010101010101010001010101010101011101110111111100000000000000000000000000000001000000000000000000010101010101010000000100010001010101010101011101010101010101010111111111111111000000000000000000010101010101010000000...

output:

Yes
((((((((((((a&b)|((a&c)&d))&e)&f)|((((((a&b)&c)&d)|(a&e))|(((((a&b)|(a&c))|(a&d))|((b|(c&d))&e))&f))&g))|(((((((a&b)&c)&d)&e)|((((a&c)|(a&d))&e)&f))|((((((a&b)&c)|((a&b)&d))|(((b&c)&d)&e))|((a|((c|d)&e))&f))&g))&h))|((((((((a&b)|(a&c))|(a&d))&e)|(((((a&b)&c)|(((a&b)|(a&c))&d))|((a|((b&c)&d))&e))...

result:

ok 4 lines, tightest: 1539 out of 8202 (4 test cases)

Test #26:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((((((((((((b&c)&d)&e)&f)|(((((b&c)&d)&e)|(((c&d)&e)&f))&g))|(((((b&c)&e)&f)&g)&h))&i)|((((((((a&b)&c)&d)&e)|((((b&c)&e)&f)&g))|(((((b&c)&d)&e)|(((((b&c)|(c&d))&e)|(((b&c)&d)&f))&g))&h))&i)&j))|(((((((b&c)&d)&e)|(((c&d)&e)&g))&i)&j)&k))&l)|((((((((((b&c)&e)&f)&g)|(((((b&c)&d)&e)|((((c&d)&e)|(((b...

result:

ok 4 lines, tightest: 3380 out of 8202 (4 test cases)

Test #27:

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

input:

4
14
0000000000000000000000000001001100000000000000110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110001001100111111001100111111111100110011111111110011001111111111000000000011001100000011001101110000000...

output:

Yes
(((((((((((((a&b)|(b&c))&d)&e)|((((b&c)&d)|((b&d)&e))&f))|((b&d)&g))|(((b&d)|((((((a&b)|(b&c))|(c&d))|((b|d)&e))|((b|d)&f))&g))&h))|((((((b&d)|(((b&c)|((a&c)&d))&e))|((((a&b)&c)|((b|d)&e))&f))|((b|d)&g))|(((b|d)|((((a&c)|e)|f)&g))&h))&i))|(((((((((a&b)&c)&d)|((b&d)&e))|((b&d)&f))|(((((a&b)&c)&e)...

result:

ok 4 lines, tightest: 1911 out of 8202 (4 test cases)

Test #28:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000...

output:

Yes
(((((((((((a&b)&c)&d)&f)&g)|(((((((a&b)&c)&d)&f)|(((((a&b)&c)&d)|(((b&c)&d)&f))&g))|((((a&b)&c)&d)&h))&i))|((((((((a&b)&c)&d)|(((b&c)&d)&f))|(((((a&b)&c)|((b&c)&d))|((((a&b)|(a&c))&d)&f))&g))|(((((a&b)&c)&f)|(((a&b)&d)&g))&h))|((((((((a&b)&c)|((b&c)&d))|(((a&b)&d)&e))|((((a&b)|(a&c))&d)&f))|((((...

result:

ok 4 lines, tightest: 2370 out of 8202 (4 test cases)

Test #29:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)&c)&d)&e)&f)&g)&h)&i)&j)&k)&l)|((((((((((((a&b)&c)&d)&e)&f)&g)&h)&i)&j)|(((((((((a&b)&c)&d)&e)&f)&h)&i)&j)&k))&l)&m))|(((((((((((((a&b)&c)&d)&e)&f)&g)&h)&i)&j)|((((((((((a&b)&c)&d)&e)&f)&g)&h)&i)|((((((((a&b)&c)&d)&e)&f)&h)&i)&j))&k))|((((((((((a&b)&c)&d)&e)&f)&h)&i)|((((((((a&...

result:

ok 1 lines, tightest: 1174 out of 16394 (1 test case)

Test #30:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
(((((((((((c&d)&e)&f)&h)&i)|(((((((c&d)&e)&f)|((((b&c)&d)&e)&g))&h)|((((((((a|b)&c)&d)&e)&f)&g)|(((((c&d)&e)|((((b&c)&d)|((c|d)&e))&f))|(((((b&c)|(b&d))&e)|((c&d)&f))&g))&h))&i))&j))|(((((((((a&b)&c)&d)&e)&g)&h)&i)|((((((((b&c)&d)&e)&f)|((((c&d)&e)&f)&g))|((((a&c)&d)&f)&h))&i)&j))&k))|((((((((((...

result:

ok 1 lines, tightest: 2177 out of 16394 (1 test case)

Test #31:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)&c)&d)&e)&f)&g)&h)|(((((((a&b)&c)&e)&f)|(((((a&b)&c)&e)|(((b&c)&e)&f))&g))&h)&i))|((((((((a&b)&c)&e)&f)|(((((a&b)&c)&e)|(((b&c)&e)&f))&g))&h)|(((((((a&b)&c)&e)&f)&g)|((((((a&b)&c)&e)|(((b&c)&e)&f))|((((b&c)&e)|((((a&b)&c)|(((a&b)|(a&c))&e))&f))&g))&h))&i))&j))|(((((((((a&b)&c)&...

result:

ok 1 lines, tightest: 4807 out of 16394 (1 test case)

Test #32:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000001100000000000000110000001100111111000000000000000000000000000000000000000...

output:

Yes
(((((((((((((b&c)&d)&e)&f)|(((((b&c)&d)&e)|((((b&c)&d)|(((b&c)|((b|c)&d))&e))&f))&g))&h)|(((((((b&c)&d)&e)&f)|(((((b&c)&d)&e)|(((((a&b)&c)&d)|(((b&c)|((b|c)&d))&e))&f))&g))|(((((((a&b)&c)&d)|(((b&c)|(((a&b)|c)&d))&e))|(((((a&b)&c)|(((a|b)&c)&d))|((((a&b)|c)|((a|b)&d))&e))&f))|((((((a&b)&c)|(((a|...

result:

ok 1 lines, tightest: 3651 out of 16394 (1 test case)

Test #33:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)&c)&d)&e)&f)|(((((a&b)&d)&e)&f)&g))&h)&i)|(((((((a&b)&d)&e)&f)&h)&i)&j))&k)|(((((((((((a&b)&c)&d)&e)&f)&g)&h)&i)&j)|((((((((((a&b)&c)&d)&e)&f)&g)&h)|(((((((a&b)&d)&e)&f)|((((((a&b)&c)&d)|(((a&c)&d)&e))&f)&g))&h)&i))|((((((((a&b)&c)&d)&e)&f)&h)|((((((((a&b)&c)&d)|(((a&c)&d)&e))&...

result:

ok 1 lines, tightest: 2531 out of 16394 (1 test case)

Test #34:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100000000000000000000000001010101000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)|(a&c))&d)&e)|(((a&d)&e)&f))&g)&h)|((((((((a&b)|(a&c))&d)&e)&f)&g)|((((a&d)&e)|((((((a&b)&c)&d)|((((a&b)|(a&c))|((b&c)&d))&e))|(((a&d)|((a|d)&e))&f))&g))&h))&i))|(((((((((a&b)&c)&d)&e)&f)&g)|((((((a&b)&d)&e)|(((a&d)&e)&f))|((((((a&b)&c)|(a&d))&e)|(((a&d)|((a|d)&e))&f))&g))&h))|...

result:

ok 1 lines, tightest: 3508 out of 16394 (1 test case)

Test #35:

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

input:

65536
7
00000000000000010000000100000101000000000001011100000101010111110000000100000001000001110001011100000101001101110011011111111111
7
00000000000000010000000000010111000000000000011100000001011111110000000100000001000000110011011100010101001101110011111111111111
7
000000000000000000000001000100...

output:

Yes
((((((a&b)&c)&d)|((((a&b)&c)|((a&c)&d))&e))|(((((a&b)|((a|b)&c))&d)|(((a&c)|((a|c)&d))&e))&f))|(((((a&b)&c)|((((a|b)&c)|((a&b)&d))&e))|((((a&c)|(b&d))|((b|d)&e))&f))&g))
Yes
((((((a&b)&c)&d)|((((a&b)|((a|b)&c))&d)&e))|(((((a|b)&c)&d)|((((a&b)&c)|(((a|b)|c)&d))&e))&f))|(((((a&b)&c)|(((b&c)|(b&d))...

result:

ok 65536 lines, tightest: 60 out of 74 (65536 test cases)

Test #36:

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

input:

1024
10
0000000000000000000000000000000000000000000000000000000000000011000000000000000000000001000001110000000000000111000101010111011100000000000000000000000000000111000000010001011100010011000101110000000100000001000001110001011100000101011111110101111111111111000000000000000100000000000100010000...

output:

Yes
((((((((b&c)&d)&e)&f)|((((((a&b)&c)|(((a|b)&c)&d))&e)|(((((a|b)&c)&d)|((((a&b)|(a&c))|((a|b)&d))&e))&f))&g))|(((((((a|b)&c)&d)&e)|(((((a&b)&c)|(((a&b)|((a|b)&c))&d))|(((a&b)|(b&c))&e))&f))|(((((a&b)&c)|((((a|b)&c)|((a&b)&d))&e))|((((a&c)|(((a|b)|c)&d))|(((a|c)|d)&e))&f))&g))&h))|((((((((a&b)&c)&...

result:

ok 1024 lines, tightest: 322 out of 522 (1024 test cases)

Test #37:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100010101000101110111111100000000000000000000000000000001000000...

output:

Yes
(((((((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e)&f)&g))|(((((((a&b)&c)&d)&e)|(((((a&b)&c)|(((a&b)|(a&c))&d))|((((a&b)|((a|b)&c))|(((a|b)|c)&d))&e))&f))&g)&h))|((((((((a&b)&c)&d)&e)|(((((a&b)&c)|((a&b)&d))&e)&f))|((((((a&b)&c)&d)|((((a&b)&c)|((b&c)&d))&e))|(((((a|b)&c)|(b&d))&e...

result:

ok 64 lines, tightest: 1115 out of 2058 (64 test cases)

Test #38:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

Yes
(((((((((((a&b)&c)&d)&e)&f)&g)|((((((a&b)&c)&d)&e)&f)&h))|(((((((b&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)&e)|((((a&b)&d)&e)&f))|((((((a&b)&c)|((b&c)&d))&e)|((((a&c)&d)|((((a&b)|(b&c))|(c&d))&e))&f))&g))&h))&i))|(((((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)&d)&e)|(((((a&b)|((a|b)&c))&d)&e)&f))&g))|(((((((a&b...

result:

ok 64 lines, tightest: 1121 out of 2058 (64 test cases)

Test #39:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

Yes
(((((((((((a&b)&c)&d)&e)&f)&g)&h)|((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)|(((a&b)|(b&c))&d))&e)&f)&g))&h))&i))|(((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)|((((a&b)&c)|((b&c)&d))&e))&f)&g)&h))|((((((((a&b)&c)&d)&e)|((((a&b)&c)&d)&f))&g)|(((((((a&b)&c)&d)&e)|(((((a&b)&...

result:

ok 64 lines, tightest: 833 out of 2058 (64 test cases)

Test #40:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000010111000000000000000000000000000000000000000...

output:

Yes
(((((((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)|((((a&b)|((a|b)&c))&d)&e))&f)&g)&h))|((((((((a&b)&c)&d)&e)|((((a&b)&d)&e)&f))&g)|(((((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|(b&c))&d))&e))&f)|((((((a&b)&c)&d)|((((a|b)&c)&d)&e))|(((((a&b)&c)|((b&c)&d))|((((a|b)&c)|(c&d))&e))&f))&g))&h))&i))|(((((((((...

result:

ok 4 lines, tightest: 3964 out of 8202 (4 test cases)

Test #41:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

Yes
(((((((((((((a&b)&c)&d)&e)&f)&g)&h)|((((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)|(a&c))&d)&e))&f))&g)&h)&i))|(((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|((a|b)&c))&d))&e))&f)&g)&h))|((((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|((b&c)&d))&e))&f))&g)|(((((((a&b)&c)&d)...

result:

ok 4 lines, tightest: 3872 out of 8202 (4 test cases)

Test #42:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000001000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)&c)&d)|(((a&b)&c)&e))&f)&g)&h)|((((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|((a&c)&d))&e))&f))&g)|(((((((a&b)&c)&d)|(((a&b)&c)&e))&f)|((((((a&b)&c)&d)|((((a&b)|((a|b)&c))&d)&e))|((((b&c)&d)|((((a&b)|(a&c))|(a&d))&e))&f))&g))&h))&i))|(((((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|(...

result:

ok 1 lines, tightest: 6937 out of 16394 (1 test case)

Test #43:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)&c)&d)&e)|(((((a&b)&c)|(((a&b)|(b&c))&d))&e)&f))&g)&h)&i)|(((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)&e)&f)|((((((a&b)|((a|b)&c))&d)&e)&f)&g))&h))|((((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)&c)|(((a&b)|(b&c))&d))&e))&f))&g))|(((((((a&b)&c)&d)|((((a&...

result:

ok 1 lines, tightest: 7871 out of 16394 (1 test case)

Test #44:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((((((((((((((a&b)&c)&d)&e)&f)&g)&h)|((((((((a&b)&c)&d)&e)&f)|((((((a&b)&c)|((a&c)&d))&e)&f)&g))&h)&i))&j)|(((((((((b&c)&d)&e)&f)&g)&h)&i)|(((((((((a&b)&c)&d)&e)&f)&g)|(((((((a&b)&c)&d)&e)|(((((a&b)&c)&d)|((((a&b)|(a&c))&d)&e))&f))&g)&h))|((((((((a&b)&c)&d)&e)|(((((a&b)|(b&c))&d)&e)&f))&g)|(((((...

result:

ok 1 lines, tightest: 6854 out of 16394 (1 test case)

Extra Test:

score: 0
Extra Test Passed