Cookies

TimeLimit:4500MS  MemoryLimit:524288KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
Elsa’s elder brother Eric has got n cookies in his icebox and each cookie has a special number written on it. Let’s denote the number written on the $i^{th}$ cookie by $f_i$. $f_i$ is defined as follows:

Here, divmed(x) states the median value of divisors of x. Let x has k divisors, then divmed(x) is $\lceil{k/2}\rceil^{th}$ smallest divisor. For example, divmed(100)=10, divmed(10)=2, divmed(1)=1.

One day, Eric opened the icebox and recognized that some of his cookies are missing. His sister Elsa had eaten some of them.

On the first day, she ate cookies that have multiples of $p_1$ as indexes and then, re-indexed them starting from 1 according to their original order. In the same way, she ate cookies with multiples of $p_i$ as indexes on the $i^{th}$ day and re-indexed them. If there were less than $p_i$ cookies left, she ate none of them. Elsa continued to do so for m days.

As Elsa is keen on math and Eric didn’t want to blame his sister, Eric asked her to find out the number written on the $k^{th}$ of remaining cookies.
Input
The first line of the input contains an integer T(1≤T≤60), denoting the number of test cases. The first line of each test case contains 3 positive integers n(1≤n≤$10^{10}$), m(1≤m≤$10^5$) and k(1≤k≤$10^{10}$). The next line contains m integers $p_1$,$p_2$,$ \cdots $,$p_m$ (1≤$p_i$≤$10^{10}$).
Output
For each test case, output one line containing the answer. If the $k^{th}$ cookie doesn’t exist, then output -1 in a single line.
SampleInput
2
25 5 9
3 5 8 12 10
25 5 2
3 5 8 12 10
SampleOutput
31
2
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: