Help the judge
All submissions for this problem are available.
A scandal has been revealed in the ruling political party: there is a large case of corruption! You are the judge in the case, and you have a lot of evidence at your disposal. Unfortunately, some of the statements may potentially contradict the others. Each piece of evidence says something about the involvement of two (not necessary different) politicians in the crime. To be precise, each statement says: "A (is/is not) involved or B (is/is not) involved." Your job is to process all the pieces of evidence, and decide one of three options:
- the evidence is inconsistent,
- you can decide exactly who is involved and who isn't,
- there is some doubt left as to who is involved.
In the first line of input there is an integer t (1≤t≤10), representing the number of test cases. The subsequent test cases are defined as follows. In the first line of each test case there is an integer n (1≤n≤105) which denotes the number of politicians. Then, an integer k follows (1≤k≤3*105), denoting the number of pieces of evidence. The following k lines contain the evidence. The description of each statement contains 2 integers, ui,vi. If statement i says that politician A is involved, then ui = A or vi = A, whereas if statement i says politician A is not involved, then ui = -A or vi = -A. There is a blank line after each test case.
For each test case, write in a separate line of the output one of the words: "CONFLICT", "UNIQUE", or "MULTIPLE", corresponding to the above described possibilities.
Input: 4 1 0 1 1 1 1 1 1 1 -1 1 2 1 1 -1 -1 Output: MULTIPLE UNIQUE MULTIPLE CONFLICT
|Time Limit:||1 - 15 sec|
|Source Limit:||50000 Bytes|
|Languages:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.4, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.