QOJ.ac

QOJ

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

#21143. ספירת גזעים

Statistics

$N$ הפרות של Farmer John, ממוספרות $1 \ldots N$, עומדות בשורה (בתדירות כזו שכמעט לא צריך לבקש). מזהה גזע $1$: Holsteins, $2$: Guernseys, $3$: Jerseys. ספרו כל גזע בקטעים של הסדר.

קלט

שורה ראשונה: $N$, $Q$ ($1 \leq N \leq 100,000$, $1 \leq Q \leq 100,000$).

$N$ הבאות מכילות שלם $1$, $2$ או $3$, גזע פרה לפי הסדר.

$Q$ הבאות מתארות שאילתה בשלמים $a, b$ ($a \leq b$).

פלט

לכל אחת מ־$Q$ שאילתות $(a,b)$ הדפיסו שורה עם שלושה מספרים: ספירת פרות $a \ldots b$ מסוג Holsteins ($1$), Guernseys ($2$), Jerseys ($3$), בסדר הזה.

דוגמאות

קלט 1

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

פלט 1

3 2 1
1 0 0
2 0 1

מחבר הבעיה: 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.