CF2175A.Little Fairy's Painting

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The little fairy has a ribbon with 101810^{18} cells and an infinite variety of colors. The first nn cells of the ribbon have already been colored, where the ii-th cell is colored with color aia_i.

Little fairy will color the remaining cells in order from n+1n+1 to 101810^{18}. For the ii-th cell:

  • Little fairy first counts the number of distinct colors currently present on the ribbon, denoted as cic_i.
  • Then she will color the ii-th cell with color cic_i.

What color will the fairy use for the 101810^{18}-th cell?

小精灵有一条包含 101810^{18} 个格子的丝带,以及无限多种颜色。丝带的前 nn 个格子已被染色,其中第 ii 个格子的颜色为 aia_i。

小精灵将按顺序从第 n+1n+1 个格子开始,一直染到第 101810^{18} 个格子。对于第 ii 个格子:

  • 小精灵首先统计当前丝带上不同颜色的总数,记为 cic_i;
  • 然后她将第 ii 个格子染成颜色 cic_i。

请问:第 101810^{18} 个格子会被染成什么颜色?

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤5001 \le t \le 500). The description of the test cases follows.

The first line of each test case contains a single integer nn (1≤n≤1001 \le n \le 100) — the number of colored cells.

The second line of each test case contains nn integers a1,a2,…,ana_1,a_2,\ldots,a_n (1≤ai≤1031 \le a_i \le 10^3) — the colors of the cells.

每个测试包含多个测试用例。第一行包含测试用例的数量 tt(1≤t≤5001 \le t \le 500)。随后是各测试用例的描述。

每个测试用例的第一行包含一个整数 nn(1≤n≤1001 \le n \le 100)—— 有色单元格的数量。

每个测试用例的第二行包含 nn 个整数 a1,a2,…,ana_1,a_2,\ldots,a_n(1≤ai≤1031 \le a_i \le 10^3)—— 各单元格的颜色。

输出格式

For each test case, print the color of the last cell.

对于每个测试用例,输出最后一个单元格的颜色。

输入输出样例

  • 输入#1

    5
    6
    1 1 1 1 1 1
    1
    1000
    5
    8 10 15 20 25
    8
    2 5 2 4 1 2 5 3
    6
    40 4 1 95 8 40

    输出#1

    1
    1000
    8
    5
    8

说明/提示

In the first example, each time there is only one distinct color on the ribbon, so the fairy always chooses the color 11.

In the second example, the fairy will color the next 10001000 cells with colors from 11 to 10001000 sequentially, after that all next cells will be colored with color 10001000.

在第一个例子中,每次丝带上只有一种不同的颜色,因此小精灵总是选择颜色 11。

在第二个例子中,小精灵将依次用颜色 11 到 10001000 为接下来的 10001000 个格子着色,此后所有后续格子都将被着色为颜色 10001000。

输入解题思路,AI测评打分。不知道怎么写?

首页