QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#881663#9980. Boolean Function ReconstructionKafuuChinocppAC ✓1699ms4736kbC++145.0kb2025-02-04 17:08:582025-02-04 17:09:05

Judging History

This is the latest submission verdict.

  • [2025-02-04 17:09:05]
  • Judged
  • Verdict: AC
  • Time: 1699ms
  • Memory: 4736kb
  • [2025-02-04 17:08:58]
  • Submitted

answer

#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <unordered_map>
#pragma GCC optimize(3)

using namespace std;

const int max1 = 15, max2 = 1 << 15;
const int max3 = 32;
const long long max4 = 1LL << 32;
const int inf = 0x3f3f3f3f;

int T, n, len;
char s[max2 + 5], ans[max2 + 5];
bool vis[max2 + 5];

struct Data
{
    char c;
    long long son[2];
    int len;
};

unordered_map <long long, Data> d;
long long seq[max2 + 5];
int cnt;

struct Node
{
    long long now;
    int d;

    Node () {}
    Node ( long long __now, int __d )
        { now = __now, d = __d; }
    
    bool operator < ( const Node &A ) const
    {
        return d > A.d;
    }
};

priority_queue <Node> que;

void Print ( long long now )
{
    // printf("hahahah\n");

    if ( !d[now].len )
        { ans[++len] = d[now].c; return; }
    
    ans[++len] = '(';
    Print(d[now].son[0]);
    ans[++len] = d[now].c;
    Print(d[now].son[1]);
    ans[++len] = ')';
    return;
}

bool Dfs ( int now, int L, int R )
{
    int cnt0 = 0, cnt1 = 0;
    for ( int i = L; i <= R; i ++ )
    {
        cnt0 += s[i] == '0';
        cnt1 += s[i] == '1';
    }

    if ( cnt0 == R - L + 1 )
    {
        ans[++len] = 'F';
        return true;
    }
    if ( cnt1 == R - L + 1 )
    {
        ans[++len] = 'T';
        for ( int i = L; i <= R; i ++ )
            vis[i] = true;
        return true;
    }

    if ( now == 5 )
    {
        long long now = 0;
        for ( int i = R; i >= L; i -- )
            now = (now << 1) | (s[i] - '0');
        
        if ( d.find(now) == d.end() )
            return false;
        Print(now);
        return true;
    }

    if ( now == 1 )
    {
        if ( s[L] == '1' && s[R] == '0' )
            return false;
        
        ans[++len] = 'a' + now - 1;
        vis[R] = true;
        return true;
    }

    int mid = (L + R) >> 1, midlen = mid - L + 1;
    for ( int i = 0; i < midlen; i ++ )
        if ( s[L + i] == '1' && s[mid + 1 + i] == '0' )
            return false;
    
    ans[++len] = '(';
    if ( !Dfs(now - 1, L, mid) )
        return false;

    bool flag = ans[len] == 'F';
    if ( ans[len] == 'F' )
        len -= 2;
    else
        ans[++len] = '|';

    for ( int i = 0; i < midlen; i ++ )
    {
        if ( s[L + i] == '1' && s[mid + 1 + i] == '1' )
        {
            if ( vis[L + i] )
                vis[L + i] = vis[mid + 1 + i] = true;
        }
    }

    ans[++len] = '(';
    ans[++len] = 'a' + now - 1;
    ans[++len] = '&';
    if ( !Dfs(now - 1, mid + 1, R) )
        return false;
    
    if ( ans[len] == 'T' )
    {
        len -= 4;
        ans[++len] = 'a' + now - 1;
    }
    else
        ans[++len] = ')';
    if ( !flag )
        ans[++len] = ')';
    return true;
}

void Work ()
{
    scanf("%d%s", &n, s);
    memset(vis, 0, sizeof(bool) * (1 << n));
    len = 0;
    if ( Dfs(n, 0, (1 << n) - 1) )
    {
        printf("Yes\n");
        for ( int i = 1; i <= len; i ++ )
            putchar(ans[i]);
        putchar('\n');
        return;
    }
    else
    {
        printf("No\n");
    }
    return;
}

