QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#861526#9980. Boolean Function Reconstructionucup-team5243#AC ✓639ms4096kbC++1713.0kb2025-01-18 17:54:262025-01-18 17:54:29

Judging History

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

  • [2025-01-18 17:54:29]
  • 评测
  • 测评结果:AC
  • 用时:639ms
  • 内存:4096kb
  • [2025-01-18 17:54:26]
  • 提交

answer

//line 1 "answer.cpp"
#if !__INCLUDE_LEVEL__
#include __FILE__
int solve() {
    ll n; input(n);
    string s; input(s);
    rep(bit, (1 << n)) {
        if (s[bit] == '1') continue;
        ll b = bit;
        while (b > 0) {
            b = (b-1) & bit;
            if (s[b] == '1') {
                debug(s);
                return print("No");
            }
        }
    }
    string alphabet = "";
    rep(i, n) { alphabet += char('a' + n - 1 - i); }
    debug(alphabet);
    auto f = [&] (auto self, string a, ll d, string ord) -> string {
        if (d == 1) {
            if (a[0] == '0' && a[1] == '0') return "F";
            if (a[0] == '0' && a[1] == '1') return ord.substr(0, 1);
            if (a[0] == '1' && a[1] == '1') return "T";
            assert(false);
        }
        vector<ll> cnt1(d);
        rep(i,1<<d) if(a[i] == '1') rep(x,d) if(i&(1<<x)) cnt1[x]++;
        int c = max_element(cnt1.begin(), cnt1.end()) - cnt1.begin();
        string aa = a;
        int bc = (1 << c);
        int oc = (1 << (d-1));
        rep(i,1<<d){
            int j = i;
            if(i&bc) j -= bc;
            if(i&oc) j -= oc;
            if(i&bc) j += oc;
            if(i&oc) j += bc;
            aa[j] = a[i];
        }
        swap(ord[d-1], ord[c]);
        //cout << aa << endl;
        string res;
        string nxord = ord.substr(0,d-1);
        string ch = ord.substr(d-1);
        //cout << nxord << endl;
        //cout << ch << endl;
        string lhs = self(self, aa.substr(0, oc), d-1, nxord);
        string rhs = self(self, aa.substr(oc), d-1, nxord);
        //cout << "lhs = " << lhs << endl;
        //cout << "rhs = " << rhs << endl;
        if(lhs == "F"){
            if(rhs == "F") return "F";
            if(rhs == "T") return ch;
            return "(" + rhs + "&" + ch + ")";
        } else if(lhs == "T") {
            if(rhs == "T") return "T";
            return "((" + ch + "&" + rhs + ")|" + lhs + ")";
        } else {
            if(rhs == "T") return "(" + lhs + "|" + ch + ")";
            return "((" + ch + "&" + rhs + ")|" + lhs + ")";
        }
    };
    string x; rep(i,n) x.push_back('a' + i);
    string ans = f(f, s, n, x);
    print("Yes");
    print(ans);
    return 0;
};
int main() {
    ll t; input(t);
    rep(t) solve();
}
#else
//line 2 "/home/seekworser/.cpp_lib/competitive_library/competitive/std/std.hpp"
#include <bits/stdc++.h>
#ifndef LOCAL_TEST
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif // LOCAL_TEST
using namespace std;
// 型名の短縮
using ll = long long;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using vi = vector<int>;  using vvi = vector<vi>; using vvvi = vector<vvi>;
using vl = vector<ll>;  using vvl = vector<vl>; using vvvl = vector<vvl>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vc = vector<char>; using vvc = vector<vc>; using vvvc = vector<vvc>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using vs = vector<string>; using vvs = vector<vector<string>>; using vvvs = vector<vector<vector<string>>>;
template<typename T> vector<vector<T>> vv(int h, int w, T val = T()) { return vector(h, vector<T>(w, val)); }
template<typename T> vector<vector<vector<T>>> vvv(int h1, int h2, int h3, T val = T()) { return vector(h1, vector(h2, vector<T>(h3, val))); }
template<typename T> vector<vector<vector<vector<T>>>> vvvv(int h1, int h2, int h3, int h4, T val = T()) { return vector(h1, vector(h2, vector(h3, vector<T>(h4, val)))); }
template <class T> using priority_queue_min = priority_queue<T, vector<T>, greater<T>>;
// 定数の定義
constexpr double PI = 3.14159265358979323;
constexpr int INF = 100100111; constexpr ll INFL = 3300300300300300491LL;
float EPS = 1e-8; double EPSL = 1e-16;
template<typename T> bool eq(const T x, const T y) { return x == y; }
template<> bool eq<double>(const double x, const double y) { return abs(x - y) < EPSL; }
template<> bool eq<float>(const float x, const float y) { return abs(x - y) < EPS; }
template<typename T> bool neq(const T x, const T y) { return !(eq<T>(x, y)); }
template<typename T> bool ge(const T x, const T y) { return (eq<T>(x, y) || (x > y)); }
template<typename T> bool le(const T x, const T y) { return (eq<T>(x, y) || (x < y)); }
template<typename T> bool gt(const T x, const T y) { return !(le<T>(x, y)); }
template<typename T> bool lt(const T x, const T y) { return !(ge<T>(x, y)); }
constexpr int MODINT998244353 = 998244353;
constexpr int MODINT1000000007 = 1000000007;
// 入出力高速化
struct Nyan { Nyan() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(18); } } nyan;
// 汎用マクロの定義
#define all(a) (a).begin(), (a).end()
#define sz(x) ((ll)(x).size())
#define rep1(n) for(ll dummy_iter = 0LL; dummy_iter < n; ++dummy_iter) // 0 から n-1 まで昇順
#define rep2(i, n) for(ll i = 0LL, i##_counter = 0LL; i##_counter < ll(n); ++(i##_counter), (i) = i##_counter) // 0 から n-1 まで昇順
#define rep3(i, s, t) for(ll i = ll(s), i##_counter = ll(s); i##_counter < ll(t); ++(i##_counter), (i) = (i##_counter)) // s から t まで昇順
#define rep4(i, s, t, step) for(ll i##_counter = step > 0 ? ll(s) : -ll(s), i##_end = step > 0 ? ll(t) : -ll(t), i##_step = abs(step), i = ll(s); i##_counter < i##_end; i##_counter += i##_step, i = step > 0 ? i##_counter : -i##_counter) // s から t まで stepずつ
#define overload4(a, b, c, d, e, ...) e
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define repe(a, v) for(auto& a : (v)) // v の全要素(変更可能)
#define smod(n, m) ((((n) % (m)) + (m)) % (m)) // 非負mod
#define sdiv(n, m) (((n) - smod(n, m)) / (m)) // 非負div
#define uniq(a) {sort(all(a)); (a).erase(unique(all(a)), (a).end());} // 重複除去
int Yes(bool b=true) { cout << (b ? "Yes\n" : "No\n"); return 0; };
int YES(bool b=true) { cout << (b ? "YES\n" : "NO\n"); return 0; };
int No(bool b=true) {return Yes(!b);};
int NO(bool b=true) {return YES(!b);};
template<typename T, size_t N> T max(array<T, N>& a) { return *max_element(all(a)); };
template<typename T, size_t N> T min(array<T, N>& a) { return *min_element(all(a)); };
template<typename T> T max(vector<T>& a) { return *max_element(all(a)); };
template<typename T> T min(vector<T>& a) { return *min_element(all(a)); };
template<typename T> vector<T> accum(const vector<T>& a) { vector<T> rev(sz(a)+1, 0); rep(i, sz(a)) rev[i+1] = rev[i] + a[i]; return rev; };
template<typename T> vector<T> vec_slice(const vector<T>& a, int l, int r) { vector<T> rev; rep(i, l, r) rev.push_back(a[i]); return rev; };
template<typename T> T sum(vector<T>& a, T zero = T(0)) { T rev = zero; rep(i, sz(a)) rev += a[i]; return rev; };
template<typename T> bool in_range(const T& val, const T& s, const T& t) { return s <= val && val < t; };

