QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 1024 MB

#23618. ป้ายแบบประหยัด

统计

พวกเรากำลังจะทาสีป้ายแต่มีงบซื้อแผ่นฉลุตัวอักษรเพียง $k$ ตัวเท่านั้น จงอัปเดตข้อความบนป้ายให้ใช้ตัวอักษรที่แตกต่างกันเพียง $k$ ตัวโดยไม่เปลี่ยนความยาวของคำใดๆ เลย เพื่อที่เราจะสามารถแก้ไขป้ายอย่างแนบเนียนได้ในภายหลัง

problem_23618_b9a2f08858b6f3bc9138924a04eac634.png

รูปที่ A.1: ภาพประกอบของข้อมูลนำเข้าตัวอย่างที่ 1 คุณทำได้!

ข้อมูลนำเข้า

  • บรรทัดแรกของข้อมูลนำเข้าประกอบด้วยจำนวนคำ $n$ ($1 \le n \le 1000$) และจำนวนตัวอักษร $k$ ($1 \le k \le 26$)
  • บรรทัดที่สองของข้อมูลนำเข้าประกอบด้วย $n$ คำ แต่ละคำประกอบด้วยตัวอักษรละตินพิมพ์เล็กตั้งแต่ $1$ ถึง $20$ ตัว

ข้อมูลส่งออก

แสดงผลวลีที่ใช้ตัวอักษรที่แตกต่างกันไม่เกิน $k$ ตัว โดยแทนที่ตัวอักษรจากข้อความเดิมให้น้อยที่สุดเท่าที่เป็นไปได้ หากมีคำตอบที่เป็นไปได้หลายคำตอบ ให้แสดงผลคำตอบใดก็ได้

ตัวอย่าง

ข้อมูลนำเข้า 1

2 3
good luck

ข้อมูลส่งออก 1

lool lull

ข้อมูลนำเข้า 2

3 1
this is hard

ข้อมูลส่งออก 2

ssss ss ssss

ข้อมูลนำเข้า 3

1 6
impossible

ข้อมูลส่งออก 3

imbossibee

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.