Checker-Circle Property

시간 제한1초메모리 제한1024 MB

요약
원 위의 점 N개가 주어질 때, 원점을 지나는 두 수직선이 만드는 마주 보는 두 사분원호 안에 모든 점이 들어가도록 할 수 있는지 판정한다.
난이도

보통10점 중 7점

유형
기하, 투 포인터, 정렬, 완전 탐색
정답자
아직 제출이 없습니다

문제

You are given a circle centered at (0,0)(0,0) and a set of points on the circle's circumference. You need to check whether all the points lie on two quarter circles facing each other created by two perpendicular lines passing through the origin (including its bounds). If they do, the set is said to satisfy the checker-circle property.

The below illustration is an example set of points that satisfies the checker-circle property.

Determine whether a set of points PP satisfies the checker-circle property.

입력

The first line of input contains two space-separated integers: NN, denoting the number of points in the set, and RR, denoting the circle's radius. (1≤N≤200,000;1 \le N \le 200\\,000; 1≤R≤1091 \le R \le 10^9)

The ii-th of the following NN lines of input contains two space-separated integers: x_ix\_i and y_iy\_i, such that P_i=R×(x_i,y_i)x_i2+y_i2.P\_i = R\times \frac{(x\_i,y\_i)}{\sqrt{x\_i^2+y\_i^2}}. (−109≤x_i,y_i≤109;-10^9 \le x\_i,y\_i \le 10^9; (x_i,y_i)≠(0,0)(x\_i,y\_i) \ne (0,0))

Note that the set can contain two or more points with the same position.

출력

Output Yes if the set satisfies the checker-circle property and No otherwise.

힌트

(For Sogang students:) Note that this problem is an improvised version that matches the format of a problem in a general programming contest. While in the exam, the original scoring was:

  • 4040 points for Subtask 1.
  • 5555 points for Subtask 2.
  • 55 points for Subtask 3.

예제2

  1. 예제 1

    입력
    3 5
    -5 -10
    10 -5
    -5 10
    
    예상 출력
    Yes
    
  2. 예제 2

    입력
    5 5
    3 4
    4 -3
    -3 -4
    -5 0
    -3 4
    
    예상 출력
    No