Codeforces Round 922 (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
1918 Codeforces Round 922 (Div. 2) FINISHED False 7800 25197899 Jan. 30, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 24003 ) B Minimize Inversions PROGRAMMING constructive algorithms data structures greedy implementation sortings

B"You are given two permutations a and b of length n . A permutation is an array of n elements from 1 to n where all elements are distinct. For example, an array [ 2,1,3 ] is a permutation, but [ 0,1 ] and [ 1,3,1 ] aren't. You can (as many times as you want) choose two indices i and j , then swap a_i with a_j and b_i with b_j simultaneously. You hate inversions, so you want to minimize the total number of inversions in both permutations. An inversion in a permutation p is a pair of indices (i, j) such that i < j and p_i > p_j . For example, if p=[3,1,4,2,5] then there are 3 inversions in it (the pairs of indices are (1,2) , (1,4) and (3,4) ). The first line contains an integer t ( 1 <= q t <= q 20 ,000 ) -- the number of test cases. Each test case consists of three lines. The first line contains an integer n ( 1 <= q n <= q 2 cdot10^5 ) -- the length of the permutations a and b . The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q n ) -- permutation a . The third line contains b in a similar format. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot10^5 . For each test case, output two permutations a' and b' (in the same format as in the input) -- the permutations after all operations. The total number of inversions in a' and b' should be the minimum possible among all pairs of permutations that can be obtained using operations from the statement. If there are multiple solutions, print any of them. In the first test case, the minimum possible number of inversions is 10 . In the second test case, we can sort both permutations at the same time. For this, the following operations can be done: In the third test case, the minimum possible number of inversions is 7 . "...

Tutorials