template <class T> inline vector<T>& operator--(vector<T>& v) { repe(x, v) --x; return v; }
template <class T> inline vector<T>& operator++(vector<T>& v) { repe(x, v) ++x; return v; }

// modでのpow
ll powm(ll a, ll n, ll mod=INFL) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * a) % mod;
        if (n > 1) a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}
// 整数Sqrt
ll sqrtll(ll x) {
    assert(x >= 0);
    ll rev = sqrt(x);
    while(rev * rev > x) --rev;
    while((rev+1) * (rev+1)<=x) ++rev;
    return rev;
}
template <class T> inline bool chmax(T& M, const T& x) { if (M < x) { M = x; return true; } return false; } // 最大値を更新(更新されたら true を返す)
template <class T> inline bool chmin(T& m, const T& x) { if (m > x) { m = x; return true; } return false; } // 最小値を更新(更新されたら true を返す)
int digit(ll x, int d=10) { int rev=0; while (x > 0) { rev++; x /= d;}; return rev; } // xのd進数桁数
/**
 * @brief std.hpp
 * @docs docs/std/std.md
 */
//line 3 "/home/seekworser/.cpp_lib/competitive_library/competitive/std/io.hpp"
// 演算子オーバーロード(プロトタイプ宣言)
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p);
template <class T> inline istream& operator>>(istream& is, vector<T>& v);
template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p);
template <class T> inline ostream& operator<<(ostream& os, const vector<T>& v);
template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp);
template <typename T> ostream &operator<<(ostream &os, const set<T> &st);
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st);
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &st);
template <typename T> ostream &operator<<(ostream &os, queue<T> q);
template <typename T> ostream &operator<<(ostream &os, deque<T> q);
template <typename T> ostream &operator<<(ostream &os, stack<T> st);
template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq);

