CF2175A.Little Fairy's Painting
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The little fairy has a ribbon with 1018 cells and an infinite variety of colors. The first n cells of the ribbon have already been colored, where the i-th cell is colored with color ai.
Little fairy will color the remaining cells in order from n+1 to 1018. For the i-th cell:
- Little fairy first counts the number of distinct colors currently present on the ribbon, denoted as ci.
- Then she will color the i-th cell with color ci.
What color will the fairy use for the 1018-th cell?
小精灵有一条包含 1018 个格子的丝带,以及无限多种颜色。丝带的前 n 个格子已被染色,其中第 i 个格子的颜色为 ai。
小精灵将按顺序从第 n+1 个格子开始,一直染到第 1018 个格子。对于第 i 个格子:
- 小精灵首先统计当前丝带上不同颜色的总数,记为 ci;
- 然后她将第 i 个格子染成颜色 ci。
请问:第 1018 个格子会被染成什么颜色?
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t (1≤t≤500). The description of the test cases follows.
The first line of each test case contains a single integer n (1≤n≤100) — the number of colored cells.
The second line of each test case contains n integers a1,a2,…,an (1≤ai≤103) — the colors of the cells.
每个测试包含多个测试用例。第一行包含测试用例的数量 t(1≤t≤500)。随后是各测试用例的描述。
每个测试用例的第一行包含一个整数 n(1≤n≤100)—— 有色单元格的数量。
每个测试用例的第二行包含 n 个整数 a1,a2,…,an(1≤ai≤103)—— 各单元格的颜色。
输出格式
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 1.
In the second example, the fairy will color the next 1000 cells with colors from 1 to 1000 sequentially, after that all next cells will be colored with color 1000.
在第一个例子中,每次丝带上只有一种不同的颜色,因此小精灵总是选择颜色 1。
在第二个例子中,小精灵将依次用颜色 1 到 1000 为接下来的 1000 个格子着色,此后所有后续格子都将被着色为颜色 1000。
输入解题思路,AI测评打分。不知道怎么写?