Universal Cup Judging System

Universal Cup

حد الوقت: 1.0 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓
الإحصائيات

Một bài toán hay nên có một đề bài ngắn gọn.

Bạn được cho một mảng $a$ có độ dài $n$, ban đầu chứa toàn các số không, và một mảng $b$ có độ dài $n$. Mục tiêu của bạn là biến đổi mảng $a$ thành mảng $b$. Bạn có thể thực hiện hai loại thao tác sau:

  • $1\ x$: Cộng $1$ vào tất cả các phần tử trong $a$ có giá trị bằng $x$.
  • $2\ x$: Cộng $1$ vào phần tử trong $a$ tại chỉ số $x$.

Bạn được phép thực hiện không quá $20\,000$ thao tác.

Dữ liệu vào

Dòng đầu tiên chứa một số nguyên dương $n$ ($1 \le n \le 1000$). Dòng thứ hai chứa $n$ số nguyên không âm biểu diễn mảng $b$ ($0 \le b_i \le n$).

Dữ liệu ra

Dòng đầu tiên chứa một số nguyên $k$, biểu diễn số lượng thao tác. $k$ dòng tiếp theo, mỗi dòng chứa hai số nguyên $1\ x$ hoặc $2\ x$, biểu diễn một thao tác. Đối với thao tác loại $1\ x$, bạn phải đảm bảo $0 \le x \le n$. Đối với thao tác loại $2\ x$, bạn phải đảm bảo $1 \le x \le n$.

Ví dụ

Dữ liệu vào 1

4
2 4 3 1

Dữ liệu ra 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.