Codeforces Round 704 (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
1492 Codeforces Round 704 (Div. 2) FINISHED False 7200 117752099 Feb. 23, 2021, 9:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 18516 ) B Card Deck PROGRAMMING data structures greedy math

B"You have a deck of n cards, and you'd like to reorder it to a new one. Each card has a value between 1 and n equal to p_i . All p_i are pairwise distinct. Cards in a deck are numbered from bottom to top, i. e. p_1 stands for the bottom card, p_n is the top card. In each step you pick some integer k > 0 , take the top k cards from the original deck and place them, in the order they are now, on top of the new deck. You perform this operation until the original deck is empty. (Refer to the notes section for the better understanding.) Let's define an order of a deck as sum limits_{i = 1}^{n}{n^{n - i} cdot p_i} . Given the original deck, output the deck with maximum possible order you can make using the operation above. The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. The first line of each test case contains the single integer n ( 1 <= n <= 10^5 ) -- the size of deck you have. The second line contains n integers p_1, p_2, ... , p_n ( 1 <= p_i <= n ; p_i neq p_j if i neq j ) -- values of card in the deck from bottom to top. It's guaranteed that the sum of n over all test cases doesn't exceed 10^5 . For each test case print the deck with maximum possible order. Print values of cards in the deck from bottom to top. If there are multiple answers, print any of them. In the first test case, one of the optimal strategies is the next one: In the second test case, one of the optimal strategies is: In the third test case, one of the optimal strategies is: "...

Tutorials

