Universal Cup Judging System

Universal Cup

実行時間制限: 1.0 s メモリ制限: 512 MB 満点: 100 ハック可能 ✓
統計

你被给出一个长度为 $n$ 的数组 $a$(初始全为零)和另一个长度为 $n$ 的数组 $b$。你的目标是将数组 $a$ 转换为数组 $b$。你可以执行以下两种类型的操作:

  • $1\ x$:将数组 $a$ 中所有等于 $x$ 的元素加 $1$。
  • $2\ x$:将数组 $a$ 中下标为 $x$ 的元素加 $1$。

你最多可以执行 $20\,000$ 次操作。

输入格式

第一行包含一个正整数 $n$ ($1 \le n \le 1000$)。 第二行包含 $n$ 个非负整数,表示数组 $b$ ($0 \le b_i \le n$)。

输出格式

第一行应包含一个整数 $k$,表示操作次数。 接下来的 $k$ 行,每行应包含两个整数 $1\ x$ 或 $2\ x$,表示一次操作。对于类型为 $1\ x$ 的操作,你必须确保 $0 \le x \le n$。对于类型为 $2\ x$ 的操作,你必须确保 $1 \le x \le n$。

样例

输入格式 1

4
2 4 3 1

输出格式 1

8
2 1
2 2
2 3
1 1
2 4
2 2
2 3
2 2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.