Codeforces Global Round 24

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
1764 Codeforces Global Round 24 FINISHED False 9000 62351699 Nov. 26, 2022, 2:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 9471 ) C Doremy's City Construction PROGRAMMING constructive algorithms greedy math

B"Doremy's new city is under construction! The city can be regarded as a simple undirected graph with n vertices. The i -th vertex has altitude a_i . Now Doremy is deciding which pairs of vertices should be connected with edges. Due to economic reasons, there should be no self-loops or multiple edges in the graph. Due to safety reasons, there should not be pairwise distinct vertices u , v , and w such that a_u <= q a_v <= q a_w and the edges (u,v) and (v,w) exist. Under these constraints, Doremy would like to know the maximum possible number of edges in the graph. Can you help her? Note that the constructed graph is allowed to be disconnected. The input consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of vertices. The second line of each test case contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^6 ) -- the altitudes of each vertex. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output the maximum possible number of edges in the graph. In the first test case, there can only be at most 3 edges in the graph. A possible construction is to connect (1,3) , (2,3) , (3,4) . In the picture below the red number above node i is a_i . The following list shows all such u , v , w that the edges (u,v) and (v,w) exist. Another possible construction is to connect (1,4) , (2,4) , (3,4) . An unacceptable construction is to connect (1,3) , (2,3) , (2,4) , (3,4) . Because when u=4 , v=2 , w=3 , a_u <= a_v <= a_w holds, and the respective edges exist. "...

Tutorials

Codeforces Global Round 24 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
182684986 ssvb C Nov. 26, 2022, 3:28 p.m. OK D TESTS 14 93 13619200
182684110 ruban C Nov. 26, 2022, 3:24 p.m. OK FPC TESTS 14 187 154316800
182688296 AngryLeaf C Nov. 26, 2022, 3:42 p.m. OK GNU C11 TESTS 14 78 8806400
182697215 1435730 C Nov. 26, 2022, 4:24 p.m. OK GNU C11 TESTS 14 108 819200
182688182 Febleaf C Nov. 26, 2022, 3:41 p.m. OK GNU C++14 TESTS 14 46 819200
182686333 xiaozuo_ C Nov. 26, 2022, 3:33 p.m. OK GNU C++14 TESTS 14 46 7065600
182691294 YoungJayz C Nov. 26, 2022, 3:56 p.m. OK GNU C++14 TESTS 14 61 819200
182689894 computerbox C Nov. 26, 2022, 3:49 p.m. OK GNU C++14 TESTS 14 61 3174400
182678416 blade_dance C Nov. 26, 2022, 3:04 p.m. OK GNU C++14 TESTS 14 61 3993600
182678647 ZhangOscar C Nov. 26, 2022, 3:04 p.m. OK GNU C++14 TESTS 14 61 3993600
182690007 DuongQua2007 C Nov. 26, 2022, 3:50 p.m. OK GNU C++14 TESTS 14 61 11980800
182738453 AIR_COLOR5 C Nov. 27, 2022, 4:20 a.m. OK GNU C++14 TESTS 14 62 819200
182742970 daniel14311531 C Nov. 27, 2022, 5:48 a.m. OK GNU C++14 TESTS 14 62 819200
182743551 Mikey1434 C Nov. 27, 2022, 5:56 a.m. OK GNU C++14 TESTS 14 62 819200
182691452 TamimEhsan C Nov. 26, 2022, 3:56 p.m. OK GNU C++17 TESTS 14 46 819200
182690331 andrei_p C Nov. 26, 2022, 3:51 p.m. OK GNU C++17 TESTS 14 46 2457600
182680640 whitesword C Nov. 26, 2022, 3:11 p.m. OK GNU C++17 TESTS 14 46 7987200
182685167 limabeans C Nov. 26, 2022, 3:29 p.m. OK GNU C++17 TESTS 14 61 819200
182681531 Zawos C Nov. 26, 2022, 3:15 p.m. OK GNU C++17 TESTS 14 61 819200
182696507 Hamine C Nov. 26, 2022, 4:21 p.m. OK GNU C++17 TESTS 14 61 819200
182730883 hasname C Nov. 27, 2022, 12:37 a.m. OK GNU C++17 TESTS 14 61 819200
182717687 BeruboIV C Nov. 26, 2022, 7:47 p.m. OK GNU C++17 TESTS 14 61 1638400
182730982 hy-phantom C Nov. 27, 2022, 12:41 a.m. OK GNU C++17 TESTS 14 61 2457600
182696917 2003_06 C Nov. 26, 2022, 4:23 p.m. OK GNU C++17 TESTS 14 61 3174400
182715921 AkramElOmrani C Nov. 26, 2022, 7:20 p.m. OK GNU C++17 (64) TESTS 14 31 819200
182696792 whhsteven C Nov. 26, 2022, 4:22 p.m. OK GNU C++17 (64) TESTS 14 31 819200
182693738 Whereismybrain C Nov. 26, 2022, 4:08 p.m. OK GNU C++17 (64) TESTS 14 31 2457600
182679810 burak_ozzkan C Nov. 26, 2022, 3:08 p.m. OK GNU C++17 (64) TESTS 14 31 5836800
182739386 BuptNorthRemembers C Nov. 27, 2022, 4:42 a.m. OK GNU C++17 (64) TESTS 14 46 819200
182737302 ReSakura C Nov. 27, 2022, 3:53 a.m. OK GNU C++17 (64) TESTS 14 46 819200
182733782 pursuit_of_happiness C Nov. 27, 2022, 2:14 a.m. OK GNU C++17 (64) TESTS 14 46 819200
182733683 pursuit_of_happiness C Nov. 27, 2022, 2:12 a.m. OK GNU C++17 (64) TESTS 14 46 819200
182733396 PCC C Nov. 27, 2022, 2:03 a.m. OK GNU C++17 (64) TESTS 14 46 819200
182733333 pursuit_of_happiness C Nov. 27, 2022, 2:02 a.m. OK GNU C++17 (64) TESTS 14 46 819200
182732333 pika_qiu C Nov. 27, 2022, 1:26 a.m. OK GNU C++20 (64) TESTS 14 31 819200
182723223 Khaled_Awad66 C Nov. 26, 2022, 9:19 p.m. OK GNU C++20 (64) TESTS 14 31 819200
182711764 Ivan_len C Nov. 26, 2022, 6:29 p.m. OK GNU C++20 (64) TESTS 14 31 819200
182702100 SSerxhs C Nov. 26, 2022, 5:02 p.m. OK GNU C++20 (64) TESTS 14 31 819200
182696909 enzo200325 C Nov. 26, 2022, 4:23 p.m. OK GNU C++20 (64) TESTS 14 31 819200
182696449 Yelarys C Nov. 26, 2022, 4:21 p.m. OK GNU C++20 (64) TESTS 14 31 819200
182686571 Th_K C Nov. 26, 2022, 3:35 p.m. OK GNU C++20 (64) TESTS 14 31 819200
182685886 Asif732 C Nov. 26, 2022, 3:32 p.m. OK GNU C++20 (64) TESTS 14 31 819200
182732983 platelet C Nov. 27, 2022, 1:50 a.m. OK GNU C++20 (64) TESTS 14 31 819200
182738392 TangM C Nov. 27, 2022, 4:19 a.m. OK GNU C++20 (64) TESTS 14 31 819200
182688897 shiro C Nov. 26, 2022, 3:45 p.m. OK Go TESTS 14 109 3481600
182740936 sf14t C Nov. 27, 2022, 5:13 a.m. OK Java 11 TESTS 14 233 0
182707688 bajpaisharanya C Nov. 26, 2022, 5:50 p.m. OK Java 11 TESTS 14 249 0
182687362 mareshkau C Nov. 26, 2022, 3:38 p.m. OK Java 11 TESTS 14 249 0
182683435 Abhishek_patel_ C Nov. 26, 2022, 3:21 p.m. OK Java 11 TESTS 14 249 0
182682585 procrastinate7 C Nov. 26, 2022, 3:18 p.m. OK Java 11 TESTS 14 264 0
182698864 manvendramehrotra C Nov. 26, 2022, 4:31 p.m. OK Java 11 TESTS 14 264 4915200
182716335 doomhammer. C Nov. 26, 2022, 7:26 p.m. OK Java 11 TESTS 14 265 0
182687702 doomhammer. C Nov. 26, 2022, 3:39 p.m. OK Java 11 TESTS 14 265 6144000
182729484 mcrash12 C Nov. 26, 2022, 11:44 p.m. OK Java 11 TESTS 14 280 0
182729825 mcrash12 C Nov. 26, 2022, 11:55 p.m. OK Java 11 TESTS 14 280 0
182703881 Utsav82 C Nov. 26, 2022, 5:15 p.m. OK Java 17 TESTS 14 202 716800
182685847 MrOtter C Nov. 26, 2022, 3:31 p.m. OK Java 17 TESTS 14 233 102400
182716048 yashbhardwaj24 C Nov. 26, 2022, 7:22 p.m. OK Java 17 TESTS 14 249 43417600
182731224 kkz666 C Nov. 27, 2022, 12:50 a.m. OK Java 17 TESTS 14 264 819200
182695843 irachit0702 C Nov. 26, 2022, 4:18 p.m. OK Java 17 TESTS 14 296 8704000
182721077 ghost24601 C Nov. 26, 2022, 8:41 p.m. OK Java 17 TESTS 14 311 14540800
182678867 youtsuha2.0 C Nov. 26, 2022, 3:05 p.m. OK Java 17 TESTS 14 326 3993600
182681169 IceWolf898 C Nov. 26, 2022, 3:13 p.m. OK Java 17 TESTS 14 514 8601600
182704470 Abhinavrajhans C Nov. 26, 2022, 5:20 p.m. OK Java 17 TESTS 14 530 5017600
182712625 simoneponginibbio C Nov. 26, 2022, 6:39 p.m. OK Java 17 TESTS 14 545 1024000
182705545 RahulAhuja2901 C Nov. 26, 2022, 5:29 p.m. OK Java 8 TESTS 14 108 0
182686801 Bahaalization C Nov. 26, 2022, 3:35 p.m. OK Java 8 TESTS 14 139 2560000
182697647 kalsitushar C Nov. 26, 2022, 4:26 p.m. OK Java 8 TESTS 14 140 2252800
182683069 UniversalAdmin C Nov. 26, 2022, 3:20 p.m. OK Java 8 TESTS 14 187 2867200
182713080 mass_2701 C Nov. 26, 2022, 6:45 p.m. OK Java 8 TESTS 14 202 2560000
182735899 -crazy_coder- C Nov. 27, 2022, 3:16 a.m. OK Java 8 TESTS 14 218 12800000
182702069 amit_roy C Nov. 26, 2022, 5:02 p.m. OK Java 8 TESTS 14 249 14950400
182714255 ganesh_6 C Nov. 26, 2022, 6:58 p.m. OK Java 8 TESTS 14 280 12902400
182705163 Eslam_Ahmed C Nov. 26, 2022, 5:26 p.m. OK Java 8 TESTS 14 311 13312000
182714478 Mohamed_A7med C Nov. 26, 2022, 7:01 p.m. OK Java 8 TESTS 14 342 5427200
182681002 habibulka C Nov. 26, 2022, 3:13 p.m. OK Kotlin 1.7 TESTS 14 857 71884800
182690165 Autlomu C Nov. 26, 2022, 3:50 p.m. OK MS C++ 2017 TESTS 14 62 1638400
182683713 the_killah C Nov. 26, 2022, 3:23 p.m. OK MS C++ 2017 TESTS 14 109 1638400
182694504 SmilingBraniac C Nov. 26, 2022, 4:11 p.m. OK MS C++ 2017 TESTS 14 156 819200
182743225 tjdvyzl12345 C Nov. 27, 2022, 5:52 a.m. OK MS C++ 2017 TESTS 14 187 3276800
182702317 McLetchik C Nov. 26, 2022, 5:03 p.m. OK MS C++ 2017 TESTS 14 202 1638400
182693088 gavvah C Nov. 26, 2022, 4:04 p.m. OK MS C++ 2017 TESTS 14 234 10342400
182692392 staryarych C Nov. 26, 2022, 4:01 p.m. OK MS C++ 2017 TESTS 14 295 8089600
182682549 anishde85 C Nov. 26, 2022, 3:18 p.m. OK PyPy 3 TESTS 14 358 20582400
182738450 bpdolson C Nov. 27, 2022, 4:20 a.m. OK PyPy 3 TESTS 14 483 14233600
182725637 tan_delhi C Nov. 26, 2022, 10:05 p.m. OK PyPy 3 TESTS 14 498 26112000
182696061 whitehost C Nov. 26, 2022, 4:19 p.m. OK PyPy 3 TESTS 14 545 13926400
182687335 nicksm C Nov. 26, 2022, 3:38 p.m. OK PyPy 3 TESTS 14 561 30720000
182702087 DrMrogon C Nov. 26, 2022, 5:02 p.m. OK PyPy 3-64 TESTS 14 139 28262400
182695125 HarshitKumarGupta C Nov. 26, 2022, 4:14 p.m. OK PyPy 3-64 TESTS 14 140 22118400
182693937 mrdhnv C Nov. 26, 2022, 4:09 p.m. OK PyPy 3-64 TESTS 14 155 19046400
182728653 biglunchdude C Nov. 26, 2022, 11:18 p.m. OK PyPy 3-64 TESTS 14 155 22528000
182725978 SoleProprietor C Nov. 26, 2022, 10:12 p.m. OK PyPy 3-64 TESTS 14 170 24985600
182689436 Yinch C Nov. 26, 2022, 3:47 p.m. OK PyPy 3-64 TESTS 14 170 27238400
182720113 _tb C Nov. 26, 2022, 8:26 p.m. OK PyPy 3-64 TESTS 14 171 17715200
182728185 biglunchdude C Nov. 26, 2022, 11:04 p.m. OK PyPy 3-64 TESTS 14 171 22528000
182706934 mintplz C Nov. 26, 2022, 5:43 p.m. OK PyPy 3-64 TESTS 14 171 23449600
182686236 Kalyano C Nov. 26, 2022, 3:33 p.m. OK PyPy 3-64 TESTS 14 171 24678400
182694151 xph_4n C Nov. 26, 2022, 4:10 p.m. OK Python 2 TESTS 14 405 13414400
182681163 NS3081992 C Nov. 26, 2022, 3:13 p.m. OK Python 3 TESTS 14 217 14131200
182694115 Namanrockzzz C Nov. 26, 2022, 4:09 p.m. OK Python 3 TESTS 14 233 13516800
182683873 sandesh32 C Nov. 26, 2022, 3:23 p.m. OK Python 3 TESTS 14 233 13926400
182680315 widmenic C Nov. 26, 2022, 3:10 p.m. OK Python 3 TESTS 14 248 13926400
182728409 Sp00kiel C Nov. 26, 2022, 11:11 p.m. OK Python 3 TESTS 14 249 15360000
182693638 NenadDapic C Nov. 26, 2022, 4:07 p.m. OK Python 3 TESTS 14 264 13926400
182694815 Divyanshu_81 C Nov. 26, 2022, 4:13 p.m. OK Python 3 TESTS 14 264 18739200
182697738 Asuma_2014 C Nov. 26, 2022, 4:27 p.m. OK Python 3 TESTS 14 280 10752000
182686789 killcrow C Nov. 26, 2022, 3:35 p.m. OK Python 3 TESTS 14 280 13209600
182680863 taksqth C Nov. 26, 2022, 3:12 p.m. OK Python 3 TESTS 14 280 13926400

remove filters

Back to search problems