QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 256 MB Toplam puan: 100

#22804. لغة الأبقار

İstatistikler

قلة تعرف أن الأبقار تحب ألعاب الكلمات: كلمات متقاطعة وشبكات البحث وألعاب أخرى كثيرة.

تحتاج مساعدة حاسوب لتصميمها. هناك $N$ كلمات مختلفة ($2 \le N \le 20{,}000$)، كل منها حتى 100 محرف، فقط الأحرف الصغيرة a..z.

أوجد كلمتين بأطول بادئة مشتركة: أول $C$ محارف متطابقة، و$C$ أكبر طول بين كل الأزواج. يُضمن زوج واحد على الأقل ببادئة مشتركة.

إن اشتركت أكثر من زوجين في الطول الأقصى نفسه، اختر الزوج الذي كلمته الأولى أقرب لبداية القائمة المعطاة، ثم كلمته الأخرى ذات البادئة القصوى أقرب للبداية أيضًا.

الإدخال

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

  • الأسطر $2..N+1$: كلمة بكل سطر.

الإخراج

سطران، كلمة بكل سطر.

أمثلة

الإدخال 1

9
noon
is
lunch
for
most
noone
waits
until
two

الإخراج 1

noon
noone

المصدر: Dan Adkins، 2001.

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.