QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22418. أبقار تخشى الأماكن الضيقة

Statistics

اقتنى Farmer John $N$ ($2 \le N \le 2,000$) بقرة حساسة مرقمة $1$..$N$. إنها تكره حقًا الاقتراب الشديد من الأبقار الأخرى. تكرهه كثيرًا جدًا.

سجل FJ الإحداثيين الصحيحين $X_{i}$ و$Y_{i}$ لكل بقرة $i$ ($1 \le X_{i} \le 100,000; 1 \le Y_{i} \le 100,000$).

من بين هذه الأبقار، توجد بالضبط بقرتان هما الأقرب إحداهما إلى الأخرى. يريد FJ إبعادهما قليلًا. حدد هاتين البقرتين واطبع رقميهما ($i$) بالترتيب العددي.

على سبيل المثال، انظر إلى هذا الحقل من الأبقار (معروض على شبكة آلة كاتبة تختلف نسبها قليلًا عما قد تتوقعه):

                    10 | . . . . . . . 3 . . . . .
                     9 | . 1 . . 2 . . . . . . . .
                     8 | . . . . . . . . . . . . .
                     7 | . . . . . . . . . . 4 . .
                     6 | . . . . . . 9 . . . . . .
                     5 | . 8 . . . . . . . . . . .
                     4 | . . . . . 7 . . . . . . .
                     3 | . . . . . . . . . 5 . . .
                     2 | . . . . . . . . . . . . .
                     1 | . . . . 6 . . . . . . . .
                     0 ---------------------------
                                           1 1 1 1
                       0 1 2 3 4 5 6 7 8 9 0 1 2 3

تُظهر نظرة سريعة أن البقرتين $7$ و$9$ هما الأقرب (المسافة بينهما $\mathrm{sqrt}(1*1+2*2) = \mathrm{sqrt}(5)$)، لذا سيكون الناتج 7 9 في سطر واحد (دون علامتي اقتباس بالطبع).

الإدخال

  • السطر 1: عدد صحيح واحد $N$.

  • الأسطر $2$..$N$+$1$: يحتوي السطر $i$ على إحداثيي البقرة $i$ في صورة عددين صحيحين تفصل بينهما مسافة: $X_{i}$ و$Y_{i}$.

الإخراج

  • السطر 1: رقما أقرب زوج من الأبقار (مرتّبان).

أمثلة

الإدخال 1

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

الإخراج 1

7 9

ملاحظة

كما في المثال.

مؤلف المسألة: Rob Kolstad، 2009

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.