Codeforces Round 826 (Div. 3)

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
1741 Codeforces Round 826 (Div. 3) FINISHED False 8100 71681063 Oct. 11, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 15661 ) D Masha and a Beautiful Tree PROGRAMMING dfs and similar divide and conquer graphs sortings trees

B"The girl named Masha was walking in the forest and found a complete binary tree of height n and a permutation p of length m=2^n . A complete binary tree of height n is a rooted tree such that every vertex except the leaves has exactly two sons, and the length of the path from the root to any of the leaves is n . The picture below shows the complete binary tree for n=2 . A permutation is an array consisting of n different integers from 1 to n . For example, [ 2,3,1,5,4 ] is a permutation, but [ 1,2,2 ] is not ( 2 occurs twice), and [ 1,3,4 ] is also not a permutation ( n=3 , but there is 4 in the array). Let's enumerate m leaves of this tree from left to right. The leaf with the number i contains the value p_i ( 1 <= i <= m ). For example, if n = 2 , p = [3, 1, 4, 2] , the tree will look like this: Masha considers a tree beautiful if the values in its leaves are ordered from left to right in increasing order. In one operation, Masha can choose any non-leaf vertex of the tree and swap its left and right sons (along with their subtrees). For example, if Masha applies this operation to the root of the tree discussed above, it will take the following form: Help Masha understand if she can make a tree beautiful in a certain number of operations. If she can, then output the minimum number of operations to make the tree beautiful. The first line contains single integer t ( 1 <= t <= 10^4 ) -- number of test cases. In each test case, the first line contains an integer m ( 1 <= m <= 262144 ), which is a power of two -- the size of the permutation p . The second line contains m integers: p_1, p_2, ... , p_m ( 1 <= p_i <= m ) -- the permutation p . It is guaranteed that the sum of m over all test cases does not exceed 3 cdot 10^5 . For each test case in a separate line, print the minimum "...

Tutorials

107908

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
175659739 Fred94 D Oct. 11, 2022, 4:47 p.m. OK C# 10 TESTS 9 109 17715200
175682434 FatalityNT D Oct. 11, 2022, 8:06 p.m. OK C# 8 TESTS 9 187 20582400
175681580 NenadDapic D Oct. 11, 2022, 7:54 p.m. OK FPC TESTS 9 62 1126400
175667650 chethan58 D Oct. 11, 2022, 5:28 p.m. OK GNU C11 TESTS 9 62 2048000
175669289 _sumukh_ D Oct. 11, 2022, 5:42 p.m. OK GNU C11 TESTS 9 78 3174400
175659380 mahmoud_sh D Oct. 11, 2022, 4:46 p.m. OK GNU C++14 TESTS 9 61 1024000
175658908 Gayathri_1261 D Oct. 11, 2022, 4:45 p.m. OK GNU C++14 TESTS 9 61 1024000
175657342 engeousthepotionmaster D Oct. 11, 2022, 4:42 p.m. OK GNU C++14 TESTS 9 61 1024000
175656767 Naim_Hasan_Pappu D Oct. 11, 2022, 4:41 p.m. OK GNU C++14 TESTS 9 61 1024000
175660813 2000030447 D Oct. 11, 2022, 4:49 p.m. OK GNU C++14 TESTS 9 61 1024000
175660699 newsheep D Oct. 11, 2022, 4:49 p.m. OK GNU C++14 TESTS 9 61 1024000
175697594 behuymummim D Oct. 12, 2022, 12:59 a.m. OK GNU C++14 TESTS 10 61 1228800
175659606 M762 D Oct. 11, 2022, 4:47 p.m. OK GNU C++14 TESTS 9 61 3686400
175656700 MrRD D Oct. 11, 2022, 4:40 p.m. OK GNU C++14 TESTS 9 61 8396800
175707117 tushar217 D Oct. 12, 2022, 4:06 a.m. OK GNU C++14 TESTS 10 61 9113600
175659861 WaterSpellbinder D Oct. 11, 2022, 4:47 p.m. OK GNU C++17 TESTS 9 46 1024000
175709118 Harry_J D Oct. 12, 2022, 4:42 a.m. OK GNU C++17 TESTS 10 46 1228800
175703798 Lskkkno3 D Oct. 12, 2022, 3:06 a.m. OK GNU C++17 TESTS 10 46 1228800
175669291 gonna_say_u_later D Oct. 11, 2022, 5:42 p.m. OK GNU C++17 TESTS 9 46 2150400
175663237 Tourist277 D Oct. 11, 2022, 4:58 p.m. OK GNU C++17 TESTS 9 46 2150400
175695155 Mackenzie D Oct. 11, 2022, 11:34 p.m. OK GNU C++17 TESTS 10 46 2662400
175695099 Mackenzie D Oct. 11, 2022, 11:32 p.m. OK GNU C++17 TESTS 10 46 2662400
175656056 codeforcesvineet D Oct. 11, 2022, 4:39 p.m. OK GNU C++17 TESTS 9 46 3686400
175670867 jahid_hridoy D Oct. 11, 2022, 5:56 p.m. OK GNU C++17 TESTS 9 46 3993600
175709133 FoundNoOneBetter D Oct. 12, 2022, 4:42 a.m. OK GNU C++17 TESTS 10 61 1024000
175703330 icebear11 D Oct. 12, 2022, 2:58 a.m. OK GNU C++17 (64) TESTS 10 31 1024000
175714317 yaoveil D Oct. 12, 2022, 5:38 a.m. OK GNU C++17 (64) TESTS 10 31 1024000
175703963 lovezah D Oct. 12, 2022, 3:09 a.m. OK GNU C++17 (64) TESTS 10 31 1024000
175659093 enlighted_prani D Oct. 11, 2022, 4:46 p.m. OK GNU C++17 (64) TESTS 9 31 1126400
175702545 Rick_GT D Oct. 12, 2022, 2:45 a.m. OK GNU C++17 (64) TESTS 10 31 2150400
175679347 KodeReload D Oct. 11, 2022, 7:24 p.m. OK GNU C++17 (64) TESTS 9 31 2150400
175663895 TAM D Oct. 11, 2022, 5:02 p.m. OK GNU C++17 (64) TESTS 9 31 2150400
175665085 akifpatel D Oct. 11, 2022, 5:09 p.m. OK GNU C++17 (64) TESTS 9 31 2457600
175702160 DjTang D Oct. 12, 2022, 2:38 a.m. OK GNU C++17 (64) TESTS 10 31 2457600
175710613 KevinSo25 D Oct. 12, 2022, 5:05 a.m. OK GNU C++17 (64) TESTS 10 31 3993600
175679014 tzhamoidin_official D Oct. 11, 2022, 7:20 p.m. OK GNU C++20 (64) TESTS 9 15 1024000
175705526 wyxs2k5 D Oct. 12, 2022, 3:36 a.m. OK GNU C++20 (64) TESTS 10 31 1024000
175704228 SummerWind D Oct. 12, 2022, 3:13 a.m. OK GNU C++20 (64) TESTS 10 31 1024000
175698164 SharifHossen D Oct. 12, 2022, 1:14 a.m. OK GNU C++20 (64) TESTS 10 31 1024000
175689690 Tareq_Ali D Oct. 11, 2022, 10:26 p.m. OK GNU C++20 (64) TESTS 10 31 1024000
175706335 nirmalgovindaraj D Oct. 12, 2022, 3:51 a.m. OK GNU C++20 (64) TESTS 10 31 1024000
175688408 TheRunuwayDino D Oct. 11, 2022, 9:52 p.m. OK GNU C++20 (64) TESTS 9 31 1024000
175688393 Vladik D Oct. 11, 2022, 9:52 p.m. OK GNU C++20 (64) TESTS 9 31 1024000
175707493 _Pioneer D Oct. 12, 2022, 4:12 a.m. OK GNU C++20 (64) TESTS 10 31 1024000
175688445 go_next D Oct. 11, 2022, 9:53 p.m. OK GNU C++20 (64) TESTS 9 31 1024000
175666631 mtarunsai1999 D Oct. 11, 2022, 5:20 p.m. OK Go TESTS 9 108 13414400
175662862 __Serendipity D Oct. 11, 2022, 4:56 p.m. OK Java 11 TESTS 9 218 0
175658893 Never_Give_Up_Mani D Oct. 11, 2022, 4:45 p.m. OK Java 11 TESTS 9 233 0
175714639 yogii_123 D Oct. 12, 2022, 5:43 a.m. OK Java 11 TESTS 10 234 0
175663228 yudi23 D Oct. 11, 2022, 4:58 p.m. OK Java 11 TESTS 9 264 0
175657734 deepakkdkk D Oct. 11, 2022, 4:43 p.m. OK Java 11 TESTS 9 264 0
175713679 g_square D Oct. 12, 2022, 5:30 a.m. OK Java 11 TESTS 10 265 0
175657752 mishraadarsh02 D Oct. 11, 2022, 4:43 p.m. OK Java 11 TESTS 9 280 5324800
175655965 puriabhijit000 D Oct. 11, 2022, 4:39 p.m. OK Java 11 TESTS 9 296 0
175706251 rajan44chauhan D Oct. 12, 2022, 3:50 a.m. OK Java 11 TESTS 10 451 22323200
175666171 ayushh2020 D Oct. 11, 2022, 5:17 p.m. OK Java 11 TESTS 9 452 0
175658861 shudderwock D Oct. 11, 2022, 4:45 p.m. OK Java 17 TESTS 9 187 614400
175702871 pili D Oct. 12, 2022, 2:50 a.m. OK Java 17 TESTS 10 202 204800
175665541 crookcoder D Oct. 11, 2022, 5:13 p.m. OK Java 17 TESTS 9 218 204800
175656153 Huybq26 D Oct. 11, 2022, 4:39 p.m. OK Java 17 TESTS 9 233 1945600
175673533 Kedrigern D Oct. 11, 2022, 6:21 p.m. OK Java 17 TESTS 9 358 21504000
175677848 Dukkha D Oct. 11, 2022, 7:06 p.m. OK Java 17 TESTS 9 467 819200
175655494 akhil_1000 D Oct. 11, 2022, 4:38 p.m. OK Java 17 TESTS 9 498 204800
175683241 ukr2002 D Oct. 11, 2022, 8:18 p.m. OK Java 17 TESTS 9 499 716800
175660466 imMortalSuv D Oct. 11, 2022, 4:48 p.m. OK Java 8 TESTS 9 124 1843200
175657663 Kalesh D Oct. 11, 2022, 4:43 p.m. OK Java 8 TESTS 9 124 2764800
175686736 Abdallah_Ragab00 D Oct. 11, 2022, 9:19 p.m. OK Java 8 TESTS 9 139 1843200
175668594 vaibhav_1710 D Oct. 11, 2022, 5:36 p.m. OK Java 8 TESTS 9 139 1843200
175703257 frey4 D Oct. 12, 2022, 2:57 a.m. OK Java 8 TESTS 10 140 1843200
175658191 7hseggi D Oct. 11, 2022, 4:44 p.m. OK Java 8 TESTS 9 140 1843200
175683281 Unrated_Pritam D Oct. 11, 2022, 8:19 p.m. OK Java 8 TESTS 9 140 2764800
175655680 Parimal D Oct. 11, 2022, 4:38 p.m. OK Java 8 TESTS 9 155 1843200
175678261 kowai_ D Oct. 11, 2022, 7:10 p.m. OK Java 8 TESTS 9 155 65228800
175656511 Mahip_19 D Oct. 11, 2022, 4:40 p.m. OK Java 8 TESTS 9 171 2764800
175713150 Bszhang D Oct. 12, 2022, 5:23 a.m. OK MS C++ 2017 TESTS 10 78 1126400
175662267 bestgreenie D Oct. 11, 2022, 4:53 p.m. OK MS C++ 2017 TESTS 9 78 2457600
175658598 big_owner D Oct. 11, 2022, 4:45 p.m. OK MS C++ 2017 TESTS 9 171 2969600
175655696 lxk_iKun D Oct. 11, 2022, 4:38 p.m. OK MS C++ 2017 TESTS 9 186 1024000
175677432 komalsatwik2002 D Oct. 11, 2022, 7:01 p.m. OK MS C++ 2017 TESTS 9 187 2150400
175679517 Mirali7 D Oct. 11, 2022, 7:26 p.m. OK MS C++ 2017 TESTS 9 187 9523200
175658144 adwait_hegde D Oct. 11, 2022, 4:44 p.m. OK PyPy 3 TESTS 9 233 20275200
175686643 Abdalkhalig D Oct. 11, 2022, 9:17 p.m. OK PyPy 3 TESTS 9 248 19456000
175687649 hxu10 D Oct. 11, 2022, 9:37 p.m. OK PyPy 3 TESTS 9 327 21196800
175695131 Bhaskar1702 D Oct. 11, 2022, 11:33 p.m. OK PyPy 3 TESTS 10 358 16896000
175662403 aneesh2002 D Oct. 11, 2022, 4:54 p.m. OK PyPy 3 TESTS 9 468 19558400
175702911 TRAGIC11 D Oct. 12, 2022, 2:51 a.m. OK PyPy 3 TESTS 10 468 25804800
175663841 chicosena D Oct. 11, 2022, 5:01 p.m. OK PyPy 3 TESTS 9 499 19968000
175683503 Dok_31 D Oct. 11, 2022, 8:22 p.m. OK PyPy 3 TESTS 9 530 19968000
175662502 chicosena D Oct. 11, 2022, 4:55 p.m. OK PyPy 3 TESTS 9 545 19865600
175680896 Utkarshg001 D Oct. 11, 2022, 7:45 p.m. OK PyPy 3 TESTS 9 561 19865600
175695516 crapcode D Oct. 11, 2022, 11:47 p.m. OK PyPy 3-64 TESTS 10 140 27750400
175658182 radoan.sharkar.richi D Oct. 11, 2022, 4:44 p.m. OK PyPy 3-64 TESTS 9 155 23552000
175672772 abcsumit D Oct. 11, 2022, 6:14 p.m. OK PyPy 3-64 TESTS 9 155 29798400
175658818 RyoSci D Oct. 11, 2022, 4:45 p.m. OK PyPy 3-64 TESTS 9 155 29900800
175672886 Girniiiii D Oct. 11, 2022, 6:15 p.m. OK PyPy 3-64 TESTS 9 155 30003200
175666054 dyppp D Oct. 11, 2022, 5:16 p.m. OK PyPy 3-64 TESTS 9 155 30617600
175678376 biglunchdude D Oct. 11, 2022, 7:12 p.m. OK PyPy 3-64 TESTS 9 155 30822400
175712768 MohamedHamed123 D Oct. 12, 2022, 5:17 a.m. OK PyPy 3-64 TESTS 10 170 30617600
175688715 radoan.sharkar.richi D Oct. 11, 2022, 9:59 p.m. OK PyPy 3-64 TESTS 10 171 23552000
175714285 sdt4936 D Oct. 12, 2022, 5:38 a.m. OK PyPy 3-64 TESTS 10 187 31744000
175712717 MohamedHamed123 D Oct. 12, 2022, 5:17 a.m. OK Python 3 TESTS 10 233 18227200
175659991 D_evil D Oct. 11, 2022, 4:47 p.m. OK Python 3 TESTS 9 249 17203200
175701194 juandavidarce D Oct. 12, 2022, 2:20 a.m. OK Python 3 TESTS 10 249 17612800
175673358 lucifer_delco D Oct. 11, 2022, 6:19 p.m. OK Python 3 TESTS 9 295 17203200
175668781 pratyush155 D Oct. 11, 2022, 5:37 p.m. OK Python 3 TESTS 9 296 17612800
175672953 abcsumit D Oct. 11, 2022, 6:15 p.m. OK Python 3 TESTS 9 311 17612800
175666852 abhinav0606june D Oct. 11, 2022, 5:22 p.m. OK Python 3 TESTS 9 311 19353600
175673444 21bec036 D Oct. 11, 2022, 6:20 p.m. OK Python 3 TESTS 9 358 17612800
175682074 macarell D Oct. 11, 2022, 8:01 p.m. OK Python 3 TESTS 9 389 17510400
175704941 rohanailoni D Oct. 12, 2022, 3:25 a.m. OK Python 3 TESTS 10 404 18432000

remove filters

Back to search problems