eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Knigs of the Forest

Knigs of the Forest

\includegraphics{https://static.e-olymp.com/content/a6/a668c3d1cf1c621c758e44f83c5202525f39027a.jpg} All moose are knigs of the forest, but your latest moose-friend, Karl-Älgtav, is more interesting than most. In part because of his fondness of fermented blueberries, and in part because of the tribe he lives in. Each year his tribe holds a tournament to determine that year's alphamoose. The winner gets to mate with all the moose-chicks, and then permanently leaves the tribe. The pool of contenders stays constant over the years, apart from the old alpha-moose being replaced by a newcomer in each tournament. Karl-Älgtav has recently begun to wonder when it will be his turn to win all the chicks, and has asked you to help him determine this. He has supplied a list of the strength of each of the other male moose in his tribe that will compete during the next \textbf{n-1} years, along with their time of entry into the tournament. Assuming that the winner each year is the moose with greatest strength, determine when Karl-Älgtav becomes the alpha-moose. \InputFile The first line of input contains two space separated integers \textbf{k} (\textbf{1} ≤ \textbf{k} ≤ \textbf{10^5}) and \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{10^5}), denoting the size of the tournament pool and the number of years for which you have been supplied sucient information. Next is a single line describing Karl-Älgtav, containing the two integers \textbf{y} (\textbf{2011} ≤ \textbf{y} ≤ \textbf{2011+n-1}) and \textbf{p} (\textbf{0} ≤ \textbf{p} ≤ \textbf{2^31-1}). These are his year of entry into the tournament and his strength, respectively. Then follow \textbf{n+k-2} lines describing each of the other moose, in the same format as for Karl-Älgtav. \textit{Note that exactly }\textit{\textbf{k}}\textit{ of the moose will have }\textit{\textbf{2011}}\textit{ as their year of entry, and that the remaining }\textit{\textbf{n-1}}\textit{ moose will have unique years of entry.} \textit{You may assume that the strength of each moose is unique.} \OutputFile The year Karl-Älgtav wins the tournament, or unknown if the given data is insucient for determining this.
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
2 4
2013 2
2011 1
2011 3
2014 4
2012 6
Вихідні дані #1
2013
Вхідні дані #2
2 4
2011 1
2013 2
2012 4
2011 5
2014 3
Вихідні дані #2
unknown
Джерело Nordic Collegiate Programming Contest 2011