Codeforces Round #922 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
244188555 bluemegane B Jan. 31, 2024, 1:47 a.m. OK C# 8 TESTS 18 373 45056000
244200780 jinkens B Jan. 31, 2024, 4:39 a.m. OK Clang++17 Diagnostics TESTS 18 701 8192000
244161484 mdadnan B Jan. 30, 2024, 6:57 p.m. OK GNU C11 TESTS 18 1840 1843200
244166367 mdadnan B Jan. 30, 2024, 7:36 p.m. OK GNU C11 TESTS 18 1872 2662400
244165466 mdadnan B Jan. 30, 2024, 7:28 p.m. OK GNU C11 TESTS 18 1872 3481600
244140292 kai_Ker B Jan. 30, 2024, 4:33 p.m. OK GNU C11 TESTS 18 1887 1843200
244177026 Pikaboo_2609 B Jan. 30, 2024, 9:38 p.m. OK GNU C11 TESTS 18 1887 11980800
244176964 Aanvik26 B Jan. 30, 2024, 9:37 p.m. OK GNU C11 TESTS 18 1887 11980800
244142923 shaunak81 B Jan. 30, 2024, 4:39 p.m. OK GNU C11 TESTS 18 1918 2662400
244134709 BROJOPRIYA B Jan. 30, 2024, 4:18 p.m. OK GNU C11 TESTS 18 1933 1638400
244143452 yaswanth_1010 B Jan. 30, 2024, 4:41 p.m. OK GNU C11 TESTS 18 1996 6451200
244194966 whysitansooo B Jan. 31, 2024, 3:21 a.m. OK GNU C++17 TESTS 18 155 1638400
244161431 wEakzzczzczzc B Jan. 30, 2024, 6:57 p.m. OK GNU C++17 TESTS 18 155 1638400
244191683 Juanito98 B Jan. 31, 2024, 2:36 a.m. OK GNU C++17 TESTS 18 155 1638400
244179212 rastkos189 B Jan. 30, 2024, 10:19 p.m. OK GNU C++17 TESTS 18 155 2457600
244171646 xRar B Jan. 30, 2024, 8:28 p.m. OK GNU C++17 TESTS 18 156 1638400
244142853 Calvin65 B Jan. 30, 2024, 4:39 p.m. OK GNU C++17 TESTS 18 156 1638400
244168067 chaitanya07k B Jan. 30, 2024, 7:51 p.m. OK GNU C++17 TESTS 18 156 1638400
244173976 DIvanCode B Jan. 30, 2024, 8:56 p.m. OK GNU C++17 TESTS 18 156 1638400
244191238 jikei257 B Jan. 31, 2024, 2:29 a.m. OK GNU C++17 TESTS 18 156 2355200
244209839 applese B Jan. 31, 2024, 6:01 a.m. OK GNU C++17 TESTS 18 156 2457600
244185258 chappy1 B Jan. 31, 2024, 12:42 a.m. OK GNU C++17 (64) TESTS 18 62 5939200
244196080 escapereality B Jan. 31, 2024, 3:35 a.m. OK GNU C++17 (64) TESTS 18 109 4812800
244196409 chunzhifeng B Jan. 31, 2024, 3:40 a.m. OK GNU C++17 (64) TESTS 18 109 24064000
244189522 wendyasif B Jan. 31, 2024, 2:03 a.m. OK GNU C++17 (64) TESTS 18 124 1638400
244209830 lzyang B Jan. 31, 2024, 6:01 a.m. OK GNU C++17 (64) TESTS 18 124 1638400
244200378 wwxiaoyang B Jan. 31, 2024, 4:33 a.m. OK GNU C++17 (64) TESTS 18 124 1638400
244199394 Md_Minhaj B Jan. 31, 2024, 4:20 a.m. OK GNU C++17 (64) TESTS 18 124 1638400
244197156 dead00 B Jan. 31, 2024, 3:50 a.m. OK GNU C++17 (64) TESTS 18 124 1638400
244193152 lyanl B Jan. 31, 2024, 2:57 a.m. OK GNU C++17 (64) TESTS 18 124 1638400
244187500 Shah59 B Jan. 31, 2024, 1:27 a.m. OK GNU C++17 (64) TESTS 18 124 1638400
244174914 SouhailMightWin B Jan. 30, 2024, 9:08 p.m. OK GNU C++20 (64) TESTS 18 77 8396800
244142805 Has_Aim B Jan. 30, 2024, 4:39 p.m. OK GNU C++20 (64) TESTS 18 78 1638400
244158121 euclidstellar B Jan. 30, 2024, 6:35 p.m. OK GNU C++20 (64) TESTS 18 78 1638400
244154453 erray B Jan. 30, 2024, 6:18 p.m. OK GNU C++20 (64) TESTS 18 78 1638400
244190639 CarlosDaniel111 B Jan. 31, 2024, 2:20 a.m. OK GNU C++20 (64) TESTS 18 78 2457600
244154495 app1e_Dog B Jan. 30, 2024, 6:19 p.m. OK GNU C++20 (64) TESTS 18 78 2457600
244158905 waheed_hanzalah B Jan. 30, 2024, 6:40 p.m. OK GNU C++20 (64) TESTS 18 78 3174400
244182076 AhmedMHarb B Jan. 30, 2024, 11:26 p.m. OK GNU C++20 (64) TESTS 18 78 7168000
244182189 AhmedMHarb B Jan. 30, 2024, 11:29 p.m. OK GNU C++20 (64) TESTS 18 78 7270400
244200993 Chaos_Ljc B Jan. 31, 2024, 4:41 a.m. OK GNU C++20 (64) TESTS 18 93 1638400
244198666 SadFriedRice B Jan. 31, 2024, 4:10 a.m. OK Go TESTS 18 264 7782400
244153774 newborn_23 B Jan. 30, 2024, 6:16 p.m. OK Java 21 TESTS 18 468 21196800
244199587 AkshatSaxena_05 B Jan. 31, 2024, 4:23 a.m. OK Java 21 TESTS 18 483 7475200
244199969 _ShenHua_ B Jan. 31, 2024, 4:28 a.m. OK Java 21 TESTS 18 545 7782400
244203927 java_noob69 B Jan. 31, 2024, 5:04 a.m. OK Java 21 TESTS 18 592 50278400
244144896 nithesh_23 B Jan. 30, 2024, 4:44 p.m. OK Java 21 TESTS 18 639 34611200
244178812 lightblz B Jan. 30, 2024, 10:10 p.m. OK Java 21 TESTS 18 967 716800
244197268 Mr.Mittal B Jan. 31, 2024, 3:52 a.m. OK Java 21 TESTS 18 998 11264000
244200617 efti234 B Jan. 31, 2024, 4:37 a.m. OK Java 21 TESTS 18 1107 7884800
244207096 rajneesh.osho B Jan. 31, 2024, 5:36 a.m. OK Java 21 TESTS 18 1138 28979200
244136972 ravi_prakash29 B Jan. 30, 2024, 4:24 p.m. OK Java 21 TESTS 18 1184 39424000
244205265 naitikvarshney B Jan. 31, 2024, 5:18 a.m. OK Java 8 TESTS 18 327 10342400
244140033 RonWonWon B Jan. 30, 2024, 4:32 p.m. OK Java 8 TESTS 18 358 6758400
244190392 madmax_27 B Jan. 31, 2024, 2:16 a.m. OK Java 8 TESTS 18 374 0
244135793 clcwcxfwf B Jan. 30, 2024, 4:21 p.m. OK Java 8 TESTS 18 420 12800000
244144660 PlayDate B Jan. 30, 2024, 4:43 p.m. OK Java 8 TESTS 18 436 6860800
244136331 Xing_ke B Jan. 30, 2024, 4:23 p.m. OK Java 8 TESTS 18 452 6451200
244141701 lyongwolf B Jan. 30, 2024, 4:36 p.m. OK Java 8 TESTS 18 452 12800000
244138871 saumya2004 B Jan. 30, 2024, 4:29 p.m. OK Java 8 TESTS 18 483 4505600
244201588 gdax B Jan. 31, 2024, 4:49 a.m. OK Java 8 TESTS 18 1450 5734400
244201356 rufus_c B Jan. 31, 2024, 4:46 a.m. OK Java 8 TESTS 18 1606 4403200
244141949 mircea85 B Jan. 30, 2024, 4:37 p.m. OK Mono C# TESTS 18 436 40243200
244190553 aluckyboy B Jan. 31, 2024, 2:19 a.m. OK MS C++ 2017 TESTS 18 373 80281600
244190624 aluckyboy B Jan. 31, 2024, 2:19 a.m. OK MS C++ 2017 TESTS 18 374 80281600
244192401 aluckyboy B Jan. 31, 2024, 2:46 a.m. OK MS C++ 2017 TESTS 18 389 80281600
244191207 aluckyboy B Jan. 31, 2024, 2:28 a.m. OK MS C++ 2017 TESTS 18 390 80281600
244190442 aluckyboy B Jan. 31, 2024, 2:17 a.m. OK MS C++ 2017 TESTS 18 421 160460800
244174600 captainbuggy B Jan. 30, 2024, 9:04 p.m. OK MS C++ 2017 TESTS 18 530 3174400
244175973 IITeens B Jan. 30, 2024, 9:23 p.m. OK MS C++ 2017 TESTS 18 561 4812800
244205110 fww B Jan. 31, 2024, 5:16 a.m. OK MS C++ 2017 TESTS 18 577 1638400
244174788 captainbuggy B Jan. 30, 2024, 9:07 p.m. OK MS C++ 2017 TESTS 18 577 3174400
244203554 piyush138003 B Jan. 31, 2024, 5 a.m. OK MS C++ 2017 TESTS 18 592 3174400
244190188 brunocalza B Jan. 31, 2024, 2:13 a.m. OK PyPy 2 TESTS 18 873 23449600
244183204 plevande B Jan. 30, 2024, 11:56 p.m. OK PyPy 3 TESTS 18 451 37683200
244192441 nealzane B Jan. 31, 2024, 2:47 a.m. OK PyPy 3 TESTS 18 1075 33280000
244180400 momenelmesady4803 B Jan. 30, 2024, 10:46 p.m. OK PyPy 3 TESTS 18 1170 25497600
244139848 suraerturkmen B Jan. 30, 2024, 4:32 p.m. OK PyPy 3 TESTS 18 1185 28672000
244153781 fireSlayer57 B Jan. 30, 2024, 6:16 p.m. OK PyPy 3 TESTS 18 1310 35737600
244173445 4rn4vg B Jan. 30, 2024, 8:50 p.m. OK PyPy 3 TESTS 18 1341 20684800
244154049 DrCoder9146 B Jan. 30, 2024, 6:17 p.m. OK PyPy 3 TESTS 18 1341 31948800
244187434 TychoElling B Jan. 31, 2024, 1:26 a.m. OK PyPy 3 TESTS 18 1512 37273600
244135510 Elmurat B Jan. 30, 2024, 4:21 p.m. OK PyPy 3 TESTS 18 1544 35328000
244161320 the_last_smilodon B Jan. 30, 2024, 6:56 p.m. OK PyPy 3-64 TESTS 18 155 23244800
244160993 the_last_smilodon B Jan. 30, 2024, 6:53 p.m. OK PyPy 3-64 TESTS 18 170 26828800
244160735 the_last_smilodon B Jan. 30, 2024, 6:52 p.m. OK PyPy 3-64 TESTS 18 171 27238400
244160443 the_last_smilodon B Jan. 30, 2024, 6:50 p.m. OK PyPy 3-64 TESTS 18 186 31846400
244160074 the_last_smilodon B Jan. 30, 2024, 6:47 p.m. OK PyPy 3-64 TESTS 18 187 31641600
244161837 the_last_smilodon B Jan. 30, 2024, 7 p.m. OK PyPy 3-64 TESTS 18 202 27340800
244159728 the_last_smilodon B Jan. 30, 2024, 6:45 p.m. OK PyPy 3-64 TESTS 18 202 34099200
244159032 the_last_smilodon B Jan. 30, 2024, 6:41 p.m. OK PyPy 3-64 TESTS 18 217 31436800
244158146 the_last_smilodon B Jan. 30, 2024, 6:35 p.m. OK PyPy 3-64 TESTS 18 249 32972800
244160286 the_last_smilodon B Jan. 30, 2024, 6:48 p.m. OK PyPy 3-64 TESTS 18 280 31846400
244154440 OLOGY B Jan. 30, 2024, 6:18 p.m. OK Python 2 TESTS 18 670 30720000
244197441 MooKrata B Jan. 31, 2024, 3:54 a.m. OK Python 3 TESTS 18 530 49664000
244162639 sabb1r B Jan. 30, 2024, 7:06 p.m. OK Python 3 TESTS 18 561 58265600
244168480 Murad134 B Jan. 30, 2024, 7:56 p.m. OK Python 3 TESTS 18 654 35635200
244193525 muminurfahim B Jan. 31, 2024, 3:02 a.m. OK Python 3 TESTS 18 654 35737600
244136124 DeadMan69 B Jan. 30, 2024, 4:22 p.m. OK Python 3 TESTS 18 655 41472000
244209551 2110030283 B Jan. 31, 2024, 5:58 a.m. OK Python 3 TESTS 18 670 35737600
244201853 Cipherer B Jan. 31, 2024, 4:52 a.m. OK Python 3 TESTS 18 670 41369600
244139871 shreyajha_ B Jan. 30, 2024, 4:32 p.m. OK Python 3 TESTS 18 685 39936000
244193076 UnknownPlanet B Jan. 31, 2024, 2:56 a.m. OK Python 3 TESTS 18 686 35635200
244139968 CMRIT25_21R01A05H0 B Jan. 30, 2024, 4:32 p.m. OK Python 3 TESTS 18 717 36556800

remove filters

Back to search problems