Codeforces Round 743 (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
1573 Codeforces Round 743 (Div. 2) FINISHED False 7200 105290663 Sept. 18, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 14839 ) B Swaps PROGRAMMING greedy math 1400

B'You are given two arrays a and b of length n . Array a contains each odd integer from 1 to 2n in an arbitrary order, and array b contains each even integer from 1 to 2n in an arbitrary order. You can perform the following operation on those arrays: For two different arrays x and y of the same length n , we say that x is lexicographically smaller than y if in the first position where x and y differ, the array x has a smaller element than the corresponding element in y . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The first line of each test case contains a single integer n ( 1 <= n <= 10^5 ) -- the length of the arrays. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 2n , all a_i are odd and pairwise distinct) -- array a . The third line of each test case contains n integers b_1, b_2, ldots, b_n ( 1 <= b_i <= 2n , all b_i are even and pairwise distinct) -- array b . It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, print one integer: the minimum number of operations needed to make array a lexicographically smaller than array b . We can show that an answer always exists. In the first example, the array a is already lexicographically smaller than array b , so no operations are required. In the second example, we can swap 5 and 3 and then swap 2 and 4 , which results in [3, 5, 1] and [4, 2, 6] . Another correct way is to swap 3 and 1 and then swap 5 and 1 , which results in [1, 5, 3] and [2, 4, 6] . Yet another correct way is to swap 4 and 6 and then swap 2 and 6 , which results in [5, 3, 1]$$'...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
129191190 ruban B Sept. 18, 2021, 3:20 p.m. OK Delphi TESTS 29 62 61849600 1400
129201637 Gogococoyoyo B Sept. 18, 2021, 4:08 p.m. OK GNU C11 TESTS 29 61 4505600 1400
129195821 anyejunwang B Sept. 18, 2021, 3:39 p.m. OK GNU C++14 TESTS 29 61 4915200 1400
129215870 krishankant7156 B Sept. 18, 2021, 7:28 p.m. OK GNU C++14 TESTS 29 62 4505600 1400
129212909 Valters07 B Sept. 18, 2021, 6:37 p.m. OK GNU C++14 TESTS 29 62 4505600 1400
129213633 yassatamer99 B Sept. 18, 2021, 6:48 p.m. OK GNU C++14 TESTS 29 62 4505600 1400
129192005 VLapytskyi B Sept. 18, 2021, 3:23 p.m. OK GNU C++14 TESTS 29 62 4505600 1400
129227555 venkatdsingh7 B Sept. 19, 2021, 2:45 a.m. OK GNU C++14 TESTS 29 62 4505600 1400
129209936 nikhilwalia23 B Sept. 18, 2021, 5:52 p.m. OK GNU C++14 TESTS 29 62 4915200 1400
129197648 RoyalSFlush B Sept. 18, 2021, 3:49 p.m. OK GNU C++14 TESTS 29 62 4915200 1400
129224491 CFM_1 B Sept. 19, 2021, 12:52 a.m. OK GNU C++14 TESTS 29 62 4915200 1400
129198980 xish B Sept. 18, 2021, 3:56 p.m. OK GNU C++14 TESTS 29 62 4915200 1400
129202210 1421058562 B Sept. 18, 2021, 4:10 p.m. OK GNU C++17 TESTS 29 31 7168000 1400
129233919 blue_planet B Sept. 19, 2021, 5:35 a.m. OK GNU C++17 TESTS 29 46 4505600 1400
129193092 qrst11 B Sept. 18, 2021, 3:27 p.m. OK GNU C++17 TESTS 29 46 5324800 1400
129196051 niyouzack B Sept. 18, 2021, 3:40 p.m. OK GNU C++17 TESTS 29 46 105267200 1400
129215670 blue_planet B Sept. 18, 2021, 7:24 p.m. OK GNU C++17 TESTS 29 61 4505600 1400
129199735 KillTimer B Sept. 18, 2021, 3:59 p.m. OK GNU C++17 TESTS 29 62 4096000 1400
129220964 abdul135 B Sept. 18, 2021, 9:31 p.m. OK GNU C++17 TESTS 29 62 4505600 1400
129231028 thisislong B Sept. 19, 2021, 4:24 a.m. OK GNU C++17 TESTS 29 62 4505600 1400
129223652 bitwim B Sept. 19, 2021, 12:11 a.m. OK GNU C++17 TESTS 29 62 4505600 1400
129213157 Farhan_Nasif_Nizami B Sept. 18, 2021, 6:41 p.m. OK GNU C++17 TESTS 29 62 4505600 1400
129224439 augg1e B Sept. 19, 2021, 12:49 a.m. OK GNU C++17 (64) TESTS 29 46 5120000 1400
129197719 Tap0k B Sept. 18, 2021, 3:49 p.m. OK GNU C++17 (64) TESTS 29 46 5120000 1400
129229071 HunterKasa B Sept. 19, 2021, 3:32 a.m. OK GNU C++17 (64) TESTS 29 46 5120000 1400
129195803 To_oT B Sept. 18, 2021, 3:39 p.m. OK GNU C++17 (64) TESTS 29 46 5529600 1400
129211516 prottoyfuad B Sept. 18, 2021, 6:17 p.m. OK GNU C++17 (64) TESTS 29 46 5529600 1400
129209724 bkifhr8 B Sept. 18, 2021, 5:49 p.m. OK GNU C++17 (64) TESTS 29 46 5529600 1400
129234906 Sup_Segment B Sept. 19, 2021, 5:58 a.m. OK GNU C++17 (64) TESTS 29 46 5529600 1400
129212152 AnandOza B Sept. 18, 2021, 6:26 p.m. OK GNU C++17 (64) TESTS 29 46 5529600 1400
129196352 jansenkenpegrasio B Sept. 18, 2021, 3:41 p.m. OK GNU C++17 (64) TESTS 29 46 5836800 1400
129234754 akshaykhandelwal B Sept. 19, 2021, 5:55 a.m. OK GNU C++17 (64) TESTS 29 46 5939200 1400
129192096 bobbilyking B Sept. 18, 2021, 3:23 p.m. OK Java 11 TESTS 29 217 23859200 1400
129213090 tusharpruth B Sept. 18, 2021, 6:40 p.m. OK Java 11 TESTS 29 217 24064000 1400
129200175 naman5811 B Sept. 18, 2021, 4:02 p.m. OK Java 11 TESTS 29 233 23859200 1400
129223252 dwoolley3 B Sept. 18, 2021, 11:53 p.m. OK Java 11 TESTS 29 233 23859200 1400
129233071 ankit_bit B Sept. 19, 2021, 5:15 a.m. OK Java 11 TESTS 29 233 23961600 1400
129212697 dhruvil_01 B Sept. 18, 2021, 6:34 p.m. OK Java 11 TESTS 29 234 23961600 1400
129219286 tushar19280 B Sept. 18, 2021, 8:43 p.m. OK Java 11 TESTS 29 249 23961600 1400
129195941 thesupremeone B Sept. 18, 2021, 3:39 p.m. OK Java 11 TESTS 29 249 24576000 1400
129234811 ak_ankit B Sept. 19, 2021, 5:56 a.m. OK Java 11 TESTS 29 265 24576000 1400
129231367 kingku_sahu B Sept. 19, 2021, 4:33 a.m. OK Java 11 TESTS 29 280 30617600 1400
129190484 diwakargupta815 B Sept. 18, 2021, 3:18 p.m. OK Java 8 TESTS 29 124 20480000 1400
129214732 ChiMasterBing B Sept. 18, 2021, 7:07 p.m. OK Java 8 TESTS 29 140 20787200 1400
129217459 tishrah_ B Sept. 18, 2021, 7:58 p.m. OK Java 8 TESTS 29 140 21606400 1400
129196617 akshaygupta26 B Sept. 18, 2021, 3:43 p.m. OK Java 8 TESTS 29 155 21504000 1400
129216397 dheerajchhatanidc B Sept. 18, 2021, 7:36 p.m. OK Java 8 TESTS 29 170 27852800 1400
129195740 rsingh3_be18 B Sept. 18, 2021, 3:38 p.m. OK Java 8 TESTS 29 171 20480000 1400
129193329 beroul B Sept. 18, 2021, 3:28 p.m. OK Java 8 TESTS 29 171 20787200 1400
129193268 GoldenShadow B Sept. 18, 2021, 3:27 p.m. OK Java 8 TESTS 29 171 21606400 1400
129200732 Akram-Adel B Sept. 18, 2021, 4:04 p.m. OK Java 8 TESTS 29 186 21811200 1400
129214728 rahul_dce B Sept. 18, 2021, 7:07 p.m. OK Java 8 TESTS 29 186 26316800 1400
129208475 amanpatel23 B Sept. 18, 2021, 5:35 p.m. OK Kotlin TESTS 29 218 28467200 1400
129205317 Gompu123 B Sept. 18, 2021, 4:26 p.m. OK Kotlin TESTS 29 233 27955200 1400
129192291 Atul2608 B Sept. 18, 2021, 3:24 p.m. OK Kotlin TESTS 29 296 40345600 1400
129205286 Bobko B Sept. 18, 2021, 4:26 p.m. OK Kotlin TESTS 29 327 29286400 1400
129200218 linxiaotian B Sept. 18, 2021, 4:02 p.m. OK Kotlin TESTS 29 373 39628800 1400
129198317 TANGPE1HUA B Sept. 18, 2021, 3:52 p.m. OK MS C++ 2017 TESTS 29 77 4505600 1400
129198094 ljkljkljk B Sept. 18, 2021, 3:51 p.m. OK MS C++ 2017 TESTS 29 109 5324800 1400
129212783 Tangerine B Sept. 18, 2021, 6:35 p.m. OK MS C++ 2017 TESTS 29 140 4505600 1400
129233389 Liniou B Sept. 19, 2021, 5:23 a.m. OK MS C++ 2017 TESTS 29 155 5324800 1400
129213658 Tangerine B Sept. 18, 2021, 6:49 p.m. OK MS C++ 2017 TESTS 29 156 4505600 1400
129214143 d3l3t3_my_l1f3 B Sept. 18, 2021, 6:56 p.m. OK MS C++ 2017 TESTS 29 170 6041600 1400
129213791 Tangerine B Sept. 18, 2021, 6:51 p.m. OK MS C++ 2017 TESTS 29 171 4505600 1400
129213741 Tangerine B Sept. 18, 2021, 6:50 p.m. OK MS C++ 2017 TESTS 29 171 4505600 1400
129204347 FLself B Sept. 18, 2021, 4:21 p.m. OK MS C++ 2017 TESTS 29 171 5324800 1400
129195295 psn2706 B Sept. 18, 2021, 3:36 p.m. OK MS C++ 2017 TESTS 29 171 6144000 1400
129191016 Liswiera B Sept. 18, 2021, 3:20 p.m. OK .NET Core C# TESTS 29 139 22732800 1400
129193220 kakel_san B Sept. 18, 2021, 3:27 p.m. OK .NET Core C# TESTS 29 140 27238400 1400
129203780 e.ramos B Sept. 18, 2021, 4:18 p.m. OK .NET Core C# TESTS 29 171 28672000 1400
129190945 acorn11 B Sept. 18, 2021, 3:19 p.m. OK PyPy 2 TESTS 29 327 32256000 1400
129203981 ossau_guildo B Sept. 18, 2021, 4:19 p.m. OK PyPy 2 TESTS 29 358 41881600 1400
129229520 roshogolla B Sept. 19, 2021, 3:44 a.m. OK PyPy 3 TESTS 29 171 34508800 1400
129225589 vaibhav_india B Sept. 19, 2021, 1:39 a.m. OK PyPy 3 TESTS 29 202 31436800 1400
129226799 RANK1ZEN B Sept. 19, 2021, 2:21 a.m. OK PyPy 3 TESTS 29 217 38912000 1400
129211887 oadey89 B Sept. 18, 2021, 6:22 p.m. OK PyPy 3 TESTS 29 233 34304000 1400
129224755 ben_dover B Sept. 19, 2021, 1:04 a.m. OK PyPy 3 TESTS 29 233 34816000 1400
129229503 Melmetal B Sept. 19, 2021, 3:44 a.m. OK PyPy 3 TESTS 29 234 39116800 1400
129218384 ben_dover B Sept. 18, 2021, 8:20 p.m. OK PyPy 3 TESTS 29 248 34918400 1400
129190913 Seoul B Sept. 18, 2021, 3:19 p.m. OK PyPy 3 TESTS 29 249 33382400 1400
129195596 FrozenKandy B Sept. 18, 2021, 3:37 p.m. OK PyPy 3 TESTS 29 264 32768000 1400
129194836 brthyyjp B Sept. 18, 2021, 3:34 p.m. OK PyPy 3 TESTS 29 264 34406400 1400
129221276 r57shell B Sept. 18, 2021, 10:08 p.m. OK Python 3 TESTS 29 202 16486400 1400
129192788 K.goyal B Sept. 18, 2021, 3:26 p.m. OK Python 3 TESTS 29 233 20275200 1400
129204708 tassei903 B Sept. 18, 2021, 4:23 p.m. OK Python 3 TESTS 29 248 16486400 1400
129191993 Lord_vaibhav B Sept. 18, 2021, 3:23 p.m. OK Python 3 TESTS 29 249 16384000 1400
129195677 rj32 B Sept. 18, 2021, 3:38 p.m. OK Python 3 TESTS 29 265 16486400 1400
129202058 Judgelaw B Sept. 18, 2021, 4:10 p.m. OK Python 3 TESTS 29 280 16486400 1400
129209468 amanpro_grammer B Sept. 18, 2021, 5:46 p.m. OK Python 3 TESTS 29 280 18124800 1400
129201934 NS3081992 B Sept. 18, 2021, 4:09 p.m. OK Python 3 TESTS 29 280 19148800 1400
129227622 kawayiQuasimodo B Sept. 19, 2021, 2:47 a.m. OK Python 3 TESTS 29 295 16384000 1400
129195968 akshpan B Sept. 18, 2021, 3:39 p.m. OK Python 3 TESTS 29 295 23654400 1400
129211168 hmmnrst B Sept. 18, 2021, 6:12 p.m. OK Ruby 3 TESTS 29 577 60313600 1400
129209333 SorKierkegaard B Sept. 18, 2021, 5:45 p.m. OK Rust TESTS 29 78 13414400 1400
129228993 kobae964 B Sept. 19, 2021, 3:30 a.m. OK Rust TESTS 29 156 5427200 1400
129212848 IvanDyachenko B Sept. 18, 2021, 6:36 p.m. OK Scala TESTS 29 546 40960000 1400
129203555 IvanDyachenko B Sept. 18, 2021, 4:17 p.m. OK Scala TESTS 29 607 40960000 1400

remove filters

Back to search problems