| IPL 2026 |
|---|
| Закончено |
You just finished an exam with $$$M$$$ questions where your score is the number of questions answered correctly. You know the scores of $$$n$$$ students in the class, your own, as well as some of your friends. The professor then announces the range of scores on the exam — the difference between the maximum score and the minimum score among all students in the class.
Since you have not been attending lectures, you do not know how many students are taking the class other than your friends. Determine the minimum total class size consistent with your information, or report that it is impossible.
The first line contains three integers $$$n$$$, $$$M$$$, $$$D$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le M \le 10^9$$$, $$$0 \le D \le M$$$) — the number of students whose scores you know (including yourself), the number of questions, and the announced range.
The second line contains $$$n$$$ integers $$$s_1, s_2, \ldots, s_n$$$ ($$$0 \le s_i \le M$$$) — the known scores.
Print a single integer — the minimum total class size consistent with all given information. If no valid class exists, print impossible.
2 100 7510 70
3
2 100 5010 90
impossible
3 100 8010 50 90
3
| Название |
|---|


