Codeforces Round 939 (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
1956 Codeforces Round 939 (Div. 2) FINISHED False 7200 18804299 April 13, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3944 ) D Nene and the Mex Operator PROGRAMMING bitmasks brute force constructive algorithms divide and conquer dp greedy implementation

B"Nene gave you an array of integers a_1, a_2, ldots, a_n of length n . You can perform the following operation no more than 5 cdot 10^5 times (possibly zero): Here, operatorname{MEX} of a set of integers {c_1, c_2, ldots, c_k } is defined as the smallest non-negative integer m which does not occur in the set c . Your goal is to maximize the sum of the elements of the array a . Find the maximum sum and construct a sequence of operations that achieves this sum. Note that you don't need to minimize the number of operations in this sequence, you only should use no more than 5 cdot 10^5 operations in your solution. The first line contains an integer n ( 1 <= n <= 18 ) -- the length of the array a . The second line contains n integers a_1,a_2, ldots,a_n ( 0 <= q a_i <= q 10^7 ) -- the array a . In the first line, output two integers s and m ( 0 <= m <= 5 cdot 10^5 ) -- the maximum sum of elements of the array a and the number of operations in your solution. In the i -th of the following m lines, output two integers l and r ( 1 <= l <= r <= n ), representing the parameters of the i -th operation. It can be shown that the maximum sum of elements of the array a can always be obtained in no more than 5 cdot 10^5 operations. In the first example, after the operation with l=1 and r=2 the array a becomes equal to [2,2] . It can be shown that it is impossible to achieve a larger sum of the elements of a , so the answer is 4 . In the second example, the initial sum of elements is 13 which can be shown to be the largest. In the third example, the array a changes as follows: It can be shown that it is impossible to achieve a larger sum of the elements of a , so the answer is 105 . "...

Tutorials

[Editorial] Codeforces Round 939 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
256584203 g1ove D April 14, 2024, 2:43 a.m. OK C++14 (GCC 6-32) TESTS 42 61 8089600
256597050 yumingsk D April 14, 2024, 5:54 a.m. OK C++14 (GCC 6-32) TESTS 42 78 102400
256531486 Austin_Griffin2 D April 13, 2024, 4:20 p.m. OK C++14 (GCC 6-32) TESTS 42 92 102400
256535068 antguz D April 13, 2024, 4:28 p.m. OK C++14 (GCC 6-32) TESTS 42 93 102400
256537218 DaNeK0201 D April 13, 2024, 4:32 p.m. OK C++14 (GCC 6-32) TESTS 42 93 5017600
256588255 FAKUMARER D April 14, 2024, 3:52 a.m. OK C++14 (GCC 6-32) TESTS 42 93 9728000
256530901 hqmm D April 13, 2024, 4:19 p.m. OK C++14 (GCC 6-32) TESTS 42 93 12083200
256579582 Foolish_szc D April 14, 2024, 1:20 a.m. OK C++14 (GCC 6-32) TESTS 42 108 102400
256547592 srijon51 D April 13, 2024, 6:01 p.m. OK C++14 (GCC 6-32) TESTS 42 108 1126400
256544564 HarshJ1234568 D April 13, 2024, 5:41 p.m. OK C++14 (GCC 6-32) TESTS 42 108 2662400
256585616 JoesSR_ D April 14, 2024, 3:08 a.m. OK C++17 (GCC 7-32) TESTS 42 77 102400
256576617 daniel604 D April 14, 2024, 12:18 a.m. OK C++17 (GCC 7-32) TESTS 42 77 102400
256550666 Drew_ D April 13, 2024, 6:23 p.m. OK C++17 (GCC 7-32) TESTS 42 77 102400
256545763 Flysky701 D April 13, 2024, 5:48 p.m. OK C++17 (GCC 7-32) TESTS 42 77 102400
256567803 Short_Bit D April 13, 2024, 9:24 p.m. OK C++17 (GCC 7-32) TESTS 42 77 1638400
256531874 penguin34 D April 13, 2024, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 42 77 4096000
256585201 Amdadul D April 14, 2024, 3 a.m. OK C++17 (GCC 7-32) TESTS 42 77 5836800
256565133 utshab1618 D April 13, 2024, 8:47 p.m. OK C++17 (GCC 7-32) TESTS 42 78 102400
256537809 RakibJoy D April 13, 2024, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 42 78 102400
256533547 ay13 D April 13, 2024, 4:25 p.m. OK C++17 (GCC 7-32) TESTS 42 78 102400
256577097 FakeDuck D April 14, 2024, 12:29 a.m. OK C++20 (GCC 13-64) TESTS 42 62 614400
256565562 utshab1618 D April 13, 2024, 8:52 p.m. OK C++20 (GCC 13-64) TESTS 42 62 614400
256546128 MCdyc D April 13, 2024, 5:51 p.m. OK C++20 (GCC 13-64) TESTS 42 62 614400
256544267 Aicu D April 13, 2024, 5:39 p.m. OK C++20 (GCC 13-64) TESTS 42 62 614400
256556168 yud08 D April 13, 2024, 7:07 p.m. OK C++20 (GCC 13-64) TESTS 42 62 3686400
256544398 _CHO D April 13, 2024, 5:40 p.m. OK C++20 (GCC 13-64) TESTS 42 62 11776000
256554496 ONISINO D April 13, 2024, 6:53 p.m. OK C++20 (GCC 13-64) TESTS 42 77 102400
256582835 shinzanmono D April 14, 2024, 2:18 a.m. OK C++20 (GCC 13-64) TESTS 42 77 614400
256580032 shinzanmono D April 14, 2024, 1:29 a.m. OK C++20 (GCC 13-64) TESTS 42 77 614400
256579174 CodeChild D April 14, 2024, 1:12 a.m. OK C++20 (GCC 13-64) TESTS 42 77 614400
256530390 Termodinamico D April 13, 2024, 4:18 p.m. OK GNU C11 TESTS 42 811 921600
256587201 Specter_TheUnchained D April 14, 2024, 3:35 a.m. OK Go TESTS 42 109 27340800
256564548 lorenzotinfena D April 13, 2024, 8:39 p.m. OK Go TESTS 42 171 21401600
256565401 lorenzotinfena D April 13, 2024, 8:50 p.m. OK Go TESTS 42 171 21504000
256566821 lorenzotinfena D April 13, 2024, 9:10 p.m. OK Go TESTS 42 202 11571200
256532987 nguyenquocthao00 D April 13, 2024, 4:24 p.m. OK Go TESTS 42 389 16076800
256538837 aditya_coder07 D April 13, 2024, 4:34 p.m. OK Go TESTS 42 515 22118400
256560344 profchi D April 13, 2024, 7:52 p.m. OK Java 21 TESTS 42 281 921600
256544503 Quasicoherent D April 13, 2024, 5:40 p.m. OK Java 21 TESTS 42 374 4812800
256534851 WORTH D April 13, 2024, 4:28 p.m. OK Java 21 TESTS 42 405 1433600
256559242 Utsav82 D April 13, 2024, 7:40 p.m. OK Java 21 TESTS 42 452 14336000
256557524 Utsav82 D April 13, 2024, 7:21 p.m. OK Java 21 TESTS 42 467 13926400
256542966 Nour D April 13, 2024, 5:33 p.m. OK Java 21 TESTS 42 546 12288000
256530602 taran_1407 D April 13, 2024, 4:18 p.m. OK Java 21 TESTS 42 577 10240000
256559985 vaiibhav75 D April 13, 2024, 7:48 p.m. OK Java 21 TESTS 42 827 23244800
256547331 is_this_greedy D April 13, 2024, 5:59 p.m. OK Java 21 TESTS 42 874 13107200
256575159 vatsal_04 D April 13, 2024, 11:46 p.m. OK Java 8 TESTS 42 405 0
256535127 harwinvanak2 D April 13, 2024, 4:28 p.m. OK Java 8 TESTS 42 405 6144000
256544028 Yousef_Badr D April 13, 2024, 5:38 p.m. OK Java 8 TESTS 42 468 28979200
256583694 Sn_9 D April 14, 2024, 2:33 a.m. OK Java 8 TESTS 42 1421 6348800
256592635 aayush.mishra D April 14, 2024, 5:01 a.m. OK Kotlin 1.9 TESTS 42 718 307200
256594399 aayush.mishra D April 14, 2024, 5:24 a.m. OK Kotlin 1.9 TESTS 42 921 2867200
256543062 Javier1403 D April 13, 2024, 5:33 p.m. OK Kotlin 1.9 TESTS 42 1421 7065600
256549588 sushmanth.dampur8780 D April 13, 2024, 6:15 p.m. OK PyPy 3 TESTS 42 921 69120000
256585747 RobinFromTheHood D April 14, 2024, 3:10 a.m. OK PyPy 3-64 TESTS 42 296 24780800
256556071 Synaptic_Savant D April 13, 2024, 7:06 p.m. OK PyPy 3-64 TESTS 42 296 39321600
256581466 mikeac D April 14, 2024, 1:53 a.m. OK PyPy 3-64 TESTS 42 311 16281600
256585564 RobinFromTheHood D April 14, 2024, 3:07 a.m. OK PyPy 3-64 TESTS 42 312 220467200
256565957 tu144x D April 13, 2024, 8:58 p.m. OK PyPy 3-64 TESTS 42 327 14336000
256552445 AyuAnchor D April 13, 2024, 6:36 p.m. OK PyPy 3-64 TESTS 42 342 14643200
256543667 CinaDor D April 13, 2024, 5:36 p.m. OK PyPy 3-64 TESTS 42 342 22937600
256585390 naruto7uzumaki D April 14, 2024, 3:04 a.m. OK PyPy 3-64 TESTS 42 358 14643200
256550173 Remineva D April 13, 2024, 6:19 p.m. OK PyPy 3-64 TESTS 42 421 21401600
256563046 khan_ali D April 13, 2024, 8:22 p.m. OK PyPy 3-64 TESTS 42 421 26316800
256549791 jinyiqi D April 13, 2024, 6:16 p.m. OK Python 3 TESTS 42 577 102400
256537914 mouyurong22 D April 13, 2024, 4:33 p.m. OK Python 3 TESTS 42 1483 3072000
256560920 kost D April 13, 2024, 7:58 p.m. OK Rust 2021 TESTS 42 62 3686400
256555552 gkawa D April 13, 2024, 7:02 p.m. OK Rust 2021 TESTS 42 468 9932800

remove filters

Back to search problems