Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
---|---|---|---|---|---|---|
1322 | Codeforces Round 626 (Div. 1, based on Moscow Open Olympiad in Informatics) | FINISHED | False | 7200 | 148249499 | March 7, 2020, 9:35 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 304 ) | E | Median Mountain Range | PROGRAMMING | data structures |
B'Berland -- is a huge country with diverse geography. One of the most famous natural attractions of Berland is the "Median mountain range". This mountain range is n mountain peaks, located on one straight line and numbered in order of 1 to n . The height of the i -th mountain top is a_i . "Median mountain range" is famous for the so called alignment of mountain peaks happening to it every day. At the moment of alignment simultaneously for each mountain from 2 to n - 1 its height becomes equal to the median height among it and two neighboring mountains. Formally, if before the alignment the heights were equal b_i , then after the alignment new heights a_i are as follows: a_1 = b_1 , a_n = b_n and for all i from 2 to n - 1 a_i = texttt{median}(b_{i-1}, b_i, b_{i+1}) . The median of three integers is the second largest number among them. For example, texttt{median}(5,1,2) = 2 , and texttt{median}(4,2,4) = 4 . Recently, Berland scientists have proved that whatever are the current heights of the mountains, the alignment process will stabilize sooner or later, i.e. at some point the altitude of the mountains won 't changing after the alignment any more. The government of Berland wants to understand how soon it will happen, i.e. to find the value of c -- how many alignments will occur, which will change the height of at least one mountain. Also, the government of Berland needs to determine the heights of the mountains after c alignments, that is, find out what heights of the mountains stay forever. Help scientists solve this important problem! The first line contains integers n ( 1 <= n <= 500 ,000 ) -- the number of mountains. The second line contains integers a_1, a_2, a_3, ldots, a_n ( 1 <= a_i <= 10^9 ) -- current heights of the mountains. In the first line print c -- the number of alignments, which change the he'... |
Codeforces Round #626 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
72651847 | zhouyuyang | E | March 7, 2020, 10:59 a.m. | OK | GNU C++11 | TESTS | 146 | 1465 | 90521600 | ||
72697798 | WZYYN | E | March 8, 2020, 1:16 a.m. | OK | GNU C++11 | TESTS | 146 | 1481 | 90521600 | ||
72646344 | tlwpdus | E | March 7, 2020, 10:35 a.m. | OK | GNU C++14 | TESTS | 146 | 1278 | 168345600 | ||
72663863 | mayaohua2003 | E | March 7, 2020, 1:01 p.m. | OK | GNU C++14 | TESTS | 146 | 1419 | 44646400 | ||
72654927 | yhx-12243 | E | March 7, 2020, 11:15 a.m. | OK | GNU C++14 | TESTS | 146 | 1980 | 58368000 | ||
72662345 | mnbvmar | E | March 7, 2020, 12:41 p.m. | OK | GNU C++17 | TESTS | 146 | 358 | 88678400 | ||
72661386 | mnbvmar | E | March 7, 2020, 12:29 p.m. | OK | GNU C++17 | TESTS | 146 | 483 | 88678400 | ||
72697356 | Benq | E | March 8, 2020, 12:54 a.m. | OK | GNU C++17 | TESTS | 146 | 1247 | 29491200 | ||
72662000 | maroonrk | E | March 7, 2020, 12:36 p.m. | OK | GNU C++17 | TESTS | 146 | 1247 | 36556800 | ||
72668863 | Shayan.P | E | March 7, 2020, 2:15 p.m. | OK | GNU C++17 | TESTS | 146 | 1450 | 37273600 | ||
72673440 | I_love_chickpea | E | March 7, 2020, 3:33 p.m. | OK | GNU C++17 | TESTS | 146 | 1606 | 72192000 | ||
72673282 | I_love_chickpea | E | March 7, 2020, 3:31 p.m. | OK | GNU C++17 | TESTS | 146 | 1653 | 72192000 | ||
72668764 | Shayan.P | E | March 7, 2020, 2:14 p.m. | OK | GNU C++17 | TESTS | 146 | 1684 | 41369600 | ||
72673480 | I_love_chickpea | E | March 7, 2020, 3:34 p.m. | OK | GNU C++17 | TESTS | 146 | 1747 | 72192000 | ||
72673505 | I_love_chickpea | E | March 7, 2020, 3:35 p.m. | OK | GNU C++17 | TESTS | 146 | 1855 | 72192000 |
Back to search problems