#P4688. [Ynoi Easy Round 2016] 掉进兔子洞
[Ynoi Easy Round 2016] 掉进兔子洞
Description
You are playing a galgame, and suddenly realize you have been slacking off too much today, so you want to write a data structure problem to practice:
There is a sequence of length .
There are queries. Each query gives three intervals. For numbers that appear in all three intervals, delete them one by one. Ask for the sum of the counts of remaining numbers in the three intervals at the end. Queries are independent.
Note that “delete” means deleting one by one, not deleting all elements equal to that value at once. For example, if the three intervals are , , and , then we throw away occurrence of , occurrence of , and occurrences of together.
Input Format
The first line contains two integers .
The second line contains integers denoting .
Then follow lines. Each line contains integers describing the three intervals.
Output Format
For each query, output one integer denoting the answer.
5 2
1 2 2 3 3
1 2 2 3 3 4
1 5 1 5 1 5
3
0
Hint
Idea: nzhtl1477, Solution: nzhtl1477, Code: nzhtl1477, Data: nzhtl1477
, , , , , 。
Translated by ChatGPT 5
京公网安备 11011102002149号