QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#861387#9980. Boolean Function Reconstructionucup-team4728#AC ✓1641ms117120kbC++233.4kb2025-01-18 17:14:312025-01-18 17:14:50

Details

Tip: Click on the bar to expand more detailed information

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
(a&b)
Yes
(a|b)
Yes
T
Yes
(((b|c)&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: 3456kb

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

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

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

result:

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

Test #7:

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

result:

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

Test #8:

score: 0
Accepted
time: 50ms
memory: 41728kb

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

result:

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

Test #9:

score: 0
Accepted
time: 51ms
memory: 41856kb

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

result:

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

Test #10:

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

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

result:

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

Test #11:

score: 0
Accepted
time: 44ms
memory: 41728kb

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

result:

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

Test #12:

score: 0
Accepted
time: 109ms
memory: 117120kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

Yes
(((((((((((((((h|(i|(j|(k|(l|(m|(n|o)))))))&g)|(((i|(j|(k|(l|(m|(n|o))))))&h)|(((j|(k|(l|(m|(n|o)))))&i)|(((k|(l|(m|(n|o))))&j)|(((l|(m|(n|o)))&k)|(((m|(n|o))&l)|(((n|o)&m)|(n&o))))))))&f)|(((((i|(j|(k|(l|(m|(n|o))))))&h)|(((j|(k|(l|(m|(n|o)))))&i)|(((k|(l|(m|(n|o))))&j)|(((l|(m|(n|o)))&k)|(((m|...

result:

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

Test #13:

score: 0
Accepted
time: 112ms
memory: 117120kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000100000000000000010000000100010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #14:

score: 0
Accepted
time: 102ms
memory: 116992kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
(((((((((((((((((i|(j|(k|(l|(m|(n|o))))))&h)|(((j|(k|(l|(m|(n|o)))))&i)|(((k|(l|(m|(n|o))))&j)|(((l|(m|(n|o)))&k)|(((m|(n|o))&l)|(((n|o)&m)|(n&o)))))))&g)|(((((j|(k|(l|(m|(n|o)))))&i)|(((k|(l|(m|(n|o))))&j)|(((l|(m|(n|o)))&k)|(((m|(n|o))&l)|(((n|o)&m)|(n&o))))))&h)|(((((k|(l|(m|(n|o))))&j)|(((l|...

result:

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

Test #15:

score: 0
Accepted
time: 98ms
memory: 116992kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
(((((((((((((((((((j|(k|(l|(m|(n|o)))))&i)|(((k|(l|(m|(n|o))))&j)|(((l|(m|(n|o)))&k)|(((m|(n|o))&l)|(((n|o)&m)|(n&o))))))&h)|(((((k|(l|(m|(n|o))))&j)|(((l|(m|(n|o)))&k)|(((m|(n|o))&l)|(((n|o)&m)|(n&o)))))&i)|(((((l|(m|(n|o)))&k)|(((m|(n|o))&l)|(((n|o)&m)|(n&o))))&j)|(((((m|(n|o))&l)|(((n|o)&m)|(...

result:

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

Test #16:

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

input:

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

output:

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

result:

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

Test #17:

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

input:

65536
7
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
7
00000001000100010001000101110111000100010111011101110111011111110001000101110111011101110111111100010001011101110111011111111111
7
000000010001001100000001001101...

output:

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

result:

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

Test #18:

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

input:

16384
8
0000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000100010000000000010001000100010011011100000000000000000000000000010001000000000001000100010001011101110000000000000001000100010011011100010001000101110011011101111111
8
000101010101011100010101011101110...

output:

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

result:

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

Test #19:

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

input:

4096
9
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000010001011100000...

output:

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

result:

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

Test #20:

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

input:

1024
10
0000000000000000000000000000000100000000000000110000000000000011000000000000000100000000000000110000000000000011000000010000001100000000000000110000000000000011000000000000001100000011000001110000000000000011000000000000001100000011000001110000001100011111000000000000001100000000000000110000...

output:

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

result:

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

Test #21:

score: 0
Accepted
time: 250ms
memory: 5120kb

input:

256
11
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #22:

score: 0
Accepted
time: 184ms
memory: 8192kb

input:

64
12
000101011111111101111111111111110001011111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001010111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001011111111111111111111111111101111111111111111111111111111111011111...

output:

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

result:

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

Test #23:

score: 0
Accepted
time: 143ms
memory: 16640kb

input:

16
13
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000...

output:

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

result:

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

Test #24:

score: 0
Accepted
time: 122ms
memory: 41804kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #25:

score: 0
Accepted
time: 119ms
memory: 41820kb

input:

4
14
0000000000000000000000000000000000000000000000000001000100010101000000000000000101010101010101010001010101010101011101110111111100000000000000000000000000000001000000000000000000010101010101010000000100010001010101010101011101010101010101010111111111111111000000000000000000010101010101010000000...

output:

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

result:

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

Test #26:

score: 0
Accepted
time: 119ms
memory: 41792kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #27:

score: 0
Accepted
time: 122ms
memory: 41688kb

input:

4
14
0000000000000000000000000001001100000000000000110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110001001100111111001100111111111100110011111111110011001111111111000000000011001100000011001101110000000...

output:

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

result:

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

Test #28:

score: 0
Accepted
time: 118ms
memory: 41716kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #29:

score: 0
Accepted
time: 92ms
memory: 116736kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((((((((((((((((((((((l&k)|((m&l)|n))&j)|(((n|o)&k)|(m&o)))&i)|(((((m&n)&k)|(l&o))&j)|(((l&o)&k)|(n&o))))&h)|(((((((l&o)&k)|(n&o))&j)|((l&n)&o))&i)|(((((k&m)&n)&o)&j)|((((k&l)&m)&n)&o))))&g)|((((((((((m&l)|n)&k)|((n&m)|o))&j)|((((n|o)&m)&k)|(((n|o)&l)|(n&o))))&i)|(((((((n|o)&l)|(m&o))&k)|((((n|o...

result:

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

Test #30:

score: 0
Accepted
time: 94ms
memory: 116864kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #31:

score: 0
Accepted
time: 104ms
memory: 116864kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #32:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000001100000000000000110000001100111111000000000000000000000000000000000000000...

output:

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

result:

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

Test #33:

score: 0
Accepted
time: 105ms
memory: 116736kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((((((((((((((((((((l|n)&j)&i)|(((m&n)&j)|((l|n)&k)))&h)|((((((((n&l)|m)&k)|(n&o))&j)|(l&o))&i)|(((((((m&n)&l)|o)&k)|((m&n)&o))&j)|(((n&o)&k)|((l&m)&o)))))&g)|(((((k|((n&l)|m))&i)|(((((l|n)&k)|(l&m))&j)|((((n&l)|m)&k)|(((m&n)&l)|o))))&h)|(((((l&o)&j)|((((m&l)|(m&n))&k)|(((n&o)&l)|(m&o))))&i)|(((...

result:

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

Test #34:

score: 0
Accepted
time: 110ms
memory: 116864kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100000000000000000000000001010101000000000000000000000000000000000000000...

output:

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

result:

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

Test #35:

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

input:

65536
7
00000000000000010000000100000101000000000001011100000101010111110000000100000001000001110001011100000101001101110011011111111111
7
00000000000000010000000000010111000000000000011100000001011111110000000100000001000000110011011100010101001101110011111111111111
7
000000000000000000000001000100...

output:

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

result:

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

Test #36:

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

input:

1024
10
0000000000000000000000000000000000000000000000000000000000000011000000000000000000000001000001110000000000000111000101010111011100000000000000000000000000000111000000010001011100010011000101110000000100000001000001110001011100000101011111110101111111111111000000000000000100000000000100010000...

output:

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

result:

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

Test #37:

score: 0
Accepted
time: 198ms
memory: 8064kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100010101000101110111111100000000000000000000000000000001000000...

output:

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

result:

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

Test #38:

score: 0
Accepted
time: 188ms
memory: 8192kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #39:

score: 0
Accepted
time: 177ms
memory: 8064kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #40:

score: 0
Accepted
time: 146ms
memory: 41916kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #41:

score: 0
Accepted
time: 145ms
memory: 41916kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #42:

score: 0
Accepted
time: 106ms
memory: 116992kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #43:

score: 0
Accepted
time: 107ms
memory: 116992kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
(((((((((((((((j|(k|l))&g)|(((j|(k|(l|o)))&h)|(((j|(k|(l|n)))&i)|(((m|o)&j)|((l&k)|((o&m)|(n&o)))))))&f)|(((((i|(k|(l|o)))&h)|(((j|(k|(m|n)))&i)|(((m|o)&j)|((n&k)|(((m|(n|o))&l)|((n&m)|(n&o)))))))&g)|(((((k|l)&i)|(((k|(m|o))&j)|(((n|o)&m)|(n&o))))&h)|(((((k|(l|(m|o)))&j)|(((l|m)&k)|(((n|o)&l)|(m...

result:

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

Test #44:

score: 0
Accepted
time: 101ms
memory: 116992kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
(((((((((((((((((j|(l|(n|o)))&h)|(((n|o)&i)|(((k|(m|n))&j)|((o&k)|(((m|o)&l)|((o&m)|(n&o)))))))&g)|(((((j|n)&i)|(((m|o)&j)|(((m|n)&k)|(((m|n)&l)|((n|o)&m)))))&h)|(((((l|m)&j)|(((l|o)&k)|((n|o)&m)))&i)|(((((l|(m|o))&k)|(((m|(n|o))&l)|(((n|o)&m)|(n&o))))&j)|((((o&l)|((n|o)&m))&k)|(((m&n)&l)|((m&n)...

result:

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

Extra Test:

score: 0
Extra Test Passed