PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#PS0000263. Kiểm tra độ phủ các số nguyên (Check if All the Integers in a Range Are Covered)
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 độ phủ các số nguyên (Check if All the Integers in a Range Are Covered)
Check if All the Integers in a Range Are Covered
Source: LeetCode
Version: Phuoc Hung OJ Extended
Problem Statement
Given inclusive intervals and an inclusive target interval , determine whether every integer in the target belongs to at least one given interval.
Input
First line: . Next lines: .
Output
Print true if every target integer is covered; otherwise print false.
Subtasks
- Subtask 1 (20 points): ; ; .
- Subtask 2 (30 points): ; ; ; .
- Subtask 3 (50 points): ; ; .
Example 1
Input
3 2 5
1 2
3 4
5 6
Output
true
Explanation
2 belongs to the first interval, 3 and 4 to the second, and 5 to the third.
Example 2
Input
2 21 21
1 10
10 20
Output
false
Explanation
Neither interval contains 21.