RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0605

Maximizing Productivity

Silver IV 실버 IV
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

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\).

Problem credits: Chongtian Ma

제약

SCORING

  • Inputs 2-4: \(N,Q\le 10^3\)
  • Inputs 5-9: \(c_i, t_i \le 20\)
  • Inputs 10-17: No additional constraints.

Problem credits: Chongtian Ma

입력 형식

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
출력
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.

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2023-2024 > February > Bronze

태그

평가 및 의견

Maximizing Productivity

개요
출제자 난이도 Silver IV 실버 IV 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Maximizing Productivity

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8