#P3997. [SHOI2013] 扇形面积并

    ID: 2927 远端评测题 1000ms 250MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2013线段树各省省选递归上海O2优化排序

[SHOI2013] 扇形面积并

Description

Given nn concentric sectors, find how much area is covered by at least kk sectors.

Input Format

The first line contains three integers nn, mm, kk. Here, nn is the number of concentric sectors, and mm means the angle interval (π,π](-\pi, \pi] is evenly divided into 2m2m parts.

From the second line, each of the next nn lines contains three integers r,a1,a2r, a_1, a_2. Each line describes a sector centered at the origin with radius rr, whose central angle ranges from radians π×a1m\pi \times \frac{a_1}{m} to π×a2m\pi \times \frac{a_2}{m} (a1a_1 is not necessarily less than a2a_2).

Output Format

Output an integer ansans, such that π2m×ans\frac{\pi}{2m} \times ans equals the total area covered by at least kk sectors.

It is guaranteed that the answer is within the range 26312^{63} - 1.

3 8 2
1 -8 8
3 -7 3
5 -5 5
76
2 4 1
4 -4 2
1 -4 4
98

Hint

For 100%100\% of the testdata, 1n1051 \le n \le 10^5, 1m1061 \le m \le 10^6, 1k50001 \le k \le 5000, 1ri1051 \le r_i \le 10^5, ma1,a2m-m \le a_1, a_2 \le m.

Translated by ChatGPT 5