int main () 
{   
    d[0].c = 'T';
    d[0].len = 0;
    d[0].son[0] = d[0].son[1] = 0;
    que.push(Node(0, 0));
    d[max4 - 1].c = 'F';
    d[max4 - 1].len = 0;
    d[max4 - 1].son[0] = d[max4 - 1].son[1] = 0;
    que.push(Node(max4 - 1, 0));

    for ( int i = 1; i <= 5; i ++ )
    {
        long long p = 0;
        for ( int s = 0; s < max3; s ++ )
            if ( (s >> (i - 1)) & 1 )
                p |= 1LL << s;
        
        d[p].c = 'a' + i - 1;
        d[p].len = 0;
        d[p].son[0] = d[p].son[1] = 0;
        // printf("i = %d p = %d\n", i, p);
        que.push(Node(p, 0));
    }

    while ( !que.empty() )
    {
        long long now = que.top().now;
        int dis = que.top().d;
        que.pop();
        if ( dis > d[now].len )
            continue;
        
        // printf("now = %lld\n", now);
        
        for ( int i = 1; i <= cnt; i ++ )
        {
            long long v = seq[i] & now;

            if ( d.find(v) == d.end() || d[v].len > d[now].len + d[seq[i]].len + 1 )
            {
                d[v].c = '&';
                d[v].len = d[now].len + d[seq[i]].len + 1;
                d[v].son[0] = now;
                d[v].son[1] = seq[i];
                que.push(Node(v, d[v].len));
            }

            v = seq[i] | now;
            
            if ( d.find(v) == d.end() || d[v].len > d[now].len + d[seq[i]].len + 1 )
            {
                d[v].c = '|';
                d[v].len = d[now].len + d[seq[i]].len + 1;
                d[v].son[0] = now;
                d[v].son[1] = seq[i];
                que.push(Node(v, d[v].len));
            }
        }

        seq[++cnt] = now;
    }


    scanf("%d", &T);
    while ( T -- )
        Work();

    return 0;
}

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

詳細信息

Test #1:

score: 100
Accepted
time: 1579ms
memory: 4608kb

input:

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

output:

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

result:

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

Test #2:

score: 0
Accepted
time: 1492ms
memory: 4608kb

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: 1494ms
memory: 4480kb

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

result:

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

Test #4:

score: 0
Accepted
time: 1508ms
memory: 4608kb

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: 6 out of 14 (256 test cases)

Test #5:

score: 0
Accepted
time: 1499ms
memory: 4480kb

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: 14 out of 18 (65536 test cases)

Test #6:

score: 0
Accepted
time: 1493ms
memory: 4608kb

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
(d&(c&(b&a)))
Yes
(d&(c&b))
Yes
(d&(c&(a|(b&a))))
Yes
(d&(c&(a|b)))
Yes
(d&c)
Yes
(d&((b&a)|(c&(b&a))))
Yes
(d&((b&a)|(c&b)))
Yes
(d&((b&a)|(c&(a|(b&a)))))
Yes
(d&((b&a)|(c&(a|b))))
Yes
(d&((b&a)|c))
Yes
(d&(b|(c&b)))
Yes
(d&(b|(c&(a|b))))
Yes
(d&(b|c))
Yes
(d&((a|(b&a))|(c&(a|(b&a)))))
Ye...

result:

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

Test #7:

score: 0
Accepted
time: 1501ms
memory: 4608kb

input:

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

output:

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

result:

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

Test #8:

score: 0
Accepted
time: 1500ms
memory: 4608kb

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
((b&a)|(c&(a|b)))
Yes
(((b&a)|(c&(a|b)))|(d&((a|b)|c)))
Yes
(((((b|a)&d)&(c|e))|((b&a)|(c&e)))&(((c|e)&(b|a))|d))
Yes
((((((b|a)&d)&(c|e))|((b&a)|(c&e)))&(((c|e)&(b|a))|d))|(f&((((c|e)&(b|a))|((b|c)&d))|(((b|c)|d)&(e|a)))))
Yes
(((((((d&a)|e)&c)&((d|a)&b))|(((e&a)&d)&(b|c)))|(f&(...

result:

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

Test #9:

score: 0
Accepted
time: 1502ms
memory: 4608kb

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
((b&a)|(c&(a|b)))
Yes
((c&(b&a))|(d&((b&a)|(c&(a|b)))))
Yes
(((((b|a)&d)&(c|e))|((b&a)|(c&e)))&(((c|e)&(b|a))|d))
Yes
((((((d&a)|e)&c)&((d|a)&b))|(((e&a)&d)&(b|c)))|(f&(((((b|a)&d)&(c|e))|((b&a)|(c&e)))&(((c|e)&(b|a))|d))))
Yes
(((((((d&a)|e)&c)&((d|a)&b))|(((e&a)&d)&(b|c)))|(f&(...

result:

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

Test #10:

score: 0
Accepted
time: 1493ms
memory: 4480kb

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
(c&(b&a))
Yes
((c&(b&a))|(d&((b&a)|(c&(a|b)))))
Yes
(((((d&a)|e)&c)&((d|a)&b))|(((e&a)&d)&(b|c)))
Yes
((((((d&a)|e)&c)&((d|a)&b))|(((e&a)&d)&(b|c)))|(f&(((((b|a)&d)&(c|e))|((b&a)|(c&e)))&(((c|e)&(b|a))|d))))
Yes
(((((c&e)&a)&(b&d))|(f&(((((d&a)|e)&c)&((d|a)&b))|(((e&a)&d)&(b|c)))...

result:

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

Test #11:

score: 0
Accepted
time: 1491ms
memory: 4608kb

input:

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

output:

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

result:

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

Test #12:

score: 0
Accepted
time: 1495ms
memory: 4480kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #13:

score: 0
Accepted
time: 1492ms
memory: 4608kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000100000000000000010000000100010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #14:

score: 0
Accepted
time: 1494ms
memory: 4480kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #15:

score: 0
Accepted
time: 1494ms
memory: 4736kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #16:

score: 0
Accepted
time: 1580ms
memory: 4480kb

input:

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

output:

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

result:

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

Test #17:

score: 0
Accepted
time: 1652ms
memory: 4480kb

input:

65536
7
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
7
00000001000100010001000101110111000100010111011101110111011111110001000101110111011101110111111100010001011101110111011111111111
7
000000010001001100000001001101...

output:

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

result:

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

Test #18:

score: 0
Accepted
time: 1595ms
memory: 4608kb

input:

16384
8
0000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000100010000000000010001000100010011011100000000000000000000000000010001000000000001000100010001011101110000000000000001000100010011011100010001000101110011011101111111
8
000101010101011100010101011101110...

output:

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

result:

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

Test #19:

score: 0
Accepted
time: 1533ms
memory: 4608kb

input:

4096
9
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000010001011100000...

output:

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

result:

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

Test #20:

score: 0
Accepted
time: 1524ms
memory: 4608kb

input:

1024
10
0000000000000000000000000000000100000000000000110000000000000011000000000000000100000000000000110000000000000011000000010000001100000000000000110000000000000011000000000000001100000011000001110000000000000011000000000000001100000011000001110000001100011111000000000000001100000000000000110000...

output:

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

result:

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

Test #21:

score: 0
Accepted
time: 1501ms
memory: 4608kb

input:

256
11
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #22:

score: 0
Accepted
time: 1495ms
memory: 4480kb

input:

64
12
000101011111111101111111111111110001011111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001010111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001011111111111111111111111111101111111111111111111111111111111011111...

output:

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

result:

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

Test #23:

score: 0
Accepted
time: 1499ms
memory: 4480kb

input:

16
13
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000...

output:

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

result:

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

Test #24:

score: 0
Accepted
time: 1493ms
memory: 4352kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #25:

score: 0
Accepted
time: 1492ms
memory: 4480kb

input:

4
14
0000000000000000000000000000000000000000000000000001000100010101000000000000000101010101010101010001010101010101011101110111111100000000000000000000000000000001000000000000000000010101010101010000000100010001010101010101011101010101010101010111111111111111000000000000000000010101010101010000000...

output:

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

result:

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

Test #26:

score: 0
Accepted
time: 1504ms
memory: 4608kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #27:

score: 0
Accepted
time: 1504ms
memory: 4608kb

input:

4
14
0000000000000000000000000001001100000000000000110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110001001100111111001100111111111100110011111111110011001111111111000000000011001100000011001101110000000...

output:

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

result:

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

Test #28:

score: 0
Accepted
time: 1494ms
memory: 4608kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #29:

score: 0
Accepted
time: 1495ms
memory: 4608kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #30:

score: 0
Accepted
time: 1490ms
memory: 4736kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #31:

score: 0
Accepted
time: 1494ms
memory: 4736kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #32:

score: 0
Accepted
time: 1543ms
memory: 4608kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000001100000000000000110000001100111111000000000000000000000000000000000000000...

output:

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

result:

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

Test #33:

score: 0
Accepted
time: 1517ms
memory: 4608kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #34:

score: 0
Accepted
time: 1497ms
memory: 4480kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100000000000000000000000001010101000000000000000000000000000000000000000...

output:

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

result:

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

Test #35:

score: 0
Accepted
time: 1699ms
memory: 4608kb

input:

65536
7
00000000000000010000000100000101000000000001011100000101010111110000000100000001000001110001011100000101001101110011011111111111
7
00000000000000010000000000010111000000000000011100000001011111110000000100000001000000110011011100010101001101110011111111111111
7
000000000000000000000001000100...

output:

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

result:

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

Test #36:

score: 0
Accepted
time: 1517ms
memory: 4480kb

input:

1024
10
0000000000000000000000000000000000000000000000000000000000000011000000000000000000000001000001110000000000000111000101010111011100000000000000000000000000000111000000010001011100010011000101110000000100000001000001110001011100000101011111110101111111111111000000000000000100000000000100010000...

output:

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

result:

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

Test #37:

score: 0
Accepted
time: 1511ms
memory: 4480kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100010101000101110111111100000000000000000000000000000001000000...

output:

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

result:

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

Test #38:

score: 0
Accepted
time: 1502ms
memory: 4352kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #39:

score: 0
Accepted
time: 1497ms
memory: 4608kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #40:

score: 0
Accepted
time: 1495ms
memory: 4352kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #41:

score: 0
Accepted
time: 1500ms
memory: 4608kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #42:

score: 0
Accepted
time: 1493ms
memory: 4736kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #43:

score: 0
Accepted
time: 1494ms
memory: 4608kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #44:

score: 0
Accepted
time: 1492ms
memory: 4736kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Extra Test:

score: 0
Extra Test Passed