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

33144번 - Jigsaw of Shadows 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.5 초 (추가 시간 없음) 2048 MB41322976.316%

문제

They finally did it! The flat-earthers managed to teleport themselves to an idealized flat world where no one can make fun of them anymore.

In this world, there is a perfectly straight, infinite road that runs along the $x$-axis. Instead of a sun, they have something more illuminating: a gigantic flashlight elevated above the road, positioned infinitely far away to the west (negative $x$-axis). This flashlight beams light at a precise angle with respect to the ground, illuminating the entire road.

There are $N$ flatlanders standing proudly at distinct positions along the road. As the light strikes each of them, it casts a shadow extending eastward (toward the positive $x$-axis).

Eager to show off their flat-world knowledge, the citizens want to calculate how much of the road is covered by their shadows. However, with shadows potentially overlapping, they need your help to figure it out. Given the positions of the flatlanders and their heights, can you calculate the total length of the road covered by their shadows?

입력

The first line contains two integers $θ$ (10ドル ≤ θ ≤ 80$) and $N$ (1ドル ≤ N ≤ 10^5 $), indicating respectively the angle of the light beams and the number of flatlanders on the road. The angle is measured in degrees, clockwise from the ground to the light beams.

Each of the next $N$ lines contains two integers $X$ (0ドル ≤ X ≤ 3 \cdot 10^5 $) and $H$ (1ドル ≤ H ≤ 1000$), indicating that a flatlander of height $H$ is located at position $X$ along the road. It is guaranteed that no two flatlanders share the same location.

출력

Output a single line with the total length of the road covered by the shadows of all flatlanders. The output must have an absolute or relative error of at most 10ドル^{-4}$.

제한

예제 입력 1

45 3
50 150
0 100
100 200

예제 출력 1

300

예제 입력 2

60 3
50 150
0 100
100 200

예제 출력 2

215.47

예제 입력 3

30 3
50 150
0 100
100 200

예제 출력 3

446.41016

힌트

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2024 J번

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

출처

대학교 대회

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

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