1. Unique Elements

Codeforces
IDCF102891
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
You have an array of $n$ integers, and you want to find how many unique elements it has. An element is _unique_ if it only appears once in the array. For example, the array $[ 5, 7, 8, 5, 4, 4, 3 ]$ contains 3 unique elements: $7$, $8$, and $3$. $5$ is not a unique element, since it occurs twice in the array. The first line of input contains a single positive integer $n$ $(1 < = n < = 200000)$: the length of the array. The next line contains $n$ space-separated integers: the array. The array elements will be between $1$ and $10^9$, inclusive. Output a single positive integer: the number of unique elements in the array. Full problem: 5 points ## Input The first line of input contains a single positive integer $n$ $(1 < = n < = 200000)$: the length of the array.The next line contains $n$ space-separated integers: the array. The array elements will be between $1$ and $10^9$, inclusive. ## Output Output a single positive integer: the number of unique elements in the array. [samples] ## Scoring Full problem: 5 points
**Definitions** Let $ n \in \mathbb{Z} $ be the length of the array. Let $ A = (a_1, a_2, \dots, a_n) $ be a sequence of integers, where $ a_i \in [1, 10^9] $ for all $ i \in \{1, \dots, n\} $. **Constraints** $ 1 \leq n \leq 200000 $ **Objective** Compute the number of elements in $ A $ that appear exactly once: $$ \left| \left\{ a_i \in A \mid \text{freq}_A(a_i) = 1 \right\} \right| $$ where $ \text{freq}_A(x) $ denotes the number of occurrences of $ x $ in $ A $.
API Response (JSON)
{
  "problem": {
    "name": "1. Unique Elements",
    "description": {
      "content": "You have an array of $n$ integers, and you want to find how many unique elements it has. An element is _unique_ if it only appears once in the array. For example, the array $[ 5, 7, 8, 5, 4, 4, 3 ]$ ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF102891"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You have an array of $n$ integers, and you want to find how many unique elements it has. An element is _unique_ if it only appears once in the array.\n\nFor example, the array $[ 5, 7, 8, 5, 4, 4, 3 ]$ ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the length of the array.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of integers, where $ a_i \\in [1, 10^9] $ for all $ i \\in \\{1, \\dots, n\\} $.\n\n*...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments