|
Menu |
|
Задача Prologue...
| Файл входного файла: | prolog.in |
|---|---|
| Файл выходного файла: | prolog.out |
| Ограничение по памяти: | 64 MB |
| Ограничение по времени: | 2 s |
Описание
How many times have you summed weather forecast? I think that it is enough and no doubt you are tired. And while they are not being punished for their mistakes, you want to learn a few techniques to correctly select the date of an upcoming hike in the mountains. There was only one problem --- you need meteorological data.
Using a search engine, you received access to the login page of the database. It is, of course, password protected, but is it a problem? Half an hour later you found out that the password is a set of bits, and its correctness is determined by the truth of the boolean formula from this set. This formula is a conjunction of several disjunctions, in which every disjunction contains no more than one positive literal.
For example:
- conjunction (logial AND),
- disjunction (logical OR),
- set of bits (password),
- negative and positive literals,
- disjunctions,
- formula (conjunction).
Although the form of the formula remains unchanged, for security reasons the formula itself is changed frequently. In order not to torture yourself guessing passwords every time you have decided to write a program that will find any of the correct values for a password for given formula, or report that these do not exist.
Формат входных данных
The first line of the input file contains the number N - the number of disjuncts
(1 <= N <= 10
5
) and K - the number of bits in a password (1 <= K <= 10
5
).
Next N lines contain i-th dijunction literals description - numbers X
ij
(-K <= X
ij
<= K, X
ij
≠ 0).
A negative X
ij
corresponds to the negation of a literal |X
ij
| bits. Description of each disjunction ends with zero.
The total size of the input file does not exceed 5 MB.
Формат выходных данных
The first line of output must contain "YES" or "NO" - is there a required password or not.
If the answer is "YES", then the following K lines must contain one bit of password each (starting from the first).
Примеры:
| ввод | вывод |
|---|---|
|
4 4
|
YES
|
|
|
|
Difficulty: 0.722299794661
Accepted: 3
Submitted: 6
Источник задачи: KBTU OPEN 2010 SPRING
Powered by django, eJudge.
Обсуждение:
Начать обсуждение: