102361: [AtCoder]ABC236 B - Who is missing?

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $200$ points

Problem Statement

We have $4$ cards with an integer $1$ written on it, $4$ cards with $2$, $\ldots$, $4$ cards with $N$, for a total of $4N$ cards.

Takahashi shuffled these cards, removed one of them, and gave you a pile of the remaining $4N-1$ cards. The $i$-th card $(1 \leq i \leq 4N - 1)$ of the pile has an integer $A_i$ written on it.

Find the integer written on the card removed by Takahashi.

Constraints

  • $1 \leq N \leq 10^5$
  • $1 \leq A_i \leq N \, (1 \leq i \leq 4N - 1)$
  • For each $k \, (1 \leq k \leq N)$, there are at most $4$ indices $i$ such that $A_i = k$.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$
$A_1$ $A_2$ $\ldots$ $A_{4N - 1}$

Output

Print the answer.


Sample Input 1

3
1 3 2 3 3 2 2 1 1 1 2

Sample Output 1

3

Takahashi removed a card with $3$ written on it.


Sample Input 2

1
1 1 1

Sample Output 2

1

Sample Input 3

4
3 2 1 1 2 4 4 4 4 3 1 3 2 1 3

Sample Output 3

2

Input

题意翻译

有 $4n$ 张卡片,写着数字 $1$ 到 $n$ 。每个数字都被写在 $4$ 张卡片上。现在给出其中的 $(4n-1)$ 张卡片上写的数字,请你输出剩下的那张卡片上写的数字是多少。

Output

得分:200分 部分 问题描述 我们有4张写有数字1的卡片,4张写有数字2的卡片,……,4张写有数字N的卡片,总共有4N张卡片。 高桥把这些卡片洗牌,从中抽出一张,然后把剩下的4N-1张卡片给你。这堆卡片中的第i张(1≤i≤4N-1)卡片上写有数字Ai。 找出高桥抽出的卡片上的数字。 部分 约束条件 1≤N≤10^5 1≤Ai≤N(1≤i≤4N-1) 对于每个k(1≤k≤N),最多有4个索引i使得Ai=k。 输入均为整数。 部分 输入 从标准输入以以下格式给出输入: N A1 A2 …… A4N−1 部分 输出 打印答案。 部分 样例输入1 3 1 3 2 3 3 2 2 1 1 1 2 部分 样例输出1 3 高桥抽出了一张写有3的卡片。 部分 样例输入2 1 1 1 1 部分 样例输出2 1 部分 样例输入3 4 3 2 1 1 2 4 4 4 4 3 1 3 2 1 3 部分 样例输出3 2

加入题单

算法标签: