PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CC0000053. Đếm số điểm được phủ đúng K lần (Covered Points Count)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm số điểm được phủ đúng K lần (Covered Points Count)
Covered Points Count
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are inclusive integer-coordinate segments, possibly identical or reduced to single points. For every from 1 through , count integer coordinates covered by exactly segments.
Input
The first line contains . Each of the following lines contains an inclusive interval .
Output
Print the counts .
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
3
0 3
1 3
3 8
Output
6 2 1
Explanation
Coordinates 0,4,5,6,7,8 have coverage one; 1,2 have coverage two; and coordinate 3 has coverage three.