PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CC0000052. Đếm số hoa đang nở (Number of Flowers in Full Bloom)
HỌC THEO LỘ TRÌNH
3 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm số hoa đang nở (Number of Flowers in Full Bloom)
Number of Flowers in Full Bloom
Source: LeetCode
Version: Phuoc Hung OJ Extended
Problem Statement
Flower blooms at every time from to , inclusive. There are people, with visit times . For each person, count how many flowers are blooming at that moment, including either endpoint.
Input
The first line contains . The next lines give . The final line contains visit times .
Output
Print integers, the number of flowers in bloom at each visit.
Subtasks
- Subtask 1 (20 points): ; ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; ; .
Examples
Input
4 4
1 6
3 7
9 12
4 13
2 3 7 11
Output
1 2 2 2
Explanation
At times 2, 3, 7 and 11, the bloom counts are 1, 2, 2 and 2, respectively.