ЃҐбЁ ЁЈа Ґв ў ЁЈаг.
€Ја зЁ Ґвбп б Ї®б«Ґ¤®ў ⥫м®бвЁ Ё§ \(N\) Ї®«®¦ЁвҐ«мле 楫ле зЁбҐ«
(\(2 \leq N \leq 262,144\)), Є ¦¤®Ґ ў ¤Ё Ї §®Ґ \(0 \ldots 40\). ‡ ®¤Ё 室 ЃҐбЁ ¬®¦Ґв
‚§пвм ¤ў б®бҐ¤Ёе а ўле зЁб« Ё § ¬ҐЁвм Ёе зЁб«® 1 Ў®«миҐ ( ЇаЁ¬Ґа, ® ¬®¦Ґв § ¬ҐЁвм ¤ўҐ б®бҐ¤ЁҐ 7 ®¤г 8). –Ґ«м ЁЈал - ¬ ЄбЁ¬Ё§Ёа®ў вм § 票Ґ б ¬®Ј® Ў®«ми®Ј® зЁб« , Є®в®а®Ґ ® ¬®¦Ґв Ї®«гзЁвм. Џ®¬®ЈЁвҐ Ґ©.
”ЋђЊЂ’ ‚‚Ћ„Ђ (д ©« 262144.in):
ЏҐаў п бва®Є ўў®¤ ᮤҐа¦Ёв \(N\), б«Ґ¤гойЁҐ \(N\) бва®Є § ¤ ов Ї®б«Ґ¤®ў ⥫м®бвм Ё§ \(N\) зЁбҐ«, б Є®в®але зЁ Ґвбп ЁЈа .
”ЋђЊЂ’ ‚›‚Ћ„Ђ (д ©« 262144.out):
‚뢥¤ЁвҐ ЁЎ®«м襥 зЁб«®, Є®в®а®Ґ ЃҐбЁ ¬®¦Ґв бЈҐҐаЁа®ў вм
Џђ€Њ…ђ ‚‚Ћ„Ђ:
4
1
1
1
2
Џђ€Њ…ђ ‚›‚Ћ„Ђ:
3
‚ ЇаЁ¬ҐаҐ ЃҐбЁ б з « б«Ёў Ґв ўв®аго Ё ваҐвмо 1 Ё Ї®«гз Ґв Ї®б«Ґ¤®ў ⥫м®бвм 1 2 2 , § ⥬ б«Ёў Ґв ¤ўҐ ¤ў®©ЄЁ ў 3. ‡ ¬ҐвЁ¬, зв® Ґ ®ЇвЁ¬ «м® б«Ёў вм ЇҐаўлҐ ¤ўҐ Ґ¤ЁЁжл.
Ђўв®а: Mark Chen
Bessie likes downloading games to play on her cell phone, even though she does
find the small touch screen rather cumbersome to use with her large hooves.
She is particularly intrigued by the current game she is playing. The game
starts with a sequence of \(N\) positive integers (\(2 \leq N \leq 262,144\)), each
in the range \(0 \ldots 40\). In one move, Bessie can take two adjacent numbers
with equal values and replace them a single number of value one greater (e.g.,
she might replace two adjacent 7s with an 8). The goal is to maximize the value
of the largest number she can create. Please help Bessie score as highly as
possible!
Формат входных данных:
The first line of input contains \(N\), and the next \(N\) lines give the sequence
of \(N\) numbers at the start of the game.
Формат выходных данных:
Please output the largest integer Bessie can generate.