CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Forums
    • Blog
    • Wiki
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
    • Event Calendar
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » November 2009 (Contest X) » Help the judge

Help the judge

Problem code: J6

  • All Submissions

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


  • Submit

Comments

  • Login or Register to post a comment.

What is the meaning of "or"

utkarsh_lath @ 1 Nov 2009 04:01 PM

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

sppraveen @ 1 Nov 2009 04:13 PM

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

rampage @ 1 Nov 2009 05:54 PM

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

ankitjain0912 @ 1 Nov 2009 05:54 PM

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

ankitjain0912 @ 1 Nov 2009 05:55 PM

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

admin @ 1 Nov 2009 05:59 PM

@SP The evidence doesn't seem to be consistent, so the output would be CONFLICT.

The problem statement states

sally11 @ 1 Nov 2009 07:19 PM

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

izulin @ 1 Nov 2009 08:00 PM

In this problem we are talking about whole set of evidences. Yes, k can be 0.

@Ankit For me it's obvious

izulin @ 1 Nov 2009 08:02 PM

@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,

jlehett @ 1 Nov 2009 11:16 PM

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

pmnox @ 1 Nov 2009 11:30 PM

are tests correct for this problem?

Cancel my previous inquiry, I

jlehett @ 1 Nov 2009 11:40 PM

Cancel my previous inquiry, I see the third test case of the example is nearly identical to my inquiry.

@admin Could you please

sally11 @ 2 Nov 2009 12:20 AM

@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

shivmitra @ 2 Nov 2009 12:31 AM

what would b d output in following case:

1 2

1 1

1 -1

 

 

Are there chances of more

canudeep @ 2 Nov 2009 01:16 AM

Are there chances of more than one politician being involved in the scandal ???

@Piotr double-checked (triple

izulin @ 2 Nov 2009 04:29 AM

@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

keshav_57 @ 2 Nov 2009 11:50 AM

'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

ma13 @ 2 Nov 2009 01:30 PM

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

izulin @ 2 Nov 2009 06:03 PM

there is one interpretation of OR

all the example inputs are

nishitd @ 3 Nov 2009 03:28 AM

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

majickace @ 3 Nov 2009 11:03 PM

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

keshav_57 @ 4 Nov 2009 10:45 AM

Could you please still clarify what is the interpretation of OR. Sorry for the trouble.

The statements could not be

arjundevane @ 4 Nov 2009 11:03 AM

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

arjundevane @ 4 Nov 2009 11:04 AM

oh sorry, u and v can point to two different politicians also.

and seriously what is meaning

arjundevane @ 4 Nov 2009 11:14 AM

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

arjundevane @ 4 Nov 2009 11:44 AM

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

triplem @ 4 Nov 2009 12:18 PM

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

saiswaroop @ 4 Nov 2009 02:00 PM

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.

keshav_57 @ 4 Nov 2009 02:12 PM

@Stephen Merriman

Thank you.

@Stephen Merriman   Thank

izulin @ 4 Nov 2009 02:20 PM

@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

arjundevane @ 4 Nov 2009 03:10 PM

@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

arjundevane @ 4 Nov 2009 03:30 PM

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

arjundevane @ 4 Nov 2009 05:22 PM

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

srirams @ 5 Nov 2009 12:02 PM

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 :

arjundevane @ 5 Nov 2009 12:54 PM

@sriram

in simplest terms : if you dont know who is good and who is not EXACTLY, then its multiple.

I think there are some

vexorian @ 6 Nov 2009 06:17 PM

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

majickace @ 7 Nov 2009 09:41 AM

@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

triplem @ 7 Nov 2009 10:28 AM

Most of the time when people ask questions it is because they haven't read the problem statement ;)

for example this is a UNIQUE

rizwanhudda @ 7 Nov 2009 04:40 PM

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

srirams @ 9 Nov 2009 11:14 AM

@ 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

izulin @ 10 Nov 2009 04:26 PM

@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

saty @ 10 Nov 2009 09:19 PM

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

triplem @ 11 Nov 2009 09:26 AM

Please do not post code; the contest is still running and you are just spoiling it for people.

something is serious proble

abhinava.srivastava @ 11 Nov 2009 09:29 AM

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

abhinava.srivastava @ 11 Nov 2009 09:30 AM

@admin

please delete the code i posted..

There are multiple input

triplem @ 11 Nov 2009 10:04 AM

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

abhinava.srivastava @ 11 Nov 2009 04:51 PM

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

admin @ 11 Nov 2009 05:13 PM

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

izulin @ 12 Nov 2009 11:16 PM

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?

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook-off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the CodeChef Forums and Wiki section.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. You can also host a coding contest for your institute on CodeChef, organize an algorithm event and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com