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

17529번 - Artwork 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 (추가 시간 없음) 512 MB103504548.387%

문제

The Mona Dura is one of the most valuable artworks in Nlogonia Museum. The famous painting is displayed in a rectangular room of M by N meters. The room entrance is in a corner of it, while the Mona is in the corner diagonally opposite to the entrance.

To prevent theft, the room has motion sensors that are activated every night when the museum closes. Each sensor has a sensitivity S, such that the sensor triggers an alarm if it detects any movement at no more than S meters from its location.

Tonight a thief broke into the museum with the purpose to steal the Mona Dura. To achieve his goal, the thief needs to enter the room and reach the painting without being detected by any of the motion sensors, that is, he must keep a distance longer to Si meters from the i-th motion sensor all the time, for all the sensors.

The thief has access to the plants of the museum, therefore, he knows the size of the room, the coordinates, and the sensitivities of each of the motion sensors. Given this information, your task is to determine if it is possible for the thief to steal the Mona Dura.

입력

The first line of input contains three integer numbers, M, N, and K, representing the size of the room, and the number of sensors, respectively. (10 ≤ M, N ≤ 104, 1 ≤ K ≤ 1000). The entrance to the room is located at position (0, 0), and the painting at position (M, N).

Each of the next K lines describes one of the K sensors, it contains three integer numbers, X, Y, and S, where (X, Y ) represents the sensors location and S represents the sensor’s sensitivity. (0 < X < M, 0 < Y < N, 0 < S ≤ 104). All dimensions and coordinates in the input are in meters. It is guaranteed that all sensors have different coordinates.

출력

Your program must output a single line containing the character ‘S’ in case the painting can be stolen, or the character ‘N’ otherwise.

제한

예제 입력 1

10 22 2
4 6 5
6 16 5

예제 출력 1

S

예제 입력 2

10 10 2
3 7 4
5 4 4

예제 출력 2

N

예제 입력 3

100 100 3
40 50 30
5 90 50
90 10 5

예제 출력 3

S

힌트

출처

ICPC > Regionals > Latin America > Sub-Regional Brasil do ACM ICPC > Maratona de Programação SBC 2019 A번

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

출처

대학교 대회

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

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