// 演算子オーバーロード
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template <class T> inline istream& operator>>(istream& is, vector<T>& v) { repe(x, v) is >> x; return is; }
template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.first << " " << p.second; return os; }
template <class T> inline ostream& operator<<(ostream& os, const vector<T>& v) { rep(i, sz(v)) { os << v.at(i); if (i != sz(v) - 1) os << " "; } return os; }
template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp) { for (auto &[key, val] : mp) { os << key << ":" << val << " "; } return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; }
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; }
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &st) { ll cnt = 0; for (auto &e : st) { os << e << (++cnt != (int)st.size() ? " " : ""); } return os; }
template <typename T> ostream &operator<<(ostream &os, queue<T> q) { while (q.size()) { os << q.front() << " "; q.pop(); } return os; }
template <typename T> ostream &operator<<(ostream &os, deque<T> q) { while (q.size()) { os << q.front() << " "; q.pop_front(); } return os; }
template <typename T> ostream &operator<<(ostream &os, stack<T> st) { while (st.size()) { os << st.top() << " "; st.pop(); } return os; }
template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq) { while (pq.size()) { os << pq.top() << " "; pq.pop(); } return os; }

template <typename T> int print_sep_end(string sep, string end, const T& val) { (void)sep; cout << val << end; return 0; };
template <typename T1, typename... T2> int print_sep_end(string sep, string end, const T1 &val, const T2 &...remain) {
    cout << val << sep;
    print_sep_end(sep, end, remain...);
    return 0;
};
template <typename... T> int print(const T &...args) { print_sep_end(" ", "\n", args...); return 0; };
template <typename... T> void flush() { cout << flush; };
template <typename... T> int print_and_flush(const T &...args) { print(args...); flush(); return 0; };
#define debug(...) debug_func(0, #__VA_ARGS__, __VA_ARGS__) // debug print
template <typename T> void input(T &a) { cin >> a; };
template <typename T1, typename... T2> void input(T1&a, T2 &...b) { cin >> a; input(b...); };
#ifdef LOCAL_TEST
template <typename T> void debug_func(int i, const T name) { (void)i; (void)name; cerr << endl; }
template <typename T1, typename T2, typename... T3> void debug_func(int i, const T1 &name, const T2 &a, const T3 &...b) {
    int scope = 0;
    for ( ; (scope != 0 || name[i] != ',') && name[i] != '\0'; i++ ) {
        cerr << name[i];
        if (name[i] == '(' || name[i] == '{') scope++;
        if (name[i] == ')' || name[i] == '}') scope--;
    }
    cerr << ":" << a << " ";
    debug_func(i + 1, name, b...);
}
template <typename T1, typename T2, typename... T3> void debug_func(int i, const T1 &name, T2 &a, T3 &...b) {
    int scope = 0;
    for ( ; (scope != 0 || name[i] != ',') && name[i] != '\0'; i++ ) {
        cerr << name[i];
        if (name[i] == '(' || name[i] == '{') scope++;
        if (name[i] == ')' || name[i] == '}') scope--;
    }
    cerr << ":" << a << " ";
    debug_func(i + 1, name, b...);
}
#endif
#ifndef LOCAL_TEST
template <typename... T>
void debug_func(T &...) {}
template <typename... T>
void debug_func(const T &...) {}
#endif
/**
 * @brief io.hpp
 * @docs docs/std/io.md
 */
//line 43 "answer.cpp"
#endif

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

详细

Test #1:

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

input:

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

output:

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

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
(b&a)
No
Yes
a
No
Yes
b
No
Yes
(b|a)
Yes
T

result:

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

Test #4:

