H - Hypervisor MacrOS
08.01.2010
![]() ![]() ![]() ![]() Time limit: 60 s Bob is the leader of a team developing a hypervisor system MacrOS. The project is huge and comprises lots of packages. Since some of them may depend on others, the installation process of the whole system is rather complicated. MacrOS is in alpha stage now, so there are many customers testing the new product. The installation process is overwhelming for many of them, and unfortunately the technical support is Bob's responsibility as well.
Bob had been given a list of dependencies by his team of programmers
before the alpha tests started. Each dependency reads ``package
As the product develops, the programmers sometimes call Bob to inform of new
dependencies.
Further, being in charge of technical support, Bob often receives
phone calls from customers with questions which packages should be installed first.
To no surprise, after several calls from programmers and customers, Bob realized
how difficult it is to keep track of dependencies and answer queries on-line at
the same time,
and. For automatizing this process, he wrote a program which
generated two log files. The first one contains the history of all phone calls.
An entry 1 A B denotes a new dependency introduced by the programmers,
and 0 A B denotes a query from a customer meaning ``should I install After a long period of testing, MacrOS is finally ready to enter beta stage. But Bob wants to be sure that there were no mistakes during the alpha testing. He wants to check if the answers given in the second log file are correct, and you are to help him. However, Bob does not give you the second log file. Moreover, he modified the first log in a tricky way: after each line corresponding to customer phone call that should have been answered with NO, he started/stopped reversing all lines corresponding to programmers calls; see the example below. Taking into account the Bob's modification of the first log file, you should give all the answers to the customers' questions.
Multiple Test Cases
The input contains several test cases. The first line of the input contains a positive integer Single Instance Input
Two integers Single Instance Output
Your program should print the content of the second log file.
This means that for each input line 0 A B, you should print YES
if package ExampleInput2 6 4 1 6 6 3 3 4 2 5 1 1 3 0 1 3 1 1 4 0 5 2 1 2 3 1 5 6 0 1 5 1 5 4 0 5 3 1 1 2 0 0 0 6 3 1 2 5 3 4 6 1 2 5 0 1 5 1 4 1 0 3 4 0 0 0 OutputYES NO YES NO YES NO Nie możesz wysyłać i oglądać rozwiązań tego zadania ponieważ nie jesteś zalogowany. Zaloguj się lub załóż konto. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright © 2008-2010 Wrocławski Portal Informatyczny
design: rafalpolito.com