QOJ.ac

QOJ

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

#21143. Liczenie ras

Statistics

$N$ krów Farmer John o numerach $1 \ldots N$ stoi w rzędzie (tak często, że wystarczy mała zachęta). Rasa $1$: Holsteins, $2$: Guernseys, $3$: Jerseys. Policz każdą rasę w przedziałach rzędu.

Wejście

Pierwszy wiersz: $N$, $Q$ ($1 \leq N \leq 100,000$, $1 \leq Q \leq 100,000$).

Następne $N$ zawierają całkowite $1$, $2$ lub $3$, rasę każdej krowy po kolei.

Następne $Q$ opisują zapytanie dwiema całkowitymi $a, b$ ($a \leq b$).

Wyjście

Dla każdego z $Q$ zapytań $(a,b)$ wypisz trzy liczby w wierszu: liczby krów $a \ldots b$ ras Holsteins ($1$), Guernseys ($2$), Jerseys ($3$), w tej kolejności.

Przykład

Wejście 1

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

Wyjście 1

3 2 1
1 0 0
2 0 1

Autor zadania: 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.