#730. 交替的排序
交替的排序
Cannot parse: (0 , import_utils.normalizeSubtasks) is not a function or its return value is not iterable
Background
Special for beginners, ^_^
Description
有一个长为 的序列,在开始时,序列中的第 个数 的值为 。现在给出 次操作,每次操作会给定三个参数 ,其意义如下:
- 当 为 时:,将 与 对调;
- 当 为 时:将 区间内的数按升序排序。
请在所有操作完成后输出序列 。
Format
Input
输入共 行。第一行输入两个正整数 和 ,接下来 行按照 的顺序输入 和 。
Output
在所有操作完成后输出一行 个正整数,即 数列的元素。
Samples
5 3
1 1 0
1 2 0
2 2 4
2 1 3 4 5
10 15
1 3 0
1 5 0
1 4 0
1 2 0
1 3 0
2 4 7
1 5 0
1 7 0
1 9 0
1 8 0
2 3 5
1 8 0
1 9 0
1 5 0
1 2 0
1 2 4 5 3 6 8 7 9 10
Limitation
- ,;
- 必为 或 ;
- 当 为 时,;
- 当 为 时,;
- 输入均为整数。