QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21143. Đếm giống bò

Statistics

$N$ cô bò Farmer John, đánh số $1 \ldots N$, đứng thành hàng (thường xuyên tới mức chỉ cần nhắc nhẹ). Mã giống $1$: Holsteins, $2$: Guernseys, $3$: Jerseys. Đếm mỗi giống trong các đoạn hàng.

Dữ liệu vào

Dòng đầu: $N$, $Q$ ($1 \leq N \leq 100,000$, $1 \leq Q \leq 100,000$).

$N$ dòng sau chứa nguyên $1$, $2$ hoặc $3$, giống mỗi cô theo thứ tự.

$Q$ dòng sau là truy vấn với hai nguyên $a, b$ ($a \leq b$).

Dữ liệu ra

Mỗi trong $Q$ truy vấn $(a,b)$ in một dòng ba số: số cô đánh số $a \ldots b$ giống Holsteins ($1$), Guernseys ($2$), Jerseys ($3$), theo thứ tự ấy.

Ví dụ

Dữ liệu vào 1

6 3
2
1
1
3
2
1
1 6
3 3
2 4

Dữ liệu ra 1

3 2 1
1 0 0
2 0 1

Tác giả bài toán: Nick Wu

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.