D. Xor Sum

Codeforces
IDCF10074D
Time1000ms
Memory4MB
Difficulty
English · Original
Formal · Original
You're given an array a with n elements. Compute the xor sum of the elements that appear an odd number of times in the array a. The first line contains number n (1 ≤ n ≤ 3000000). The second line of the input contains n numbers, representing the array a. All elements of a are between 0 and 109 The only line of the output contains the answer of the problem. ## Input The first line contains number n (1 ≤ n ≤ 3000000). The second line of the input contains n numbers, representing the array a. All elements of a are between 0 and 109 ## Output The only line of the output contains the answer of the problem. [samples]
**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 \{0, 1, \dots, 10^9\} $. Let $ f(x) $ denote the frequency of element $ x $ in $ A $. **Constraints** 1. $ 1 \leq n \leq 3 \times 10^6 $ 2. $ 0 \leq a_i \leq 10^9 $ for all $ i \in \{1, \dots, n\} $ **Objective** Compute the XOR sum of all elements $ x $ such that $ f(x) $ is odd: $$ \bigoplus_{\substack{x \in A \\ f(x) \text{ odd}}} x $$
API Response (JSON)
{
  "problem": {
    "name": "D. Xor Sum",
    "description": {
      "content": "You're given an array a with n elements.  Compute the xor sum of the elements that appear an odd number of times in the array a. The first line contains number n (1 ≤ n ≤ 3000000). The second line o",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 4096
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10074D"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You're given an array a with n elements. \n\nCompute the xor sum of the elements that appear an odd number of times in the array a.\n\nThe first line contains number n (1 ≤ n ≤ 3000000). The second line o...",
      "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 \\{0, 1, \\dots, 10^9\\} $.\n\nLet $ f(x) $ denote the...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments