Codeforces Round 586 (Div. 1 + Div. 2)

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
1220 Codeforces Round 586 (Div. 1 + Div. 2) FINISHED False 7200 168616487 Sept. 18, 2019, 4:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 767 ) F Gardener Alex PROGRAMMING binary search data structures 2600

B'Gardener Alex loves to grow trees. We remind that tree is a connected acyclic graph on n vertices. Today he decided to grow a rooted binary tree. A binary tree is a tree where any vertex has no more than two sons. Luckily, Alex has a permutation of numbers from 1 to n which he was presented at his last birthday, so he decided to grow a tree according to this permutation. To do so he does the following process: he finds a minimum element and makes it a root of the tree. After that permutation is divided into two parts: everything that is to the left of the minimum element, and everything that is to the right. The minimum element on the left part becomes the left son of the root, and the minimum element on the right part becomes the right son of the root. After that, this process is repeated recursively on both parts. Now Alex wants to grow a forest of trees: one tree for each cyclic shift of the permutation. He is interested in what cyclic shift gives the tree of minimum depth. Unfortunately, growing a forest is a hard and long process, but Alex wants the answer right now. Will you help him? We remind that cyclic shift of permutation a_1, a_2, ldots, a_k, ldots, a_n for k elements to the left is the permutation a_{k + 1}, a_{k + 2}, ldots, a_n, a_1, a_2, ldots, a_k . First line contains an integer number n ~ (1 <= qslant n <= qslant 200 ,000) -- length of the permutation. Second line contains n integer numbers a_1, a_2, ldots, a_n ~ (1 <= qslant a_i <= qslant n) , and it is guaranteed that all numbers occur exactly one time. Print two numbers separated with space: minimum possible depth of a tree and how many elements we need to shift left to achieve this depth. The number of elements should be a number from 0 to n - 1 . If there are several possible answers, print any of them. The following picture depicts all possible trees for sample test and cyclic shifts on which they are achieved. '...

Tutorials

Codeforces Round #586 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
60803409 hos.lyric F Sept. 18, 2019, 5:20 p.m. OK D TESTS 51 233 55603200 2600
60846852 LJC00118 F Sept. 19, 2019, 12:49 p.m. OK GNU C++11 TESTS 51 31 3993600 2600
61364618 pufanyi F Sept. 27, 2019, 1:09 p.m. OK GNU C++11 TESTS 51 31 5836800 2600
60835540 msuwakow F Sept. 19, 2019, 8:50 a.m. OK GNU C++11 TESTS 51 31 5939200 2600
60833149 AutumnKite F Sept. 19, 2019, 7:51 a.m. OK GNU C++11 TESTS 51 31 14233600 2600
60827525 lzoilxy F Sept. 19, 2019, 5:04 a.m. OK GNU C++11 TESTS 51 31 23859200 2600
61329305 Victory_Defeat F Sept. 26, 2019, 2:32 p.m. OK GNU C++11 TESTS 51 31 28262400 2600
60822263 AloneKnight F Sept. 19, 2019, 1:15 a.m. OK GNU C++11 TESTS 51 46 3993600 2600
60803180 1919810 F Sept. 18, 2019, 5:19 p.m. OK GNU C++11 TESTS 51 46 5632000 2600
60929728 luhong F Sept. 20, 2019, 1:22 p.m. OK GNU C++11 TESTS 51 46 8089600 2600
60824523 lzoilxy F Sept. 19, 2019, 2:58 a.m. OK GNU C++11 TESTS 51 46 23859200 2600
61070748 dickings F Sept. 22, 2019, 12:40 p.m. OK GNU C++14 TESTS 51 61 3993600 2600
62086048 Rabbittank F Oct. 8, 2019, 1:59 a.m. OK GNU C++14 TESTS 51 62 3993600 2600
60806682 AA_love_dreamoon F Sept. 18, 2019, 5:37 p.m. OK GNU C++14 TESTS 51 62 3993600 2600
60840941 melancholic_fat_otaku F Sept. 19, 2019, 10:55 a.m. OK GNU C++14 TESTS 51 62 4812800 2600
60952837 long240808 F Sept. 20, 2019, 11:32 p.m. OK GNU C++14 TESTS 51 62 5120000 2600
60806528 I_love_chickpea F Sept. 18, 2019, 5:37 p.m. OK GNU C++14 TESTS 51 62 5632000 2600
61552146 A_root_A F Sept. 30, 2019, 12:50 p.m. OK GNU C++14 TESTS 51 77 3993600 2600
61551016 A_root_A F Sept. 30, 2019, 12:27 p.m. OK GNU C++14 TESTS 51 77 3993600 2600
60871855 atoiz F Sept. 19, 2019, 3:25 p.m. OK GNU C++14 TESTS 51 77 4300800 2600
61033404 ShinriiTin F Sept. 21, 2019, 6:37 p.m. OK GNU C++14 TESTS 51 78 4812800 2600
64185888 Gudi_99 F Nov. 4, 2019, 5:04 a.m. OK GNU C++17 TESTS 51 62 3993600 2600
61078869 user202729_ F Sept. 22, 2019, 3:34 p.m. OK GNU C++17 TESTS 51 62 4812800 2600
60816570 nikolapesic2802 F Sept. 18, 2019, 8:34 p.m. OK GNU C++17 TESTS 51 62 7168000 2600
63530903 TombRaider F Oct. 27, 2019, 6:41 a.m. OK GNU C++17 TESTS 51 77 3993600 2600
61294583 RNS_CUS F Sept. 25, 2019, 11:42 p.m. OK GNU C++17 TESTS 51 77 4812800 2600
61294270 RNS_KSB F Sept. 25, 2019, 11:21 p.m. OK GNU C++17 TESTS 51 77 4812800 2600
60822405 Benq F Sept. 19, 2019, 1:22 a.m. OK GNU C++17 TESTS 51 77 5324800 2600
63617810 kinhosz F Oct. 27, 2019, 8:31 p.m. OK GNU C++17 TESTS 51 77 5836800 2600
65782310 Eliden F Nov. 26, 2019, 8:32 p.m. OK GNU C++17 TESTS 51 77 7168000 2600
60827070 BrendanOh F Sept. 19, 2019, 4:47 a.m. OK GNU C++17 TESTS 51 77 7168000 2600
65403666 eidan F Nov. 20, 2019, 1:18 a.m. OK Haskell TESTS 51 780 139776000 2600
65403713 eidan F Nov. 20, 2019, 1:21 a.m. OK Haskell TESTS 51 795 139776000 2600
60803027 Lewin F Sept. 18, 2019, 5:18 p.m. OK Java 8 TESTS 51 155 17715200 2600
60826575 uwi F Sept. 19, 2019, 4:27 a.m. OK Java 8 TESTS 51 420 49254400 2600
64703571 dalt F Nov. 11, 2019, 3:38 p.m. OK Java 8 TESTS 51 577 104960000 2600
69402378 barakraganosungam F Jan. 23, 2020, 9:35 a.m. OK Java 8 TESTS 51 748 131584000 2600
62610810 fetetriste F Oct. 15, 2019, 9:40 a.m. OK Java 8 TESTS 51 764 146022400 2600
69468625 BiIIy F Jan. 24, 2020, 1:47 p.m. OK Java 8 TESTS 51 1325 122880000 2600
62835182 darnley F Oct. 17, 2019, 9:56 p.m. OK Kotlin TESTS 51 405 23552000 2600
60804193 darnley F Sept. 18, 2019, 5:24 p.m. OK Kotlin TESTS 51 436 20070400 2600
62835349 darnley F Oct. 17, 2019, 10:03 p.m. OK Kotlin TESTS 51 498 28979200 2600
60917180 vjudge5 F Sept. 20, 2019, 8:49 a.m. OK MS C++ TESTS 51 46 3993600 2600
62046812 guoshiyuan484 F Oct. 7, 2019, 7:49 a.m. OK MS C++ TESTS 51 218 9625600 2600
60818093 siwei F Sept. 18, 2019, 9:30 p.m. OK MS C++ 2017 TESTS 51 156 4915200 2600
60948602 ValenKof F Sept. 20, 2019, 8:15 p.m. OK Rust TESTS 51 61 10035200 2600
60948288 ValenKof F Sept. 20, 2019, 8:04 p.m. OK Rust TESTS 51 62 10854400 2600
66530437 sansen F Dec. 9, 2019, 7:31 a.m. OK Rust TESTS 51 280 25497600 2600

remove filters

Back to search problems