Skip to main content

Practice · 5 of 5

Scoreboard

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** A contest has n participants, each with a score. Print participants in **descending score order; ties keep input order** — and for each, print name score. **Input:** Line 1: n (1 <= n <= 10^5). Next n lines: name (single word, <= 20 chars) and score s (0 <= s <= 10^9). **Output:** n lines: name score, scoreboard order. **Example:** 3 / trang 50 / binh 80 / an 50 -> binh 80 / trang 50 / an 50 (trang before an: input order).

Back to lesson: Practice: Sorting Set