Codeforces Round 790 (Div. 4)

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
1676 Codeforces Round 790 (Div. 4) FINISHED False 7200 84986063 May 10, 2022, 2:45 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 11204 ) H2 Maximum Crossings (Hard Version) PROGRAMMING data structures divide and conquer sortings

B"The only difference between the two versions is that in this version n <= q 2 cdot 10^5 and the sum of n over all test cases does not exceed 2 cdot 10^5 . A terminal is a row of n equal segments numbered 1 to n in order. There are two terminals, one above the other. You are given an array a of length n . For all i = 1, 2, ... , n , there should be a straight wire from some point on segment i of the top terminal to some point on segment a_i of the bottom terminal. You can't select the endpoints of a segment. For example, the following pictures show two possible wirings if n=7 and a=[4,1,4,6,7,7,5] . A crossing occurs when two wires share a point in common. In the picture above, crossings are circled in red. What is the maximum number of crossings there can be if you place the wires optimally? The first line contains an integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. The first line of each test case contains an integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the length of the array. The second line of each test case contains n integers a_1, a_2, ... , a_n ( 1 <= q a_i <= q n ) -- the elements of the array. The sum of n across all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer -- the maximum number of crossings there can be if you place the wires optimally. The first test case is shown in the second picture in the statement. In the second test case, the only wiring possible has the two wires cross, so the answer is 1 . In the third test case, the only wiring possible has one wire, so the answer is 0 . "...

Tutorials

Codeforces Round #790 (Div. 4) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
156872230 bluemegane H2 May 11, 2022, 10:41 p.m. OK C# 8 TESTS 16 124 35123200
156853264 Yewandou H2 May 11, 2022, 4:53 p.m. OK Clang++17 Diagnostics TESTS 16 264 2662400
156866184 Denor H2 May 11, 2022, 8:02 p.m. OK Delphi TESTS 16 140 7270400
156885708 yiwu H2 May 12, 2022, 5:19 a.m. OK GNU C++14 TESTS 16 46 1638400
156823750 Canace_HKF H2 May 11, 2022, 11:25 a.m. OK GNU C++14 TESTS 16 46 4403200
156794879 5k_sync_closer H2 May 11, 2022, 8:11 a.m. OK GNU C++14 TESTS 16 62 819200
156793829 jm_28 H2 May 11, 2022, 7:57 a.m. OK GNU C++14 TESTS 16 62 819200
156793539 Chaiki_Cage H2 May 11, 2022, 7:53 a.m. OK GNU C++14 TESTS 16 62 819200
156793306 5k_sync_closer H2 May 11, 2022, 7:51 a.m. OK GNU C++14 TESTS 16 62 819200
156878904 Xerxes_2002 H2 May 12, 2022, 2:47 a.m. OK GNU C++14 TESTS 16 62 1536000
156877670 zqiceberg H2 May 12, 2022, 2:15 a.m. OK GNU C++14 TESTS 16 62 1638400
156832265 walk_alone H2 May 11, 2022, 12:51 p.m. OK GNU C++14 TESTS 16 62 1638400
156822400 100476241 H2 May 11, 2022, 11:11 a.m. OK GNU C++14 TESTS 16 62 1638400
156799160 qwertyyuu H2 May 11, 2022, 9:01 a.m. OK GNU C++17 TESTS 16 46 819200
156879991 vegetable7 H2 May 12, 2022, 3:17 a.m. OK GNU C++17 TESTS 16 46 1638400
156830698 Vishnu_1105 H2 May 11, 2022, 12:35 p.m. OK GNU C++17 TESTS 16 46 1638400
156788096 kobeforces H2 May 11, 2022, 6:46 a.m. OK GNU C++17 TESTS 16 46 1638400
156825183 huangzaiyi H2 May 11, 2022, 11:40 a.m. OK GNU C++17 TESTS 16 46 2457600
156822120 Haruka_rue H2 May 11, 2022, 11:08 a.m. OK GNU C++17 TESTS 16 46 3174400
156855860 Aktgb_31 H2 May 11, 2022, 5:30 p.m. OK GNU C++17 TESTS 16 61 819200
156850342 redcoderITM H2 May 11, 2022, 4:15 p.m. OK GNU C++17 TESTS 16 61 3174400
156872030 Java H2 May 11, 2022, 10:34 p.m. OK GNU C++17 TESTS 16 62 819200
156866010 maxore44 H2 May 11, 2022, 7:59 p.m. OK GNU C++17 TESTS 16 62 819200
156888000 errorgorn H2 May 12, 2022, 5:59 a.m. OK GNU C++17 (64) TESTS 16 31 3174400
156823781 KumaREBEL H2 May 11, 2022, 11:26 a.m. OK GNU C++17 (64) TESTS 16 31 3174400
156864715 Nanako H2 May 11, 2022, 7:36 p.m. OK GNU C++17 (64) TESTS 16 46 1638400
156854521 SakiBee H2 May 11, 2022, 5:11 p.m. OK GNU C++17 (64) TESTS 16 46 1638400
156847180 xprezzzboi H2 May 11, 2022, 3:37 p.m. OK GNU C++17 (64) TESTS 16 46 1638400
156843858 ironmans H2 May 11, 2022, 2:55 p.m. OK GNU C++17 (64) TESTS 16 46 1638400
156842274 ferrari430 H2 May 11, 2022, 2:36 p.m. OK GNU C++17 (64) TESTS 16 46 1638400
156837712 NuclearWinter H2 May 11, 2022, 1:46 p.m. OK GNU C++17 (64) TESTS 16 46 1638400
156819385 jagerknight H2 May 11, 2022, 10:35 a.m. OK GNU C++17 (64) TESTS 16 46 1638400
156816958 Win_Handsome H2 May 11, 2022, 10:08 a.m. OK GNU C++17 (64) TESTS 16 46 1638400
156880407 The_laughter H2 May 12, 2022, 3:28 a.m. OK GNU C++20 (64) TESTS 16 31 1638400
156879836 bin_s H2 May 12, 2022, 3:12 a.m. OK GNU C++20 (64) TESTS 16 31 1638400
156858339 Denisov H2 May 11, 2022, 6 p.m. OK GNU C++20 (64) TESTS 16 31 1638400
156827522 ScarletS H2 May 11, 2022, 12:03 p.m. OK GNU C++20 (64) TESTS 16 31 1638400
156825791 zacharychao H2 May 11, 2022, 11:46 a.m. OK GNU C++20 (64) TESTS 16 31 1638400
156816238 apoorv_me H2 May 11, 2022, 9:59 a.m. OK GNU C++20 (64) TESTS 16 31 1638400
156815641 apoorv_me H2 May 11, 2022, 9:52 a.m. OK GNU C++20 (64) TESTS 16 31 1638400
156846541 Ormlis H2 May 11, 2022, 3:29 p.m. OK GNU C++20 (64) TESTS 16 31 2457600
156831588 luogu_bot1 H2 May 11, 2022, 12:44 p.m. OK GNU C++20 (64) TESTS 16 31 2457600
156798254 ikr H2 May 11, 2022, 8:50 a.m. OK GNU C++20 (64) TESTS 16 31 2457600
156851501 amritagg H2 May 11, 2022, 4:30 p.m. OK Java 11 TESTS 16 202 0
156831911 1364354238zxd H2 May 11, 2022, 12:47 p.m. OK Java 11 TESTS 16 217 0
156867294 dhruvil_01 H2 May 11, 2022, 8:24 p.m. OK Java 11 TESTS 16 234 0
156798110 Aaryendra H2 May 11, 2022, 8:48 a.m. OK Java 11 TESTS 16 311 17203200
156861258 srishtik_16 H2 May 11, 2022, 6:40 p.m. OK Java 11 TESTS 16 327 5427200
156861315 rhaena46 H2 May 11, 2022, 6:41 p.m. OK Java 11 TESTS 16 358 5427200
156852875 x21svage H2 May 11, 2022, 4:48 p.m. OK Java 11 TESTS 16 701 0
156866717 adi_7861 H2 May 11, 2022, 8:12 p.m. OK Java 8 TESTS 16 124 0
156857415 govindrajput H2 May 11, 2022, 5:49 p.m. OK Java 8 TESTS 16 140 1843200
156822595 pribic H2 May 11, 2022, 11:14 a.m. OK Java 8 TESTS 16 140 1945600
156798116 alibaba H2 May 11, 2022, 8:48 a.m. OK Java 8 TESTS 16 140 2150400
156880128 ninado_dante H2 May 12, 2022, 3:20 a.m. OK Java 8 TESTS 16 140 63488000
156819348 ttolkku H2 May 11, 2022, 10:35 a.m. OK Java 8 TESTS 16 155 2150400
156787529 kishan963 H2 May 11, 2022, 6:40 a.m. OK Java 8 TESTS 16 155 11878400
156874755 sankcan55 H2 May 12, 2022, 12:31 a.m. OK Java 8 TESTS 16 186 2969600
156848534 sharpen H2 May 11, 2022, 3:53 p.m. OK Java 8 TESTS 16 249 2150400
156879626 gblake31 H2 May 12, 2022, 3:07 a.m. OK Java 8 TESTS 16 342 31334400
156838158 A_Pier H2 May 11, 2022, 1:51 p.m. OK MS C++ 2017 TESTS 16 171 2457600
156815797 XYShaoKang H2 May 11, 2022, 9:54 a.m. OK Node.js TESTS 16 436 36454400
156838559 sakurahashu H2 May 11, 2022, 1:55 p.m. OK PyPy 3-64 TESTS 16 155 28979200
156854196 tyzzi H2 May 11, 2022, 5:06 p.m. OK PyPy 3-64 TESTS 16 186 25395200
156816940 niumeng H2 May 11, 2022, 10:07 a.m. OK PyPy 3-64 TESTS 16 218 20684800
156821296 jainmilind H2 May 11, 2022, 10:58 a.m. OK PyPy 3-64 TESTS 16 218 24678400
156814889 asdsasd H2 May 11, 2022, 9:43 a.m. OK PyPy 3-64 TESTS 16 233 26112000
156855231 econo_mist H2 May 11, 2022, 5:21 p.m. OK PyPy 3-64 TESTS 16 265 21299200
156821128 eshaan123aggarwal H2 May 11, 2022, 10:56 a.m. OK PyPy 3-64 TESTS 16 327 26112000
156844873 Issin H2 May 11, 2022, 3:09 p.m. OK PyPy 3-64 TESTS 16 342 31027200
156854948 notTehlka H2 May 11, 2022, 5:17 p.m. OK PyPy 3-64 TESTS 16 374 28672000
156837212 ktthree H2 May 11, 2022, 1:41 p.m. OK PyPy 3-64 TESTS 16 421 32768000

remove filters

Back to search problems