點下面的連結可以看美美的題目:
https://drive.google.com/file/d/1oHrVfAkhGMLuxNOpZscWNy4HX7ejm4GZ/view?usp=sharing
Capoo owns a street on which $N$ buildings lie in a row. The buildings are numbered $1$ to $n$ from left to right, and the $i$-th one has height $A_i$.
While taller buildings give more profit, they’ve got a major downside: the city’s view may get obstructed by them. Since Capoo likes to take afternoon walks on his street, he does not wish that the buildings are too tall, or they might block the awesome scenery of the city.
Capoo has planned his walks for the next $M$ days. On the $j$-th day, he will start from the $L_j$-th building, walk right to the $R_j$-th one, and admire the sublime views while walking. The “satisfiability” of the walk he will gain on day $j$ is given by the number of buildings between the $L_j$-th and the $R_j$-th one (inclusive) with height not greater than $K_j$.
Given the plans, Capoo wants to know the satisfiability for each day in advance. However, since he is not good at solving these type of problems (he always falls asleep during algorithm classes), he wants you to write a program to help him.
翻譯:
給定$1$~$n$每個點的高度,多次詢問某個$[L,R]$區間高度不大於$K$的點有幾個。
The first line consists of two integers $N$ and $M$, the amount of buildings and days Capoo has a plan for. On the second line there are $N$ numbers $ A_1 A_2 ... A_N $ describing the buildings’ height. Then M lines follow: on the $j$-th line there are three integers $ L_j R_j K_j$ describing the walk on day $j$.
• $1≤M, N, A_i , K_i≤2×10^5$
• $1≤L_i≤R_i≤N$
Output $M$ lines, on the $j$-th line print an integer: the satisfiability of the walk on day $j$.
5 3 1 2 3 2 4 1 5 5 1 4 2 2 4 2
5 3 2
為什麼Latex編輯右邊會出現一條線!?
如果誰會解決可以教教我QQ
編號 | 身分 | 題目 | 主題 | 人氣 | 發表日期 |
110 |
211096@stu.c...
(唐狗針)
|
a127 | 62 | 2024-10-19 16:02 | |
33 |
911091@stu.c...
(17莊明達 David)
|
a127 | 234 | 2023-04-17 08:39 |