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

J5. Beams of Light

Unrated 레이팅 미적용
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Along one wall of a parking garage there are identical parking spots
numbered from \(1\) to \(N\). A collection of lights illuminates the
parking garage. Each light shines on some number of adjacent parking
spots.

You will be questioned about the parking spots. For each parking spot
you are questioned about, your job is to determine whether or not it is
illuminated by at least one light.

제약

\(1 \leq P_i \leq N\)
\(0 \leq S_i \leq N\)

입력 형식

The first line of input contains a positive integer, \(N\), representing the number of parking
spots. The second line contains a non-negative integer, \(L\), representing the number of lights. The
third line contains a positive integer, \(Q\), representing the number of parking
spots you will be questioned about.

The next \(L\) lines provide
information about the \(L\) lights.
Line \(i\) will contain two integers,
\(P_i\) and \(S_i\), separated by a single space. The
first integer, \(1 \leq P_i \leq N\),
represents the number of the parking spot above which a light is hung.
The second integer, \(0 \leq S_i \leq N\), represents the spread of the light's beam. Light \(i\) shines on the parking spot that is
directly below it. It also shines on the \(S_i\) parking spots located on either side,
unless there are fewer than \(S_i\)
spots on a side, in which case all the spots on that side will be
illuminated. There could be more than one light directly above a parking
spot.

The next \(Q\) lines of input each
contain a positive integer between \(1\) and \(N\) inclusive, representing the number of
the parking spot you are questioned about.

출력 형식

There will be one line of output for each of the \(Q\) parking spots you are questioned
about.

On each of these lines, output Y if the corresponding
parking spot is illuminated by at least one light, or N if
the corresponding parking spot is not illuminated by any light.

서브태스크
서브태스크점수설명

1

6점

\(N \leq 50\)\(L \leq 1\)\(Q \leq 50\)

2

13점

\(N \leq 50\)\(L \leq 50\)\(Q \leq 50\)

3

20점

\(N \leq 50\)\(L \leq 500\,000\)\(Q \leq 500\,000\)

4

61점

\(N \leq 500\,000\)\(L \leq 500\,000\)\(Q \leq 500\,000\)

예제 1
입력
10
3
4
8 0
1 1
4 2
4
10
7
1
출력
Y
N
N
Y
설명

The input describes the following picture of the parking garage.

Parking spots (4) and (1) are illuminated by at least one
light.

Parking spots (10) and (7) are not illuminated by any light.

문제 정보

생성자가 기록되지 않았습니다.

출처 CCC 2026 Junior

평가 및 의견

J5. Beams of Light

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

J5. Beams of Light

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