PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BF0000028. Thông tin có đáng tin? (Is the Information Reliable?)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Thông tin có đáng tin? (Is the Information Reliable?)
Is the Information Reliable?
Source: POJ
Version: Phuoc Hung OJ Extended
Problem Statement
There are stations at integer coordinates. P A B X states that station is exactly units north of ; V A B states that is at least one unit north of . Decide whether every statement can hold simultaneously.
Input
First line: . Then follow lines of P A B X or V A B.
Output
Print exactly Reliable if consistent, otherwise Unreliable.
Subtasks
- Subtask 1 (20 points): $2\le n\le 12; 1\le m\le 30; 1\le A,B\le n; A\ne B; 1\le X\le 10^6 (P statements)$.
- Subtask 2 (30 points): $2\le n\le 200; 1\le m\le 2000; 1\le A,B\le n; A\ne B; 1\le X\le 10^6 (P statements)$.
- Subtask 3 (50 points): $2\le n\le 1000; 1\le m\le 100000; 1\le A,B\le n; A\ne B; 1\le X\le 10^6 (P statements)$.
Examples
Input
3 4
P 1 2 1
P 2 3 1
V 1 3
P 1 3 1
Output
Unreliable
Explanation
The first two exact statements imply . The last exact statement requires , so the data are inconsistent and the answer is Unreliable.