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:||0.1 - 1.15013 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, SQL, kotlin, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.