| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 95 | 37 | 29 | 36.709% |
Busy Beaver has just learned about divisors and multiples in elementary school. Now, Busy Beaver challenges you with the following problem.
You are given a sequence $a$ of length $N$. Find any positive integer $X$ such that:
or determine that no such integer exists.
The first line contains a single integer $T$ ($1\leq T\leq 10^4$) --- the number of test cases.
The first line of each test case contains an integer $N$ ($2\le N\le 3 \cdot 10^5$) --- the length of the sequence $a$.
The second line of each test case contains $N$ integers $a_1, a_2, \dots, a_N$ ($1 \le a_i \le 10^9$).
The sum of $N$ across all test cases does not exceed $3 \cdot 10^5$.
For each test case, output a single integer --- the value of $X$, or $-1$ if no such $X$ exists.
If there are multiple valid values for $X$, you may output any of them.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 40 | The sum of $N$ across all test cases does not exceed $2000$. |
| 2 | 60 | No additional constraints. |
6 3 36 2 12 6 10 20 30 40 50 60 7 8 7 6 5 4 3 2 6 10 6 1 90 2 15 3 10 2 5 2 1 1
6 10 -1 30 10 1
In the first test case, $6$ is a divisor of $36$ and $12$, and is a multiple of $2$.
In the second test case, $10$ is a divisor of all elements, and also a multiple of $10$.
In the third test case, there is no integer that satisfies the constraints.
University > MIT > M(IT)^2 > M(IT)^2 Winter 2025-26 Tournament > Beginner Round 4번