Help the judgeProblem code: J6 |
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.
Input
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.
Output
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.
Example
Input: 4 1 0 1 1 1 1 1 1 1 -1 1 2 1 1 -1 -1 Output: MULTIPLE UNIQUE MULTIPLE CONFLICT
| Author: | admin |
| Date Added: | 15-10-2009 |
| Time Limit: | 1 - 15 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

What is the meaning of "or"
What is the meaning of "or" is it simple or , that is either can be true or both can be true, or is it exclusive or, that is both cannot be true?
Need some help with the
Need some help with the description of the problem in this scenario
There are 2 politicians and 3 evidences
2 3
1 1
-2 -2
-1 -1
Statement 1 - Politician A is involved. St 2 - Politician B is not involved. St 2 - Politiccian A is not involved
Here the two statements on A are conflicting and there is only one statement about B. so A-conflict and B-unique
What would be the output for this scenario?
since there is a conflict for A the whole set of evidences is conflict or since there is one unique evidence about B is it unique
admin can u pls explain the
admin
can u pls explain the problem statement a little.what happens when there are different results for different politicians...like conflict for one and multiple for other??
If the no information about
If the no information about a politician i.e. no evidence relating him, then does it mean he is not involved in scandal.
If the no information about
If the no information about a politician i.e. no evidence relating him, then does it mean he is not involved in scandal.
@SP The evidence doesn't seem
@SP The evidence doesn't seem to be consistent, so the output would be CONFLICT.
The problem statement states
The problem statement states that (1 k 3*10^5) but the first test case has k=0. Is this an error or k>=0?
Can n also be zero, and wat wud be the answer if n=0?
In this problem we are
In this problem we are talking about whole set of evidences. Yes, k can be 0.
@Ankit For me it's obvious
@Ankit
For me it's obvious that politician can be corrupted and still there will be no strong evidences against him (for the jugde), but it will be common sense that he is involved in case.
I am still confused as well,
I am still confused as well, consider 2 statements, 2 politicians:
1 1
-1 -2
Is the above:
1) Unique, since the only non-conflicting results is 1 is involved, 2 is not
or
2) Multiple, since the second statement could lead to both a conflic and a non-conflicting result
or ???
are tests correct for this
are tests correct for this problem?
Cancel my previous inquiry, I
Cancel my previous inquiry, I see the third test case of the example is nearly identical to my inquiry.
@admin Could you please
@admin
Could you please explain the input?
To be precise, each statement says: "A (is/is not) involved or B (is/is not) involved."
For n=2,k=1,
1 2
Does this mean "1 is involved OR 2 is involved" and thus leads to MULTIPLE ?
or "Both are involved" and so leads to UNIQUE?
what would b d output in
what would b d output in following case:
1 2
1 1
1 -1
Are there chances of more
Are there chances of more than one politician being involved in the scandal ???
@Piotr double-checked (triple
@Piotr
double-checked (triple checked?)
@rest
I'm not commenting anymore the problem statement, please, think for some time, then ask.
'This' is true or 'that' is
'This' is true or 'that' is true.
Does this imply EXACTLY one of, 'this' and 'that' is true.
Or does this imply that ATLEAST one of, 'this' and 'that' is true.
Thank You.
I get this test case correct
I get this test case correct but not at the server!
I fail to understand what is wrong. Some more test cases please!
there is one interpretation
there is one interpretation of OR
all the example inputs are
all the example inputs are very trivial. no cases are given in the case of multiple politicians. please provide some complex input examples in order to understand the problem.
Is there a blank line after
Is there a blank line after the last input? When I wait for the last blank line, my code produces a "runtime(OTHER) error". If I terminate after printing out the answer for the last test case, I get a "wrong answer".
Could you please still
Could you please still clarify what is the interpretation of OR. Sorry for the trouble.
The statements could not be
The statements could not be of the form Ui, -Vi or the other way around.
i.e.
either u,v will be both positive and u,v will be both negative
if they are then we have "MULTIPLE".
Then for any u and v
u has to be equal to v. that is, any statemet does not target more than one politician at a time.
Those politicians who were not attacked or told otherwise make the case "MULTIPLE". i.e. still unclear about some cases.
This is my current interpretation of the prob. Please comment on this. Is this right or wrong?
oh sorry, u and v can point
oh sorry, u and v can point to two different politicians also.
and seriously what is meaning
and seriously what is meaning of A(is/not) or B(is/not)
if it means normal OR, then should we consider both parts,i.e. parts before and after OR, to be true?
There is no way prove any part of OR (preceding as well as proceeding) wrong.
umm, i guess my last 3 posts
umm, i guess my last 3 posts were ambiguous.
So this is precise one,
what will be output of this?
2 2
1 -2
1 2
and then this one?
2 2
1 -2
-1 2
Come on people, the problem
Come on people, the problem statement is very clear, and everybody is asking about things that have already been mentioned.
Or means or. It does not mean exclusive or. This is perfectly obvious from the second test case.
An input of 1 5 means 1 is involved or 5 is involved.
An input of -1, 5 means 1 is not involved or 5 is involved. And so on.
You are to decide exactly which politicians are involved and which aren't. If you can find more than one solution, output MULTIPLE. If you can decide uniquely whether each politician is involved, output UNIQUE. If there is no possible set which satisfies all input, output CONFLICT.
No more needs to be said.
can smone pls tell what shld
can smone pls tell what shld be output for
2politicians 3 evidences
1 1
1 2
2 2
1 1
-1 -2
2 2
@Stephen Merriman Thank you.
@Stephen Merriman
Thank you.
@Stephen Merriman Thank
@Stephen Merriman
Thank you, I have no patience for them, they started to be very annoying with all those obvious questions.
@k.saiswaroop for your first
@k.saiswaroop
for your first set
1 1
1 2
2 2
answer will be UNIQUE, this set proves 1 and 2 both are offenders.
the second case however,
1 1
-1 -2
2 2
is a CONFLICT, as 1st and 3rd statements clearly tell 1 AND 2 BOTH are offenders. But 2nd statement conflicts even if we consider first or second part of 2nd statement. for 1st part of 2nd line it conflicts with 1st line.
I hope this will be
I hope this will be helpful...
"from every statement, soemthing has to be true. either u, or v. Or even both".
for example this is a UNIQUE
for example this is a UNIQUE resulting test case:
politicians=2;statements=4;
here goes statements:
-1 1
-1 -1
2 1
2 -1
explanation:
first row doesnt give anything. leave it.
second row gives definite answer, i.e. 1 is NOT guilty.
third row: now in 3rd row, presence of 1 denotes the sentence's second part is false (this is possible to imply from 2nd row's result). hence other part MUST BE true. which is equal to 2. hence it proves that 2 IS guilty.
4th row:
both parts are true. leave it.
i knw that there hav been
i knw that there hav been lots of obvious ques asked abt Help the Judge prob. i feel this one is not. if there is evidence of no one being involved then is it a case of Conflict or Multiple? coz the prob says that there is a case of corruption
@sriram in simplest terms :
@sriram
in simplest terms : if you dont know who is good and who is not EXACTLY, then its multiple.
I think there are some
I think there are some relational operators missing from the statement.
i.e: (1 t 10) should be (1 <= t <= 10) ?
@Przemysław Uznański Thats
@Przemysław Uznański
Thats pretty rude. If you dont want to answer, then dont. Obviously people are asking questions because the statement is unclear. Do you think people are posting questions just to annoy you?
Most of the time when people
Most of the time when people ask questions it is because they haven't read the problem statement ;)
for example this is a UNIQUE
for example this is a UNIQUE resulting test case:
politicians=2;statements=4;
here goes statements:
-1 1
-1 -1
2 1
2 -1
The result for this will be conflict:
becoz..first statement implies nothing.
second statement implies A is not involved
third statement implies that B is involved
but fourth statement wrongly implies that 1 is involved
so its a CONFLICT...
correct me if i m wrong in this interpretation..
I may be wrong..coz my WA solution also gives this output..
@ rizwanhudda The answer is
@ rizwanhudda
The answer is UNIQUE
From stmt(2), we get 1 is not involved
From stmt(3) we get 2 is involved.
The fourth stmt , both are true, 2 is involved and 1 is not involved.
So we know the values of 1 and 2 uniquely. Hence ans=UNIQUE.
@Matthew I think people are
@Matthew
I think people are asking questions because they are either too lazy to read carefully problem statement, or unable to think critically about their wrong solution/wrong understanding of problem.
Several people solved this problem without any hints, and questions asked here really should not be allowed and should be moderated!
Contestants. Read carefully. Read twice. Then, if your solution gets WA/TLE/..., think again, think whats wrong with your solution. And stop asking such obvious questions.
And please, learn what 'OR' means.
Gieven n and k as input, can
Gieven n and k as input, can i assume that all ui,vi given in evidence will lie in[1,n] or [-n,-1] ?
Please do not post code; the
Please do not post code; the contest is still running and you are just spoiling it for people.
something is serious proble
something is serious proble with your code engine...because:
for the 1st time i got "Wrong Answer" that means my program ran within the specified time limit but the output wass not desired.
There was a minute error in my program so I resolved it (just a change in variable name). I have added no extra operation or loop. So theoretically my program should agin run again within spesified time limit.
But this time I'm getting TLE...dont know why.......
@admin please delete the code
@admin
please delete the code i posted..
There are multiple input
There are multiple input files. The first one may have small inputs, and the second may have large inputs. A wrong answer would then give WA and stop after the first input, fixing that would give TLE on the second.
Input files should be
Input files should be published with the problem...or atleast only the worst case input should be provided. Sometimes It really becomes hard to figure out where your code went bad... or by what margin you are getting TLE..
The input test cases are
The input test cases are usually so that you understand what the problem statement is asking you to do. In a 10 day contest, you would be expected to come up with test cases yourself :)
You won't get any extra test
You won't get any extra test cases in 75min TopCoder SRM, neither in 5h ACM contests,why do you expect any 'bonus' test cases in 10 days contest?