#P6180. [USACO15DEC] Breed Counting S
[USACO15DEC] Breed Counting S
Description
Farmer John has cows, numbered from from left to right, standing in a line.
All cows belong to one of three breeds, and each cow has a breed ID (only one of ). FJ has queries, and each query asks for the number of cows of each breed within a certain interval.
Input Format
The first line contains two integers ().
The next lines each contain one integer. The -th integer represents the breed ID of the -th cow.
The next lines each contain two integers , meaning the range of the -th query is .
Output Format
For each query, output three integers: the number of breed cows, the number of breed cows, and the number of breed cows in the specified interval.
6 3
2
1
1
3
2
1
1 6
3 3
2 4
3 2 1
1 0 0
2 0 1
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号