Codeforces Round 874 (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
1833 Codeforces Round 874 (Div. 3) FINISHED False 8100 52673063 May 19, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 13665 ) D Flipper PROGRAMMING brute force constructive algorithms

B'You are given a permutation p of length n . A permutation is an array consisting of n distinct integers from 1 to n in any order. For example, {2,3,1,5,4 } is a permutation, while {1,2,2 } is not (since 2 appears twice), and {1,3,4 } is also not a permutation (as n=3 , but the array contains 4 ). To the permutation p , you need to apply the following operation exactly once: For example, given n = 5, p = {2, color{blue}{3}, color{blue}{1}, 5, 4 } , if you choose the segment [l = 2, r = 3] , after reversing the segment p = { color{green}{2}, color{blue}{1}, color{blue}{3}, color{green}{5}, color{green}{4} } , then you swap the segments [4, 5] and [1, 1] . Thus, p = { color{green}{5}, color{green}{4}, 1, 3, color{green}{2} } . It can be shown that this is the maximum possible result for the given permutation. You need to output the lexicographically maximum permutation that can be obtained by applying the operation described exactly once. A permutation a is lexicographically greater than permutation b if there exists an i ( 1 <= i <= n ) such that a_j = b_j for 1 <= j < i and a_i > b_i . The first line of the input contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. Then the descriptions of the test cases follow. The first line of each test case contains a single integer n ( 1 <= n <= 2000 ) -- the size of the permutation. The second line of each test case contains n integers: p_1, p_2, ldots, p_n ( 1 <= p_i <= n ) -- the permutation p itself. It is guaranteed that the sum of n over all test cases does not exceed 2000 . For each test case, output in a separate line the lexicographically maximum permutation of length n that can be obtained from p by applying the operation described in the problem exactly onc'...

Tutorials