Codeforces Round #704 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
108331729 gslee B Feb. 23, 2021, 5:46 p.m. OK Clang++17 Diagnostics TESTS 22 701 1024000
108351136 ndocx B Feb. 24, 2021, 3:01 a.m. OK FPC TESTS 22 312 921600
108302098 angred_force B Feb. 23, 2021, 1:18 p.m. OK GNU C11 TESTS 22 390 819200
108353137 yhaooo B Feb. 24, 2021, 3:50 a.m. OK GNU C++11 TESTS 22 31 819200
108346919 PsephurusGladius B Feb. 24, 2021, 12:56 a.m. OK GNU C++11 TESTS 22 46 307200
108346519 ypcaeh B Feb. 24, 2021, 12:41 a.m. OK GNU C++11 TESTS 22 46 512000
108346069 shygo_cmll01 B Feb. 24, 2021, 12:20 a.m. OK GNU C++11 TESTS 22 46 614400
108351714 _jhq B Feb. 24, 2021, 3:14 a.m. OK GNU C++11 TESTS 22 46 819200
108350471 little_sun B Feb. 24, 2021, 2:46 a.m. OK GNU C++11 TESTS 22 46 819200
108345188 luogu_bot4 B Feb. 23, 2021, 11:30 p.m. OK GNU C++11 TESTS 22 46 819200
108309120 sidiangongyuan B Feb. 23, 2021, 2:15 p.m. OK GNU C++11 TESTS 22 46 819200
108355727 rui_er B Feb. 24, 2021, 4:40 a.m. OK GNU C++11 TESTS 22 46 819200
108353000 noone___ B Feb. 24, 2021, 3:47 a.m. OK GNU C++11 TESTS 22 46 921600
108344392 ABRudra B Feb. 23, 2021, 10:42 p.m. OK GNU C++14 TESTS 22 46 819200
108338467 NomanChowdhuryMunna B Feb. 23, 2021, 7:33 p.m. OK GNU C++14 TESTS 22 46 819200
108349005 LouiseSariel B Feb. 24, 2021, 2:04 a.m. OK GNU C++14 TESTS 22 46 819200
108306511 root__786 B Feb. 23, 2021, 1:53 p.m. OK GNU C++14 TESTS 22 61 512000
108355739 syksykCCC B Feb. 24, 2021, 4:40 a.m. OK GNU C++14 TESTS 22 61 819200
108346809 newminh B Feb. 24, 2021, 12:52 a.m. OK GNU C++14 TESTS 22 61 819200
108334170 sKSama B Feb. 23, 2021, 6:20 p.m. OK GNU C++14 TESTS 22 61 819200
108332254 vibhorchatwani B Feb. 23, 2021, 5:53 p.m. OK GNU C++14 TESTS 22 61 819200
108357850 noushad_coder11 B Feb. 24, 2021, 5:08 a.m. OK GNU C++14 TESTS 22 61 819200
108318728 _elgir B Feb. 23, 2021, 3:45 p.m. OK GNU C++14 TESTS 22 61 819200
108317200 im_n7_ B Feb. 23, 2021, 3:30 p.m. OK GNU C++17 TESTS 22 46 819200
108337265 tredsused70 B Feb. 23, 2021, 7:10 p.m. OK GNU C++17 TESTS 22 46 819200
108345081 vibhug507 B Feb. 23, 2021, 11:24 p.m. OK GNU C++17 TESTS 22 46 1638400
108332589 ficy B Feb. 23, 2021, 5:57 p.m. OK GNU C++17 TESTS 22 46 2048000
108331584 2N1_ B Feb. 23, 2021, 5:44 p.m. OK GNU C++17 TESTS 22 46 2048000
108330956 NineFathoms B Feb. 23, 2021, 5:36 p.m. OK GNU C++17 TESTS 22 46 2252800
108313324 harish_dalal B Feb. 23, 2021, 2:53 p.m. OK GNU C++17 TESTS 22 46 2252800
108341337 saftig B Feb. 23, 2021, 8:43 p.m. OK GNU C++17 TESTS 22 46 2252800
108310665 A_j_ B Feb. 23, 2021, 2:30 p.m. OK GNU C++17 TESTS 22 46 2355200
108341952 Anon_mouS B Feb. 23, 2021, 9:01 p.m. OK GNU C++17 TESTS 22 46 2457600
108360184 PaliLo B Feb. 24, 2021, 5:34 a.m. OK GNU C++17 (64) TESTS 22 46 409600
108321669 LethalPuppy B Feb. 23, 2021, 4:17 p.m. OK GNU C++17 (64) TESTS 22 46 512000
108314488 Geothermal B Feb. 23, 2021, 3:04 p.m. OK GNU C++17 (64) TESTS 22 46 819200
108339252 sike007 B Feb. 23, 2021, 7:50 p.m. OK GNU C++17 (64) TESTS 22 46 819200
108356849 _Isaunoya_ B Feb. 24, 2021, 4:55 a.m. OK GNU C++17 (64) TESTS 22 46 819200
108355204 it_aint_me B Feb. 24, 2021, 4:32 a.m. OK GNU C++17 (64) TESTS 22 46 819200
108346425 eyangch B Feb. 24, 2021, 12:37 a.m. OK GNU C++17 (64) TESTS 22 46 819200
108341770 bedirhan B Feb. 23, 2021, 8:56 p.m. OK GNU C++17 (64) TESTS 22 46 819200
108340384 3BS_AS B Feb. 23, 2021, 8:16 p.m. OK GNU C++17 (64) TESTS 22 46 819200
108338637 Kolapata B Feb. 23, 2021, 7:37 p.m. OK GNU C++17 (64) TESTS 22 46 819200
108300795 Jepbar_Asgarov B Feb. 23, 2021, 1:10 p.m. OK Go TESTS 22 374 409600
108348730 Anuj_Panchal B Feb. 24, 2021, 1:57 a.m. OK Java 11 TESTS 22 186 0
108344323 rafee69029 B Feb. 23, 2021, 10:38 p.m. OK Java 11 TESTS 22 186 0
108332926 Pushkar-PM B Feb. 23, 2021, 6:02 p.m. OK Java 11 TESTS 22 233 0
108302136 saurabh_kl B Feb. 23, 2021, 1:18 p.m. OK Java 11 TESTS 22 233 921600
108309088 Tharun0102 B Feb. 23, 2021, 2:15 p.m. OK Java 11 TESTS 22 234 0
108354141 pikachu_pika_pika B Feb. 24, 2021, 4:12 a.m. OK Java 11 TESTS 22 249 1433600
108316310 alimodassir B Feb. 23, 2021, 3:21 p.m. OK Java 11 TESTS 22 265 4096000
108338146 Nick B Feb. 23, 2021, 7:27 p.m. OK Java 11 TESTS 22 265 11571200
108311651 5612 B Feb. 23, 2021, 2:39 p.m. OK Java 11 TESTS 22 280 0
108303144 baba_yagga B Feb. 23, 2021, 1:26 p.m. OK Java 11 TESTS 22 296 12697600
108352867 Pranay_ B Feb. 24, 2021, 3:44 a.m. OK Java 8 TESTS 22 140 0
108310354 Ibrahimovic_The_Lion B Feb. 23, 2021, 2:27 p.m. OK Java 8 TESTS 22 156 0
108308863 akshay_3110 B Feb. 23, 2021, 2:13 p.m. OK Java 8 TESTS 22 156 0
108308602 guru1603 B Feb. 23, 2021, 2:11 p.m. OK Java 8 TESTS 22 156 0
108308673 honeysingh18 B Feb. 23, 2021, 2:11 p.m. OK Java 8 TESTS 22 171 4403200
108319376 pulkit1411 B Feb. 23, 2021, 3:52 p.m. OK Java 8 TESTS 22 171 16281600
108333781 gagan_6730 B Feb. 23, 2021, 6:14 p.m. OK Java 8 TESTS 22 171 39628800
108313712 Agnimandur B Feb. 23, 2021, 2:57 p.m. OK Java 8 TESTS 22 186 0
108336416 RonWonWon B Feb. 23, 2021, 6:55 p.m. OK Java 8 TESTS 22 202 6451200
108361216 toretto_011 B Feb. 24, 2021, 5:45 a.m. OK Java 8 TESTS 22 217 35635200
108313338 da_louis B Feb. 23, 2021, 2:53 p.m. OK Kotlin TESTS 22 342 8192000
108348781 wangyeqi B Feb. 24, 2021, 1:58 a.m. OK MS C++ TESTS 22 77 2150400
108356687 Goodenough_ B Feb. 24, 2021, 4:53 a.m. OK MS C++ TESTS 22 140 1228800
108330017 Whirligig B Feb. 23, 2021, 5:23 p.m. OK MS C++ TESTS 22 186 4915200
108305470 zhihanii B Feb. 23, 2021, 1:44 p.m. OK MS C++ 2017 TESTS 22 78 1945600
108346963 hgb202003013010 B Feb. 24, 2021, 12:58 a.m. OK MS C++ 2017 TESTS 22 93 4915200
108350094 Harshita_0304 B Feb. 24, 2021, 2:37 a.m. OK MS C++ 2017 TESTS 22 140 819200
108348462 vanloc1808 B Feb. 24, 2021, 1:49 a.m. OK MS C++ 2017 TESTS 22 140 819200
108344512 AliiHME B Feb. 23, 2021, 10:48 p.m. OK MS C++ 2017 TESTS 22 140 921600
108356381 yang33100 B Feb. 24, 2021, 4:49 a.m. OK MS C++ 2017 TESTS 22 140 1126400
108342056 moreda B Feb. 23, 2021, 9:05 p.m. OK MS C++ 2017 TESTS 22 140 1228800
108300586 AlexeyT B Feb. 23, 2021, 1:09 p.m. OK MS C++ 2017 TESTS 22 140 1228800
108316204 truevampire B Feb. 23, 2021, 3:20 p.m. OK MS C++ 2017 TESTS 22 140 2150400
108315105 gever_gever B Feb. 23, 2021, 3:10 p.m. OK MS C++ 2017 TESTS 22 156 2560000
108332938 tennisru B Feb. 23, 2021, 6:02 p.m. OK Node.js TESTS 22 140 18124800
108323941 yinuowang B Feb. 23, 2021, 4:42 p.m. OK PyPy 3 TESTS 22 140 16076800
108316888 legend.ary_as B Feb. 23, 2021, 3:27 p.m. OK PyPy 3 TESTS 22 155 11571200
108316749 hritik3878 B Feb. 23, 2021, 3:25 p.m. OK PyPy 3 TESTS 22 170 12902400
108301611 kirito18086 B Feb. 23, 2021, 1:15 p.m. OK PyPy 3 TESTS 22 171 11571200
108305540 rajbit B Feb. 23, 2021, 1:44 p.m. OK PyPy 3 TESTS 22 171 12697600
108325626 Kunal_makwana B Feb. 23, 2021, 4:45 p.m. OK PyPy 3 TESTS 22 218 12492800
108324068 hsdkfrhq B Feb. 23, 2021, 4:43 p.m. OK PyPy 3 TESTS 22 218 12492800
108311733 kirito18086 B Feb. 23, 2021, 2:39 p.m. OK PyPy 3 TESTS 22 218 15974400
108303340 alterego_14 B Feb. 23, 2021, 1:28 p.m. OK PyPy 3 TESTS 22 233 12083200
108354634 safeers B Feb. 24, 2021, 4:22 a.m. OK PyPy 3 TESTS 22 234 12492800
108312194 sayan_india B Feb. 23, 2021, 2:44 p.m. OK Python 2 TESTS 22 234 7987200
108329878 tsk3081 B Feb. 23, 2021, 5:21 p.m. OK Python 3 TESTS 22 170 10752000
108331246 ozodbaht8 B Feb. 23, 2021, 5:39 p.m. OK Python 3 TESTS 22 202 7372800
108326079 runitranjankumar B Feb. 23, 2021, 4:51 p.m. OK Python 3 TESTS 22 248 11878400
108328870 spiritedExit0 B Feb. 23, 2021, 5:09 p.m. OK Python 3 TESTS 22 249 7270400
108321364 sh1194 B Feb. 23, 2021, 4:14 p.m. OK Python 3 TESTS 22 249 7372800
108328090 spiritedExit0 B Feb. 23, 2021, 5 p.m. OK Python 3 TESTS 22 264 7270400
108356297 Koki_tkg B Feb. 24, 2021, 4:49 a.m. OK Python 3 TESTS 22 265 7065600
108341678 Daniyar B Feb. 23, 2021, 8:53 p.m. OK Python 3 TESTS 22 265 7680000
108340821 nabovtl B Feb. 23, 2021, 8:29 p.m. OK Python 3 TESTS 22 280 7372800
108339669 god_gyeol B Feb. 23, 2021, 7:59 p.m. OK Python 3 TESTS 22 280 7372800
108337104 ocamler B Feb. 23, 2021, 7:07 p.m. OK Rust TESTS 22 77 4608000

remove filters

Back to search problems