#940. 校门外的树

校门外的树

No submission language available for this problem.

Background

Special for beginners, ^_^

Description

校门外有很多树,学校决定在某个时刻在某一段种上一种树,保证任一时刻不会出现两段相同种类的树,现有两种操作:

  • K=1,读入 l, r 表示在 lr 之间种上一种树,每次操作种的树的种类都不同;
  • K=2,读入 l, r 表示询问 lr 之间有多少种树。

注意:每个位置都可以重复种树。

Format

Input

第一行 n, m 表示道路总长为 n,共有 m 个操作; 接下来 m 行为 m 个操作。

Output

对于每个 k=2 输出一个答案。

Samples

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

Limitation

对于 20%20\% 的数据,1n,m1001\le n,m\le 100

对于 60%60\% 的数据,1n103,1m5×1041\le n\le 10^3,1\le m\le 5\times 10^4

对于 100%100\% 的数据,1n,m5×1041\le n,m\le 5\times 10^4,保证 l,r>0l,r\gt 0

1s, 1024KiB for each test case.