116636

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
206575997 mban259 D May 20, 2023, 12:02 a.m. OK C# 10 TESTS 14 93 2048000
206552989 AutumnMist D May 19, 2023, 5:24 p.m. OK C# 10 TESTS 9 155 614400
206545430 1435730 D May 19, 2023, 4:56 p.m. OK GNU C11 TESTS 9 31 0
206541052 HoriaB D May 19, 2023, 4:45 p.m. OK GNU C11 TESTS 9 31 0
206544435 rishikvudem D May 19, 2023, 4:52 p.m. OK GNU C11 TESTS 9 31 0
206553599 qianqiangotoTHU D May 19, 2023, 5:30 p.m. OK GNU C++14 TESTS 9 0 0
206546172 Captainfly D May 19, 2023, 5 p.m. OK GNU C++14 TESTS 9 0 0
206559478 utk_6 D May 19, 2023, 6:28 p.m. OK GNU C++14 TESTS 9 0 0
206556186 agentdash123 D May 19, 2023, 5:55 p.m. OK GNU C++14 TESTS 9 0 0
206551076 Akash_Kr D May 19, 2023, 5:19 p.m. OK GNU C++14 TESTS 9 0 102400
206537285 THE_PRO_CODER D May 19, 2023, 4:36 p.m. OK GNU C++14 TESTS 9 0 204800
206536939 I_love_qa D May 19, 2023, 4:35 p.m. OK GNU C++14 TESTS 9 0 204800
206545290 yashraj_04 D May 19, 2023, 4:55 p.m. OK GNU C++14 TESTS 9 0 204800
206557544 ritikagr061 D May 19, 2023, 6:08 p.m. OK GNU C++14 TESTS 9 0 204800
206553140 Attack_on_ICPC_2023 D May 19, 2023, 5:25 p.m. OK GNU C++14 TESTS 9 0 204800
206558151 Wallbreaker100 D May 19, 2023, 6:15 p.m. OK GNU C++17 TESTS 9 0 0
206555218 Subhashis_CSE D May 19, 2023, 5:46 p.m. OK GNU C++17 TESTS 9 0 0
206553152 cf_xiaohao D May 19, 2023, 5:26 p.m. OK GNU C++17 TESTS 9 0 0
206547914 SAHAL01 D May 19, 2023, 5:11 p.m. OK GNU C++17 TESTS 9 0 0
206546984 BlueberryPieKyle D May 19, 2023, 5:05 p.m. OK GNU C++17 TESTS 9 0 0
206538888 anas_allaham D May 19, 2023, 4:40 p.m. OK GNU C++17 TESTS 9 0 0
206538807 iammiddha D May 19, 2023, 4:39 p.m. OK GNU C++17 TESTS 9 0 0
206576997 romina.nafu D May 20, 2023, 12:40 a.m. OK GNU C++17 TESTS 14 0 0
206566796 pro_123 D May 19, 2023, 8:05 p.m. OK GNU C++17 TESTS 14 0 0
206563462 AbdulK_69 D May 19, 2023, 7:18 p.m. OK GNU C++17 TESTS 9 0 0
206535339 Shamim97 D May 19, 2023, 4:31 p.m. OK GNU C++17 (64) TESTS 9 0 0
206561242 jordan11 D May 19, 2023, 6:50 p.m. OK GNU C++17 (64) TESTS 9 0 0
206554787 drizzle_codes D May 19, 2023, 5:41 p.m. OK GNU C++17 (64) TESTS 9 0 0
206540086 DAg652 D May 19, 2023, 4:42 p.m. OK GNU C++17 (64) TESTS 9 0 0
206538847 MohmadZaid._. D May 19, 2023, 4:39 p.m. OK GNU C++17 (64) TESTS 9 0 0
206534082 Aviously D May 19, 2023, 4:29 p.m. OK GNU C++17 (64) TESTS 9 0 0
206536586 sudhir___ D May 19, 2023, 4:34 p.m. OK GNU C++17 (64) TESTS 9 0 102400
206537040 harsh_8484 D May 19, 2023, 4:35 p.m. OK GNU C++17 (64) TESTS 9 0 102400
206539437 sahil903 D May 19, 2023, 4:41 p.m. OK GNU C++17 (64) TESTS 9 0 102400
206550045 Anchar_Champu D May 19, 2023, 5:14 p.m. OK GNU C++17 (64) TESTS 9 0 102400
206568747 PresentLogic D May 19, 2023, 8:35 p.m. OK GNU C++20 (64) TESTS 14 0 0
206566321 CodeAssignment D May 19, 2023, 7:58 p.m. OK GNU C++20 (64) TESTS 14 0 0
206565953 A7med_Mustafa D May 19, 2023, 7:52 p.m. OK GNU C++20 (64) TESTS 14 0 0
206565673 __tony_stark_ D May 19, 2023, 7:48 p.m. OK GNU C++20 (64) TESTS 14 0 0
206564723 itspunkaj D May 19, 2023, 7:34 p.m. OK GNU C++20 (64) TESTS 9 0 0
206562781 AnasMaged D May 19, 2023, 7:09 p.m. OK GNU C++20 (64) TESTS 9 0 0
206562715 imObscure D May 19, 2023, 7:08 p.m. OK GNU C++20 (64) TESTS 9 0 0
206577930 mehrunesartem D May 20, 2023, 1:08 a.m. OK GNU C++20 (64) TESTS 14 0 0
206575958 KitasCraft D May 20, 2023, 12:01 a.m. OK GNU C++20 (64) TESTS 14 0 0
206573551 waleedalaa511 D May 19, 2023, 10:34 p.m. OK GNU C++20 (64) TESTS 14 0 0
206539920 uttaran_das D May 19, 2023, 4:42 p.m. OK Java 11 TESTS 9 171 0
206555909 rezairianto D May 19, 2023, 5:52 p.m. OK Java 11 TESTS 9 186 0
206571428 princeayush04 D May 19, 2023, 9:35 p.m. OK Java 11 TESTS 14 202 0
206560086 themadknight45 D May 19, 2023, 6:35 p.m. OK Java 11 TESTS 9 202 0
206555176 tgd1115 D May 19, 2023, 5:45 p.m. OK Java 11 TESTS 9 202 0
206535777 radianite2003 D May 19, 2023, 4:32 p.m. OK Java 11 TESTS 9 217 0
206544684 pranp_24 D May 19, 2023, 4:53 p.m. OK Java 11 TESTS 9 234 0
206537472 aditya_parate D May 19, 2023, 4:36 p.m. OK Java 11 TESTS 9 249 0
206538781 devansh_123 D May 19, 2023, 4:39 p.m. OK Java 11 TESTS 9 249 0
206540839 ttannishh D May 19, 2023, 4:44 p.m. OK Java 11 TESTS 9 264 0
206577782 Eslam_Ahmed D May 20, 2023, 1:04 a.m. OK Java 17 TESTS 14 218 512000
206538819 ning1ing D May 19, 2023, 4:39 p.m. OK Java 17 TESTS 9 233 921600
206574696 kamranm D May 19, 2023, 11:13 p.m. OK Java 17 TESTS 14 233 104140800
206535272 flyroko D May 19, 2023, 4:31 p.m. OK Java 17 TESTS 9 249 614400
206537264 s_zx D May 19, 2023, 4:36 p.m. OK Java 17 TESTS 9 249 10649600
206535015 wintersoldier2004 D May 19, 2023, 4:31 p.m. OK Java 17 TESTS 9 280 614400
206565740 Aditya_Trivedi1 D May 19, 2023, 7:49 p.m. OK Java 17 TESTS 14 280 1126400
206561018 Abhinav__hadole D May 19, 2023, 6:47 p.m. OK Java 17 TESTS 9 296 921600
206570919 Mohamed_M.M.R D May 19, 2023, 9:22 p.m. OK Java 17 TESTS 14 327 0
206547229 amit_roy D May 19, 2023, 5:07 p.m. OK Java 8 TESTS 9 92 0
206544580 uday_kirran D May 19, 2023, 4:52 p.m. OK Java 8 TESTS 9 93 0
206544133 NerfThis D May 19, 2023, 4:51 p.m. OK Java 8 TESTS 9 108 0
206538491 luojiawhu D May 19, 2023, 4:39 p.m. OK Java 8 TESTS 9 108 0
206550525 Imran435 D May 19, 2023, 5:18 p.m. OK Java 8 TESTS 9 109 0
206540661 mohamedhassan_c D May 19, 2023, 4:44 p.m. OK Java 8 TESTS 9 124 5734400
206571785 lpychemistry D May 19, 2023, 9:44 p.m. OK Java 8 TESTS 14 140 0
206538532 depurador_ik D May 19, 2023, 4:39 p.m. OK Java 8 TESTS 9 140 38604800
206546237 Deependra_coder D May 19, 2023, 5 p.m. OK Java 8 TESTS 9 155 0
206543638 vatsal_04 D May 19, 2023, 4:49 p.m. OK Java 8 TESTS 9 155 0
206547814 moreda D May 19, 2023, 5:10 p.m. OK MS C++ 2017 TESTS 9 15 0
206536214 umairhassangondal3 D May 19, 2023, 4:33 p.m. OK MS C++ 2017 TESTS 9 15 0
206536107 Madhurb21 D May 19, 2023, 4:33 p.m. OK MS C++ 2017 TESTS 9 15 0
206560930 s_owlxx D May 19, 2023, 6:46 p.m. OK MS C++ 2017 TESTS 9 15 102400
206541801 Telon98 D May 19, 2023, 4:46 p.m. OK MS C++ 2017 TESTS 9 31 102400
206556309 jvatsal0709 D May 19, 2023, 5:56 p.m. OK PyPy 3 TESTS 9 93 2764800
206541939 shriomks D May 19, 2023, 4:46 p.m. OK PyPy 3 TESTS 9 109 2457600
206548142 ZenMachine D May 19, 2023, 5:12 p.m. OK PyPy 3 TESTS 9 109 2867200
206542069 rshohruh D May 19, 2023, 4:47 p.m. OK PyPy 3 TESTS 9 109 4300800
206534239 emptyUser D May 19, 2023, 4:29 p.m. OK PyPy 3 TESTS 9 217 11059200
206544862 Ayushman_123 D May 19, 2023, 4:53 p.m. OK PyPy 3 TESTS 9 280 10240000
206573695 Severian D May 19, 2023, 10:39 p.m. OK PyPy 3-64 TESTS 14 61 2048000
206560910 layzer D May 19, 2023, 6:46 p.m. OK PyPy 3-64 TESTS 9 62 3379200
206556762 aniketabhiraj2004 D May 19, 2023, 6:01 p.m. OK PyPy 3-64 TESTS 9 77 3276800
206563740 Probability1 D May 19, 2023, 7:21 p.m. OK PyPy 3-64 TESTS 9 77 3788800
206539918 omarkurde D May 19, 2023, 4:42 p.m. OK PyPy 3-64 TESTS 9 77 3788800
206557199 alexwice D May 19, 2023, 6:05 p.m. OK PyPy 3-64 TESTS 9 77 4096000
206573681 jerome_coding D May 19, 2023, 10:38 p.m. OK PyPy 3-64 TESTS 14 77 4198400
206566965 cholebhature D May 19, 2023, 8:08 p.m. OK PyPy 3-64 TESTS 14 77 4198400
206572374 timmyfeng D May 19, 2023, 9:59 p.m. OK PyPy 3-64 TESTS 14 77 4403200
206558474 SoleProprietor D May 19, 2023, 6:18 p.m. OK PyPy 3-64 TESTS 9 77 10342400
206546036 sb945 D May 19, 2023, 4:59 p.m. OK Python 2 TESTS 9 46 102400
206563919 dlorde D May 19, 2023, 7:24 p.m. OK Python 3 TESTS 9 30 204800
206554294 hanbro0112 D May 19, 2023, 5:36 p.m. OK Python 3 TESTS 9 31 102400
206536061 Gorgontes D May 19, 2023, 4:33 p.m. OK Python 3 TESTS 9 31 102400
206563956 blazinglion D May 19, 2023, 7:24 p.m. OK Python 3 TESTS 9 31 204800
206561822 Goldeneye534 D May 19, 2023, 6:57 p.m. OK Python 3 TESTS 9 31 204800
206535268 Witherik D May 19, 2023, 4:31 p.m. OK Python 3 TESTS 9 31 204800
206534570 danurag23 D May 19, 2023, 4:30 p.m. OK Python 3 TESTS 9 31 204800
206542765 mario_07 D May 19, 2023, 4:48 p.m. OK Python 3 TESTS 9 46 102400
206574306 momenelmesady4803 D May 19, 2023, 11 p.m. OK Python 3 TESTS 14 46 204800
206536421 shashwat22473 D May 19, 2023, 4:34 p.m. OK Python 3 TESTS 9 46 204800
206538867 kz2d D May 19, 2023, 4:40 p.m. OK Rust 2021 TESTS 9 15 102400

remove filters

Back to search problems