luogu#P4988. 重排DL
重排DL
Background
The level order in Dancing Line always feels kind of random.
Problem Description
On this day, Umaru set a new rule for the level order in Dancing Line: suppose a certain level is the -th released level, then its position satisfies , and the first released level is always placed first, i.e., .
But this clearly causes a problem: many positions will be empty levels. So Umaru added another restriction: adjust so that the -th level satisfies . Now Umaru gives , and you need to find the smallest integer that satisfies the condition.
Input Format
The first line contains three numbers .
Output Format
Output one number, representing the smallest ; if the smallest does not exist, output INF.
3 3 2
1
3 8 2
INF
Hint
For of the testdata, , .
For of the testdata, , .
For of the testdata, , .
It is guaranteed that are all positive integers.
Translated by ChatGPT 5