QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#877410#9980. Boolean Function ReconstructionZhaoZiLongAC ✓485ms4096kbC++172.5kb2025-01-31 22:01:252025-01-31 22:01:26

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
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: 3712kb

input:

4
1
00
1
10
1
01
1
11

output:

Yes
F
No
Yes
a
Yes
T

result:

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

Test #3:

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

input:

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

output:

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

result:

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

Test #4:

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

result:

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

Test #7:

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

input:

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

output:

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

result:

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

Test #8:

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

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: 5ms
memory: 4096kb

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: 4ms
memory: 4096kb

input:

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

output:

Yes
F
Yes
(a&b)
Yes
((a&b)&c)
Yes
(((((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: 4ms
memory: 4096kb

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: 5ms
memory: 4044kb

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: 5ms
memory: 4060kb

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: 5ms
memory: 4068kb

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: 3ms
memory: 3940kb

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

input:

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

output:

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

result:

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

Test #17:

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

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

result:

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

Test #18:

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

input:

16384
8
0000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000100010000000000010001000100010011011100000000000000000000000000010001000000000001000100010001011101110000000000000001000100010011011100010001000101110011011101111111
8
000101010101011100010101011101110...

output:

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

result:

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

Test #19:

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

input:

4096
9
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000010001011100000...

output:

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

result:

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

Test #20:

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

input:

1024
10
0000000000000000000000000000000100000000000000110000000000000011000000000000000100000000000000110000000000000011000000010000001100000000000000110000000000000011000000000000001100000011000001110000000000000011000000000000001100000011000001110000001100011111000000000000001100000000000000110000...

output:

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

result:

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

Test #21:

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

input:

256
11
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #22:

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

input:

64
12
000101011111111101111111111111110001011111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001010111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001011111111111111111111111111101111111111111111111111111111111011111...

output:

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

result:

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

Test #23:

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

input:

16
13
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000...

output:

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

result:

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

Test #24:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #25:

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

input:

4
14
0000000000000000000000000000000000000000000000000001000100010101000000000000000101010101010101010001010101010101011101110111111100000000000000000000000000000001000000000000000000010101010101010000000100010001010101010101011101010101010101010111111111111111000000000000000000010101010101010000000...

output:

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

result:

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

Test #26:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #27:

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

input:

4
14
0000000000000000000000000001001100000000000000110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110001001100111111001100111111111100110011111111110011001111111111000000000011001100000011001101110000000...

output:

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

result:

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

Test #28:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #29:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #30:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #31:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #32:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000001100000000000000110000001100111111000000000000000000000000000000000000000...

output:

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

result:

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

Test #33:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #34:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100000000000000000000000001010101000000000000000000000000000000000000000...

output:

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

result:

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

Test #35:

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

input:

65536
7
00000000000000010000000100000101000000000001011100000101010111110000000100000001000001110001011100000101001101110011011111111111
7
00000000000000010000000000010111000000000000011100000001011111110000000100000001000000110011011100010101001101110011111111111111
7
000000000000000000000001000100...

output:

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

result:

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

Test #36:

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

input:

1024
10
0000000000000000000000000000000000000000000000000000000000000011000000000000000000000001000001110000000000000111000101010111011100000000000000000000000000000111000000010001011100010011000101110000000100000001000001110001011100000101011111110101111111111111000000000000000100000000000100010000...

output:

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

result:

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

Test #37:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100010101000101110111111100000000000000000000000000000001000000...

output:

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

result:

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

Test #38:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #39:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

Yes
(((((((((((((((g|(i|(j|k)))&c)|(((g|(i|j))&a)|(((i|k)&g)|((i|k)&j))))&f)|(((((g|(j|k))&a)|(((g|k)&c)|((g|k)&j)))&i)|(((((c|(g|k))&a)|(g&k))&j)|((c&g)&k))))&l)|(((((((a|(i|j))&f)|(((a|(i|j))&k)|(i&j)))&c)|(((((a|(j|k))&i)|(a&k))&f)|((a&j)&k)))&g)|(((((((f|j)&c)|(f&k))&a)|(((c|f)&k)&j))&i)|(((a&c)...

result:

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

Test #40:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #41:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #42:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #43:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
(((((((((((((((e|(i|(k|(l|(m|(n|o))))))&h)|(((e|(i|(l|(m|n))))&a)|(((e|(i|(l|(m|o))))&k)|(((i|(l|(m|o)))&n)|(((i|(l|o))&e)|(i&m))))))&c)|(((((e|(h|(i|(k|(m|o)))))&a)|(((e|(k|(m|(n|o))))&h)|(((e|(i|(n|o)))&k)|(((i|o)&m)|((e|o)&n)))))&l)|(((((a|(h|(i|(k|o))))&e)|(((a|(k|(n|o)))&i)|(((a|(n|o))&h)|(...

result:

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

Test #44:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
(((((((((((((((((a|(b|(d|(f|(i|(j|l))))))&g)|(((d|(f|(i|(j|l))))&a)|(((d|(i|(j|l)))&b)|(((f|l)&d)|((l&f)|(i&j))))))&o)|(((((a|(b|(f|(g|(j|l)))))&d)|(((a|(b|(f|(j|l))))&g)|(((b|j)&a)|((b|l)&f))))&i)|(((((a|(d|(f|(g|j))))&l)|(((d|(g|j))&a)|((j&d)|(f&g))))&b)|(((((g|(j|l))&d)|((f|l)&j))&a)|(((d|f)&...

result:

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

Extra Test:

score: 0
Extra Test Passed