# Description

• 每個鍋貼都要裝在其中一個鍋子裡
• 同一個鍋子的起鍋時間要一樣
• 鍋子必須裝著編號連續的鍋貼，例如，不能有一個鍋子恰裝著編號為 $1, 3, 4$ 的鍋貼

# Input Format

• $1 \leq N \leq 10^ 5$
• $1 \leq A_i \leq B_i \leq 10^ 9$

# Output Format

• $1 \leq K \leq 10^ 5$
• $1 \leq T_j \leq 10^ 9$
• $1 \leq C_j \leq D_j \leq N$

5
1 2
1 1
2 3
4 4
1 1

4
4 4 4
1 5 5
3 3 3
1 1 2

6
4 7
3 8
9 10
5 13
8 9
10 18

3
5 1 2
9 3 5
10 6 6

# Hints

$1 = A_1 \leq 1 \leq B_1 = 2$
$1 = A_2 \leq 1 \leq B_2 = 1$
$2 = A_3 \leq 3 \leq B_3 = 3$
$4 = A_4 \leq 4 \leq B_4 = 4$
$1 = A_5 \leq 1 \leq B_5 = 1$

# Problem Source

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 0~9 $N \leq 20$ 20
3 0~1, 10~19 $B_i \leq 100$ 37
4 0~29 無其他限制 43

# Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 131072 65536 1 2 3 4
1 1000 131072 65536 1 2 3 4
2 1000 131072 65536 2 4
3 1000 131072 65536 2 4
4 1000 131072 65536 2 4
5 1000 131072 65536 2 4
6 1000 131072 65536 2 4
7 1000 131072 65536 2 4
8 1000 131072 65536 2 4
9 1000 131072 65536 2 4
10 1000 131072 65536 3 4
11 1000 131072 65536 3 4
12 1000 131072 65536 3 4
13 1000 65536 65536 3 4
14 1000 65536 65536 3 4
15 1000 65536 65536 3 4
16 1000 65536 65536 3 4
17 1000 65536 65536 3 4
18 1000 65536 65536 3 4
19 1000 65536 65536 3 4
20 1000 65536 65536 4
21 1000 65536 65536 4
22 1000 65536 65536 4
23 1000 65536 65536 4
24 1000 65536 65536 4
25 1000 65536 65536 4
26 1000 65536 65536 4
27 1000 65536 65536 4
28 1000 65536 65536 4
29 1000 65536 65536 4