|Online MIPT programming contest||РУССКИЙ|
Time limit = 5 second(s)
Memory limit = 16 MbYou're given a boolean expression with variables x1, x2, .. xM.
For instance, the following expressions are tautologies:
x1 | !x1, x1 | (!x1 & !x3) | x3, x1 & x2 | !x1 & !x2 | !x1 & x2 | x1 & !x2,
The first line contains the number of boolean variables M, 0 < M < 11.
The second line contains boolean expression. Output
The first line should contain YES or NO, depending whether the expression is a true tautology.
If it does not, output the values of xi, when the expression turns FALSE.
(M zeroes or ones, 1=TRUE, 0=FALSE).
The expression is formed via following terms x1 x2 .. xM & | ( )
The expression is well-formed. Any terms might be separated via arbitrary number of spaces (including zero one).
The length of an expression does not exceed 1000 characters.
x1 | !x1
!(x1 & x2 &(x3|x1))
1 1 0
Folklore, tests and description by Artem Voroztsov
6 oct 2005
© acm.mipt DevGroup
The page was generated in 180ms