QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#862548#9980. Boolean Function Reconstructionucup-team1206#AC ✓653ms264064kbC++203.9kb2025-01-19 02:59:072025-01-19 02:59:20

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

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

input:

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

output:

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

result:

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

Test #4:

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

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: 42ms
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: 1ms
memory: 3840kb

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

result:

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

Test #7:

score: 0
Accepted
time: 19ms
memory: 10368kb

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

result:

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

Test #8:

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

input:

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

output:

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

result:

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

Test #9:

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

input:

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

output:

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

result:

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

Test #10:

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

input:

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

output:

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

result:

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

Test #11:

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

input:

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

output:

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

result:

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

Test #12:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #13:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000100000000000000010000000100010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #14:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #15:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #16:

score: 0
Accepted
time: 252ms
memory: 86528kb

input:

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

output:

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

result:

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

Test #17:

score: 0
Accepted
time: 494ms
memory: 147456kb

input:

65536
7
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
7
00000001000100010001000101110111000100010111011101110111011111110001000101110111011101110111111100010001011101110111011111111111
7
000000010001001100000001001101...

output:

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

result:

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

Test #18:

score: 0
Accepted
time: 237ms
memory: 66688kb

input:

16384
8
0000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000100010000000000010001000100010011011100000000000000000000000000010001000000000001000100010001011101110000000000000001000100010011011100010001000101110011011101111111
8
000101010101011100010101011101110...

output:

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

result:

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

Test #19:

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

input:

4096
9
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000010001011100000...

output:

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

result:

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

Test #20:

score: 0
Accepted
time: 79ms
memory: 16000kb

input:

1024
10
0000000000000000000000000000000100000000000000110000000000000011000000000000000100000000000000110000000000000011000000010000001100000000000000110000000000000011000000000000001100000011000001110000000000000011000000000000001100000011000001110000001100011111000000000000001100000000000000110000...

output:

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

result:

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

Test #21:

score: 0
Accepted
time: 40ms
memory: 8832kb

input:

256
11
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #22:

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

input:

64
12
000101011111111101111111111111110001011111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001010111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001011111111111111111111111111101111111111111111111111111111111011111...

output:

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

result:

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

Test #23:

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

input:

16
13
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000...

output:

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

result:

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

Test #24:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #25:

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

input:

4
14
0000000000000000000000000000000000000000000000000001000100010101000000000000000101010101010101010001010101010101011101110111111100000000000000000000000000000001000000000000000000010101010101010000000100010001010101010101011101010101010101010111111111111111000000000000000000010101010101010000000...

output:

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

result:

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

Test #26:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #27:

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

input:

4
14
0000000000000000000000000001001100000000000000110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110001001100111111001100111111111100110011111111110011001111111111000000000011001100000011001101110000000...

output:

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

result:

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

Test #28:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #29:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #30:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #31:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #32:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000001100000000000000110000001100111111000000000000000000000000000000000000000...

output:

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

result:

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

Test #33:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #34:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100000000000000000000000001010101000000000000000000000000000000000000000...

output:

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

result:

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

Test #35:

score: 0
Accepted
time: 653ms
memory: 264064kb

input:

65536
7
00000000000000010000000100000101000000000001011100000101010111110000000100000001000001110001011100000101001101110011011111111111
7
00000000000000010000000000010111000000000000011100000001011111110000000100000001000000110011011100010101001101110011111111111111
7
000000000000000000000001000100...

output:

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

result:

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

Test #36:

score: 0
Accepted
time: 115ms
memory: 31360kb

input:

1024
10
0000000000000000000000000000000000000000000000000000000000000011000000000000000000000001000001110000000000000111000101010111011100000000000000000000000000000111000000010001011100010011000101110000000100000001000001110001011100000101011111110101111111111111000000000000000100000000000100010000...

output:

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

result:

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

Test #37:

score: 0
Accepted
time: 29ms
memory: 9984kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100010101000101110111111100000000000000000000000000000001000000...

output:

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

result:

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

Test #38:

score: 0
Accepted
time: 25ms
memory: 9600kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #39:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #40:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #41:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #42:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #43:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #44:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Extra Test:

score: 0
Extra Test Passed