RXD and logic gates

TimeLimit:1000MS  MemoryLimit:524288KB
64-bit integer IO format:%I64d
Special Judge
未提交 | 登录后收藏
Problem Description
ioXDR is a master in logic circuits. One day he comes up with a special logic gate.
It requires 3 input bits $a, b, c$. It would then make $c = c ~xor~ (a ~and~b)$ and remain $a$ and $b$ unchanged, where $and$ means bitwise and and $xor$ means bitwise exclusive or.
ioXDR has a boolean function $f(x_1,x_2, \dots, x_m)$, where $x_i \in \{0, 1\}$ and $f(x_1,x_2, \dots x_m) \in \{0, 1\}$.
He wants to design a circuit and could simulate the boolean function.
He has $m$ input bits, and $1$ output bit, and some extra bits. The number of extra bits and the initial value of extra bits could be determined freely. The initial value of output bit could also be set freely.
**This problem is judged by SPJ, so any valid answer could be accepted**
$m\leq 8$
Input
There are several test cases, please keep reading until EOF.
For each test case, the first line consists of an integer $m$, corresponding to the number of input bits.
For the next $2^m$ lines, there is a string with the length of $m$, which only consists of 01, and an integer $\in \{0, 1\}$, which describes the boolean function.
There are 50 test cases.
Output
**It is very crucial, please read this part carefully**
For each test case, the first line you need to output an $0,1$ integer, which means the initial value of the output bit.
The next line you need to output an integer $t$, which means the number of the extra bits.
The next $t$ lines, in each line you have to output an 01 integer to describe the initial value of extra bits.
**The input bits are labeled as 1 ~ m, the output bit is labeled as m + 1, the extra bits are labeled as m + 2 ~ m + t + 1**
The next line you need to ouput an integer $n$, which means the number of logic gates.
The next $n$ lines, in each line you have to give us $3$ **different** integers $1\leq a, b, c\leq m + t + 1$, which means one logic gate.
**The simulator would simulate from top to bottom**
You have to guarantee that $n, t\leq 800$
SampleInput
1
0 1
1 0
SampleOutput
1
1
1
1
1 3 2
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: