135. Anti-sort

Codeforces
IDCF10269135
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
You're given a list of $n$ words. You've discovered that when a rival CodeQuest team finds a list of words, they sort it in alphabetical order. To distinguish yourself from your rival CodeQuest team, you decide to sort the list of words in reverse order. The first line of input contains a single positive integer $n$: the number of words. The next $n$ lines each contain a single word, consisting only of lowercase letters Output $n$ lines: the list of words, sorted in reverse alphabetical order. ## Input The first line of input contains a single positive integer $n$: the number of words.The next $n$ lines each contain a single word, consisting only of lowercase letters ## Output Output $n$ lines: the list of words, sorted in reverse alphabetical order. [samples]
**Definitions** Let $ n \in \mathbb{Z}^+ $ be the number of words. Let $ W = (w_1, w_2, \dots, w_n) $ be a sequence of words, where each $ w_i \in \Sigma^* $ and $ \Sigma = \{a, b, \dots, z\} $. **Constraints** 1. $ 1 \leq n \leq \infty $ (implicit from input format) 2. Each word $ w_i $ consists solely of lowercase Latin letters. **Objective** Output the sequence $ W $ sorted in reverse alphabetical order, i.e., descending lexicographical order: $$ w_{\sigma(1)} \geq w_{\sigma(2)} \geq \dots \geq w_{\sigma(n)} $$ where $ \sigma $ is a permutation of $ \{1, 2, \dots, n\} $ such that the sequence is non-increasing under lexicographic comparison.
API Response (JSON)
{
  "problem": {
    "name": "135. Anti-sort",
    "description": {
      "content": "You're given a list of $n$ words. You've discovered that when a rival CodeQuest team finds a list of words, they sort it in alphabetical order. To distinguish yourself from your rival CodeQuest team, ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269135"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You're given a list of $n$ words. You've discovered that when a rival CodeQuest team finds a list of words, they sort it in alphabetical order. To distinguish yourself from your rival CodeQuest team, ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of words.  \nLet $ W = (w_1, w_2, \\dots, w_n) $ be a sequence of words, where each $ w_i \\in \\Sigma^* $ and $ \\Sigma = \\{a, b, \\dots, z\\} $.\n\n...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments