Universal Cup Judging System

Universal Cup

Limite de temps : 3.0 s Limite de mémoire : 1024 MB Points totaux : 100
Statistiques

يوجد رسم بياني غير موجه يحتوي على $n$ رؤوس و $m$ أضلاع. لا يحتوي الرسم البياني على حلقات ذاتية أو أضلاع متوازية، وليس بالضرورة متصلاً. الرؤوس مرقمة من $1$ إلى $n$.

توجد $q$ استعلامات. كل استعلام عبارة عن زوج $(x, y)$. عليك تحديد ما إذا كانت المسافة بين $x$ و $y$ أكبر تماماً من $20\,000$ أم لا.

المسافة بين رأسين هي عدد الأضلاع في أقصر مسار بينهما. إذا لم يكن هناك مسار بينهما، فتُعتبر المسافة $+\infty > 20\,000$.

المدخلات

يحتوي السطر الأول على ثلاثة أعداد صحيحة $n$ و $m$ و $q$ ($1 \le n \le 10^5$، $0 \le m \le 3 \cdot 10^5$، $1 \le q \le 3 \cdot 10^5$).

ثم تليها $m$ أسطر، يحتوي كل منها على عددين صحيحين $u_i$ و $v_i$ يمثلان الأضلاع ($1 \le u_i < v_i \le n$، لا يتطابق ضلعان).

بعد ذلك تليها $q$ أسطر، يحتوي كل منها على عددين صحيحين $x_i$ و $y_i$ ($1 \le x_i, y_i \le n$، قد يتطابق $x_i$ و $y_i$).

المخرجات

اطبع $q$ أسطر، في كل منها إما "YES" أو "NO": الإجابات على الاستعلامات.

مثال

مدخلات المثال 1

10 5 10
1 2
1 7
3 10
4 10
5 6
3 3
5 6
5 2
10 6
9 4
6 6
1 7
10 1
10 5
8 7

مخرجات المثال 1

NO
NO
YES
YES
YES
NO
NO
YES
YES
YES

ملاحظة

في المثال، يوجد $10$ رؤوس فقط في الرسم البياني، لذا فإننا نتحقق فعلياً مما إذا كان الرأسان يقعان في مكونين متصلين مختلفين أم لا.

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.