Universal Cup Judging System

Universal Cup

حد الوقت: 2.0 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓
الإحصائيات

Little Ika: Doo Doo Doo $\sim$.

Hyacinthia רוצה להגיע למרכז "Cloud End Ruins" Eye of Dawn כדי לחפש שלל, אך ישנן $n$ חומות החוסמות את דרכה. החומה ה-$i$ היא מעגל שמרכזו בראשית הצירים $(0, 0)$ ורדיוסו $r_i$. ישנן $k_i$ דלתות בחומה, והקואורדינטות של הדלת ה-$j$ נתונות על ידי $\left(r_i \cdot \cos\left(\frac{2\pi}{M} \cdot p_{i,j}\right), r_i \cdot \sin\left(\frac{2\pi}{M} \cdot p_{i,j}\right)\right)$. עובי החומה ורוחב הדלתות זניחים, ו-Hyacinthia אינה יכולה לעוף מעל החומות.

Hyacinthia רוצה לשאול אותך $m$ פעמים. בכל פעם היא תגיד לך את נקודת ההתחלה שלה, וعליך לענות מהו המרחק הקצר ביותר למרכז. מובטח שנקודת ההתחלה נמצאת בצד הפנימי של חומה וצמודה ממש לפני השטח של החומה.

קלט

השורה הראשונה מכילה שני מספרים שלמים $n, m$ ($2 \le n \le 2 \cdot 10^5, 1 \le m \le 2 \cdot 10^5$), המייצגים את מספר החומות ואת מספר השאילתות.

$n$ השורות הבאות מתארות כל חומה. כל שורה מתחילה בשני מספרים שלמים $r_i, k_i$ ($1 \le r_i \le 10^8, 0 \le k_i \le 2 \cdot 10^5$), המייצגים שהחומה ה-$i$ היא מעגל ברדיוס $r_i$ ויש בה $k_i$ דלתות. אחריהם מופיעים $k_i$ מספרים שלמים $p_{i,1}, p_{i,2}, \dots, p_{i,k_i}$, המייצגים שהקואורדינטות של הדלת ה-$j$ הן $\left(r_i \cdot \cos\left(\frac{2\pi}{M} \cdot p_{i,j}\right), r_i \cdot \sin\left(\frac{2\pi}{M} \cdot p_{i,j}\right)\right)$, כאשר $M = 3.6 \cdot 10^8$. מובטח כי $0 \le p_{i,1} < p_{i,2} < \dots < p_{i,k_i} < M$, $k_n = 0$, $\sum_{i=1}^n k_i \le 2 \cdot 10^5$, וכן $1 \le r_1 < r_2 < \dots < r_n \le 10^8$.

$m$ השורות הבאות מכילות כל אחת שני מספרים שלמים $t_i, q_i$, המציינים שאם Hyacinthia מתחילה מהצד הפנימי של החומה ה-$t_i$ בנקודה $\left(r_{t_i} \cdot \cos\left(\frac{2\pi}{M} \cdot q_i\right), r_{t_i} \cdot \sin\left(\frac{2\pi}{M} \cdot q_i\right)\right)$, מהו המרחק הקצר ביותר לראשית הצירים (אם לא ניתן להגיע, אנא הדפיסו "-1").

פלט

עבור כל שאילתה, הדפיסו שורה בודדת עם מספר נקודה צפה המייצג את התשובה. אם לא ניתן להגיע, הדפיסו "-1". תשובה תיחשב נכונה אם השגיאה היחסית או המוחלטת אינה עולה על $10^{-6}$ בהשוואה לתשובה התקנית.

דוגמאות

קלט 1

3 4
2 2 0 90000000
5 0
8 0
1 114514
2 0
2 180000000
3 233

פלט 1

2.0000000000
5.0000000000
7.4056093871
-1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.