Universal Cup Judging System

Universal Cup

Limite de temps : 1.0 s Limite de mémoire : 512 MB Points totaux : 100 Hackable ✓
Statistiques

良い問題には簡潔な問題文が求められる。

長さ $n$ の配列 $a$ が与えられる。この配列は最初すべて $0$ で埋められている。また、長さ $n$ の別の配列 $b$ が与えられる。あなたの目標は、配列 $a$ を配列 $b$ に変換することである。以下の2種類の操作を行うことができる。

  • $1\ x$: 配列 $a$ 内の $x$ と等しいすべての要素に $1$ を加える。
  • $2\ x$: 配列 $a$ のインデックス $x$ の要素に $1$ を加える。

操作は最大 $20\,000$ 回まで行うことができる。

入力

1行目には正の整数 $n$ ($1 \le n \le 1000$) が含まれる。 2行目には配列 $b$ を表す $n$ 個の非負整数 ($0 \le b_i \le n$) が含まれる。

出力

1行目には、操作回数を表す整数 $k$ を出力する。 続く $k$ 行には、各操作を表す2つの整数 $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.