score: 0
Accepted
time: 1ms
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: 9ms
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: 0ms
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
(((b&c)&d)&a)
Yes
((c&d)&b)
Yes
((c&d)&a)
Yes
(((b|a)&d)&c)
Yes
(d&c)
Yes
((b&d)&a)
Yes
(((c|a)&d)&b)
Yes
(((b|c)&d)&a)
Yes
(((a&(b|c))|(b&c))&d)
Yes
(((b&a)|c)&d)
Yes
(d&b)
Yes
(((c&a)|b)&d)
Yes
((c|b)&d)
Yes
(d&a)
Yes
(((b&c)|a)&d)
Yes
((c|a)&d)
Yes
((b|a)&d)
Yes
(((b|c)|a)&d)
Yes
d
Yes
...

result:

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

Test #7:

score: 0
Accepted
time: 16ms
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
((((b&c)&d)&e)&a)
Yes
(((c&d)&e)&b)
Yes
(((c&d)&e)&a)
Yes
((((b|a)&d)&e)&c)
Yes
((d&e)&c)
Yes
(((b&d)&e)&a)
Yes
((((c|a)&d)&e)&b)
Yes
((((b|c)&d)&e)&a)
Yes
((((a&(b|c))|(b&c))&e)&d)
Yes
((((b&a)|c)&e)&d)
Yes
((d&e)&b)
Yes
((((c&a)|b)&e)&d)
Yes
(((c|b)&e)&d)
Yes
((d&e)&a)
Yes
((((b&c)|a)&e)...

result:

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

Test #8:

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

input:

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

output:

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

result:

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

Test #9:

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

input:

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

output:

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

result:

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

Test #10:

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

input:

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

output:

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

result:

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

Test #11:

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

input:

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

output:

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

result:

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

Test #12:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #13:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000100000000000000010000000100010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #14:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #15:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #16:

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

input:

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

output:

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

result:

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

Test #17:

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

input:

65536
7
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
7
00000001000100010001000101110111000100010111011101110111011111110001000101110111011101110111111100010001011101110111011111111111
7
000000010001001100000001001101...

output:

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

result:

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

Test #18:

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

input:

16384
8
0000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000100010000000000010001000100010011011100000000000000000000000000010001000000000001000100010001011101110000000000000001000100010011011100010001000101110011011101111111
8
000101010101011100010101011101110...

output:

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

result:

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

Test #19:

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

input:

4096
9
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000010001011100000...

output:

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

result:

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

Test #20:

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

input:

1024
10
0000000000000000000000000000000100000000000000110000000000000011000000000000000100000000000000110000000000000011000000010000001100000000000000110000000000000011000000000000001100000011000001110000000000000011000000000000001100000011000001110000001100011111000000000000001100000000000000110000...

output:

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

result:

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

Test #21:

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

input:

256
11
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #22:

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

input:

64
12
000101011111111101111111111111110001011111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001010111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001011111111111111111111111111101111111111111111111111111111111011111...

output:

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

result:

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

Test #23:

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

input:

16
13
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000...

output:

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

result:

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

Test #24:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #25:

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

input:

4
14
0000000000000000000000000000000000000000000000000001000100010101000000000000000101010101010101010001010101010101011101110111111100000000000000000000000000000001000000000000000000010101010101010000000100010001010101010101011101010101010101010111111111111111000000000000000000010101010101010000000...

output:

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

result:

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

Test #26:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #27:

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

input:

4
14
0000000000000000000000000001001100000000000000110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110001001100111111001100111111111100110011111111110011001111111111000000000011001100000011001101110000000...

output:

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

result:

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

Test #28:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #29:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #30:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #31:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #32:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000001100000000000000110000001100111111000000000000000000000000000000000000000...

output:

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

result:

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

Test #33:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #34:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100000000000000000000000001010101000000000000000000000000000000000000000...

output:

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

result:

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

Test #35:

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

input:

65536
7
00000000000000010000000100000101000000000001011100000101010111110000000100000001000001110001011100000101001101110011011111111111
7
00000000000000010000000000010111000000000000011100000001011111110000000100000001000000110011011100010101001101110011111111111111
7
000000000000000000000001000100...

output:

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

result:

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

Test #36:

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

input:

1024
10
0000000000000000000000000000000000000000000000000000000000000011000000000000000000000001000001110000000000000111000101010111011100000000000000000000000000000111000000010001011100010011000101110000000100000001000001110001011100000101011111110101111111111111000000000000000100000000000100010000...

output:

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

result:

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

Test #37:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100010101000101110111111100000000000000000000000000000001000000...

output:

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

result:

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

Test #38:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #39:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #40:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #41:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #42:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #43:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #44:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Extra Test:

score: 0
Extra Test Passed