Submit | All submissions | Best solutions | Back to list |
PARADOX - Paradox |
A paradox is a statement or group of statements that leads to a contradiction. Consider the following two statements.
"The statement below is false."
"The statement above is true."
If we assume that 1st statement is true then according to 1st statement the 2nd statement is false. Since the 2nd statement is false and it says that 1st statement is true, 1st statement must be false which is a contradiction. If we assume that 1st statement is false then the 2nd statement must be true (since 1st statement says 2nd statement is false). Then according to 2nd statement 1st statement must be true which is a contradiction. Thus the statement cannot be classified as true or false. This is a paradox.
Given N statements of the form "Statement X is true/false", 1<=X<=N, your task is to find if these set of statements are paradoxical or not. A set of statements is paradoxical if one or more statements cannot be classified as true or false.
Input
Multiple test cases. Each test cases begins with an integer N representing the number of statements. 1<=N<=100. Then follow N lines, representing N statements in the order 1,2,3, ...,N. Each line contains an integer X and a string S separated by a space. 1<=X<=N. S is either "true" or "false" (quotes for clarity), which means the statement is "Statement X is S". N=0 indicates the end of testcases and should not be processed. There are atmost 10000 testcases.
Output
For each test case print "PARADOX" if the set of statements are paradoxical, else print "NOT PARADOX", in a separate line.
Example
Input:
2
2 false
1 true
2
2 false
1 false
0
Output:
PARADOX
NOT PARADOX
Added by: | arun |
Date: | 2010-01-03 |
Time limit: | 3s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS OBJC PERL6 SQLITE VB.NET |
Resource: | Kurukshetra OPC 2010 |
hide comments
|
||||||
2015-04-04 14:26:09 abhyudaya srinet
my 50th :) |
||||||
2015-03-27 16:19:25 Mayank Ladia
@Lakshman how statements are being linked ? |
||||||
2014-12-31 00:23:33 AYUSH VERMA
Test case that helped.. 4 2 false 3 false 1 true 2 true NOT PARADOX |
||||||
2014-10-22 05:06:06 Ayush Vatsa
Test cases that helped:- 5 1 true 3 true 4 false 5 true 2 true 3 1 true 2 false 3 true 0 PARADOX PARADOX |
||||||
2012-09-23 10:26:40 AC Srinivas
------------------------- 1 1 true is NOT a paradox. ------------------------- but 1 1 false IS A paradox. ------------------------ Last edit: 2012-09-23 10:27:45 |