Logo
(追記) (追記ここまで)

31650번 - Maximizing Productivity 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB65426520541.082%

문제

Farmer John has $N$ (1ドル \leq N \leq 2 \cdot 10^5$) farms, numbered from 1ドル$ to $N$. It is known that FJ closes farm $i$ at time $c_i$. Bessie wakes up at time $S,ドル and wants to maximize the productivity of her day by visiting as many farms as possible before they close. She plans to visit farm $i$ on time $t_i + S$. Bessie must arrive at a farm strictly before Farmer John closes it to actually visit it.

Bessie has $Q$ $(1 \leq Q \leq 2 \cdot 10^5)$ queries. For each query, she gives you two integers $S$ and $V$. For each query, output whether Bessie can visit at least $V$ farms if she wakes up at time $S$.

입력

The first line consists of $N$ and $Q$.

The second line consists of $c_1, c_2, c_3 \dots c_N$ (1ドル \leq c_i \leq 10^6$).

The third line consists of $t_1, t_2, t_3 \dots t_N$ (1ドル \leq t_i \leq 10^6$).

The next $Q$ lines each consist of two integers $V$ (1ドル \leq V \leq N$) and $S$ (1ドル \leq S \leq 10^6$).

출력

For each of the $Q$ queries, output YES or NO on a new line.

제한

예제 입력 1

5 5
3 5 7 9 12
4 2 3 3 8
1 5
1 6
3 3
4 2
5 1

예제 출력 1

YES
NO
YES
YES
NO

For the first query, Bessie will visit the farms at time $t = [9, 7, 8, 8, 13],ドル so she will only get to visit farm 4ドル$ on time before FJ closes the farm.

For the second query, Bessie will not be able to visit any of the farms on time.

For the third query, Bessie will visit farms 3,ドル 4, 5$ on time.

For the fourth and fifth queries, Bessie will be able to visit all but the first farm on time.

힌트

출처

Olympiad > USA Computing Olympiad > 2023-2024 Season > USACO 2024 February Contest > Bronze 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /