035. Distinct Numbers

Codeforces
IDCF10269035
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
You have a list of numbers. You want to figure out how many distinct (different) numbers are in the list. For example, the list _[1, 2, 3, 4, 4, 5, 5]_ has 5 distinct numbers. The first line of input contains a single positive integer $n$: the number of items in the list. The next line contains $n$ space-separated integers: the list. Output a single positive integer $d$: the number of distinct numbers in the list. ## Input The first line of input contains a single positive integer $n$: the number of items in the list. The next line contains $n$ space-separated integers: the list. ## Output Output a single positive integer $d$: the number of distinct numbers in the list. [samples]
**Definitions** Let $ n \in \mathbb{Z}^+ $ be the number of elements in the list. Let $ A = (a_1, a_2, \dots, a_n) $ be a sequence of integers. **Constraints** $ n \geq 1 $, and $ a_i \in \mathbb{Z} $ for all $ i \in \{1, \dots, n\} $. **Objective** Compute $ d = \left| \{ a_1, a_2, \dots, a_n \} \right| $, the cardinality of the set of distinct elements in $ A $.
API Response (JSON)
{
  "problem": {
    "name": "035. Distinct Numbers",
    "description": {
      "content": "You have a list of numbers. You want to figure out how many distinct (different) numbers are in the list. For example, the list _[1, 2, 3, 4, 4, 5, 5]_ has 5 distinct numbers. The first line of input",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269035"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You have a list of numbers. You want to figure out how many distinct (different) numbers are in the list. For example, the list _[1, 2, 3, 4, 4, 5, 5]_ has 5 distinct numbers.\n\nThe first line of input...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of elements in the list.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of integers.\n\n**Constraints**  \n$ n \\geq 1 $, and $ a_i \\in \\math...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments