PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CC0000050. Kiểm tra các đoạn bao nhau (Nested Ranges Check)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Kiểm tra các đoạn bao nhau (Nested Ranges Check)
Nested Ranges Check
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
You are given inclusive ranges. A range contains if and . For every original range, decide whether it contains another range and whether it is contained in another range. Report both arrays in input order.
Input
The first line is . Each of the following lines contains the closed interval endpoints .
Output
Print binary flags for ranges containing another range, then flags for ranges contained in another range.
Subtasks
- Subtask 1 (20 points): ; ; no two ranges are identical.
- Subtask 2 (30 points): ; ; no two ranges are identical.
- Subtask 3 (50 points): ; ; no two ranges are identical.
Examples
Input
4
1 6
2 4
4 8
3 6
Output
1 0 0 0
0 1 0 1
Explanation
The range contains and . Only the first range contains another; the second and fourth are contained.