logo AlgoBeat OnlineJudge
登录 注册

#205736. 「EZEC-4」paulzrm Loves Array

内存限制:128 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

原题面:

has an array consisting of integers: . The initial value of is . There are operations, including four types as follows.

Type : 1 sort the array.
Type : 2 sort the array and reverse it.
Type : 3 x y swap . It is guaranteed that is not equal to , and .
Type : 4 reverse the array.

You need to output the array after operations.

First line with two intergers .

Next lines are the operations.

One line, numbers, the array.


小 Z 有一个下标从 开始并且长度为 的序列,初始时下标为 位置的数字为 。有 个操作,每个操作会是以下四种之一。

  • 1 对序列从小到大进行排序。
  • 2 对序列从小到大进行排序后将其翻转,(译者注:就是从大到小排序)。
  • 3 x y 将下标为 的数交换位置。保证 且 。
  • 4 将序列翻转。

你要输出在 次操作后的序列。

输入格式

第一行两个整数 ,表示序列的长度以及操作的数量。

接下来 行,每行一个操作。保证操作合法。

输出格式

一行包含 个整数,表示操作后的序列。

样例

样例输入 1

5 5
1
2
3 2 4
4
3 1 5

样例输出 1

5 4 3 2 1

数据范围与提示

【数据范围】

【本题采用捆绑测试】

subtask 1(24pts): 。

subtask 2(13pts): 没有操作三。

subtask 3(63pts): 。

【样例解释】

序列经过的操作为: