Codeforces Round 881 (Div. 3)

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
1843 Codeforces Round 881 (Div. 3) FINISHED False 8100 49994663 June 20, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 29604 ) B Long Long PROGRAMMING greedy math

B'Today Alex was brought array a_1, a_2, ... , a_n of length n . He can apply as many operations as he wants (including zero operations) to change the array elements. In 1 operation Alex can choose any l and r such that 1 <= q l <= q r <= q n , and multiply all elements of the array from l to r inclusive by -1 . In other words, Alex can replace the subarray [a_l, a_{l + 1}, ... , a_r] by [-a_l, -a_{l + 1}, ... , -a_r] in 1 operation. For example, let n = 5 , the array is [1, -2, 0, 3, -1] , l = 2 and r = 4 , then after the operation the array will be [1, 2, 0, -3, -1] . Alex is late for school, so you should help him find the maximum possible sum of numbers in the array, which can be obtained by making any number of operations, as well as the minimum number of operations that must be done for this. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- number of test cases. Then the descriptions of the test cases follow. The first line of each test case contains one integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- length of the array. The second line contains n integers a_1, a_2, ... , a_n ( -10^9 <= q a_i <= q 10^9 ) -- elements of the array. It is guaranteed that the sum of n for all test cases does not exceed 2 cdot 10^5 . For each test case output two space-separated numbers: the maximum possible sum of numbers in the array and the minimum number of operations to get this sum. Pay attention that an answer may not fit in a standard integer type, so do not forget to use 64-bit integer type. Below, for each test case, only one of the possible shortest sequences of operations is provided among many. There are others that have the same length and lead to the maximum sum of elements. In the first test case, Alex can make operations: (1, 4) , (2, 2) , (6, 6) . In the second test case, to'...

Tutorials

Codeforces Round #881 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
210566069 ADNAN_ B June 21, 2023, 3:46 p.m. OK C# 10 TESTS 21 93 20275200
210521425 SirTterr B June 21, 2023, 8:34 a.m. OK Clang++17 Diagnostics TESTS 21 1029 19456000
210521570 SirTterr B June 21, 2023, 8:36 a.m. OK Clang++17 Diagnostics TESTS 21 1045 19456000
210612641 wz_fisher B June 22, 2023, 3:39 a.m. OK Clang++17 Diagnostics TESTS 21 1107 1024000
210612395 wz_fisher B June 22, 2023, 3:35 a.m. OK Clang++17 Diagnostics TESTS 21 1325 1024000
210517019 openJDK B June 21, 2023, 7:51 a.m. OK Clang++20 Diagnostics TESTS 21 982 819200
210555317 tranduyquan B June 21, 2023, 2:06 p.m. OK Clang++20 Diagnostics TESTS 21 1107 819200
210505103 tmywsh B June 21, 2023, 4:56 a.m. OK GNU C11 TESTS 21 93 0
210578949 MohaiMinul2002 B June 21, 2023, 6:02 p.m. OK GNU C11 TESTS 21 93 819200
210585165 niloychowdhury B June 21, 2023, 7:25 p.m. OK GNU C11 TESTS 21 124 1638400
210507507 LighterBird B June 21, 2023, 5:36 a.m. OK GNU C11 TESTS 21 124 1843200
210593561 prithbi07 B June 21, 2023, 9:19 p.m. OK GNU C11 TESTS 21 139 2355200
210501176 ehdxbc B June 21, 2023, 3:44 a.m. OK GNU C11 TESTS 21 311 819200
210556332 wahahayyds B June 21, 2023, 2:14 p.m. OK GNU C11 TESTS 21 702 819200
210559543 bug_coder B June 21, 2023, 2:44 p.m. OK GNU C++14 TESTS 21 15 2867200
210528500 Unari B June 21, 2023, 9:40 a.m. OK GNU C++14 TESTS 21 31 8089600
210607738 Mr_White_ B June 22, 2023, 2:07 a.m. OK GNU C++14 TESTS 21 46 819200
210558985 Sheeep B June 21, 2023, 2:38 p.m. OK GNU C++14 TESTS 21 46 819200
210577118 mohammad_ruhullah B June 21, 2023, 5:41 p.m. OK GNU C++14 TESTS 21 61 921600
210534258 raihanwahid16 B June 21, 2023, 10:40 a.m. OK GNU C++14 TESTS 21 61 3174400
210506553 PCC B June 21, 2023, 5:20 a.m. OK GNU C++14 TESTS 21 62 0
210552122 Ikila07 B June 21, 2023, 1:35 p.m. OK GNU C++14 TESTS 21 62 0
210573010 xtxk B June 21, 2023, 4:55 p.m. OK GNU C++14 TESTS 21 62 819200
210565327 Chen_Jinhui B June 21, 2023, 3:39 p.m. OK GNU C++14 TESTS 21 62 819200
210579078 Edgar_Criged B June 21, 2023, 6:04 p.m. OK GNU C++17 TESTS 21 46 0
210492394 yyytf__ B June 21, 2023, 12:20 a.m. OK GNU C++17 TESTS 21 46 921600
210516544 Trinabh B June 21, 2023, 7:46 a.m. OK GNU C++17 TESTS 21 46 1536000
210528885 Vageto B June 21, 2023, 9:44 a.m. OK GNU C++17 TESTS 21 61 0
210519835 ahmmed_asaad B June 21, 2023, 8:18 a.m. OK GNU C++17 TESTS 21 61 0
210576219 Sadid_005 B June 21, 2023, 5:31 p.m. OK GNU C++17 TESTS 21 61 0
210575110 Just__Youssef B June 21, 2023, 5:19 p.m. OK GNU C++17 TESTS 21 61 0
210584609 karelispanagiotis B June 21, 2023, 7:17 p.m. OK GNU C++17 TESTS 21 61 819200
210515496 coder_saini_07 B June 21, 2023, 7:34 a.m. OK GNU C++17 TESTS 21 61 819200
210522126 OM14 B June 21, 2023, 8:41 a.m. OK GNU C++17 TESTS 21 61 819200
210539205 Krzychuo B June 21, 2023, 11:31 a.m. OK GNU C++17 (64) TESTS 21 31 819200
210498004 l0ssofTime B June 21, 2023, 2:43 a.m. OK GNU C++17 (64) TESTS 21 46 0
210620961 himanshupatil45h B June 22, 2023, 5:56 a.m. OK GNU C++17 (64) TESTS 21 46 0
210600710 ahmed.yasser01 B June 21, 2023, 11:34 p.m. OK GNU C++17 (64) TESTS 21 46 819200
210611963 anudeep__29 B June 22, 2023, 3:27 a.m. OK GNU C++17 (64) TESTS 21 46 819200
210552813 MarioYC B June 21, 2023, 1:42 p.m. OK GNU C++17 (64) TESTS 21 46 819200
210529980 iAmShipul B June 21, 2023, 9:54 a.m. OK GNU C++17 (64) TESTS 21 46 819200
210529135 psrijith B June 21, 2023, 9:46 a.m. OK GNU C++17 (64) TESTS 21 46 819200
210528285 0_Shipul_1 B June 21, 2023, 9:39 a.m. OK GNU C++17 (64) TESTS 21 46 819200
210501541 mas2alt_wa2t B June 21, 2023, 3:51 a.m. OK GNU C++17 (64) TESTS 21 46 819200
210515170 1024M B June 21, 2023, 7:30 a.m. OK GNU C++20 (64) TESTS 21 31 0
210513353 Albert_711 B June 21, 2023, 7:11 a.m. OK GNU C++20 (64) TESTS 21 31 0
210506108 pain_23 B June 21, 2023, 5:14 a.m. OK GNU C++20 (64) TESTS 21 31 0
210518580 Timur2006 B June 21, 2023, 8:06 a.m. OK GNU C++20 (64) TESTS 21 31 0
210523970 Captain_Lee B June 21, 2023, 8:57 a.m. OK GNU C++20 (64) TESTS 21 31 0
210548782 FYBGC B June 21, 2023, 1:03 p.m. OK GNU C++20 (64) TESTS 21 31 0
210552297 ZzzzH777 B June 21, 2023, 1:37 p.m. OK GNU C++20 (64) TESTS 21 31 0
210553390 Saurav_Rawat_2003 B June 21, 2023, 1:47 p.m. OK GNU C++20 (64) TESTS 21 31 0
210576910 helicopto B June 21, 2023, 5:39 p.m. OK GNU C++20 (64) TESTS 21 31 0
210585551 toreto B June 21, 2023, 7:30 p.m. OK GNU C++20 (64) TESTS 21 31 0
210528551 Cumass B June 21, 2023, 9:41 a.m. OK Go TESTS 21 93 4300800
210495272 cill B June 21, 2023, 1:42 a.m. OK Go TESTS 21 109 4300800
210495499 libaoshan B June 21, 2023, 1:48 a.m. OK Go TESTS 21 109 4403200
210581835 kalzor B June 21, 2023, 6:38 p.m. OK Java 11 TESTS 21 233 0
210583751 themadknight45 B June 21, 2023, 7:05 p.m. OK Java 11 TESTS 21 234 0
210523429 thenikhilkakarla B June 21, 2023, 8:52 a.m. OK Java 11 TESTS 21 311 0
210498253 new2ac B June 21, 2023, 2:47 a.m. OK Java 11 TESTS 21 342 0
210524700 md_shamim_ahmmed B June 21, 2023, 9:04 a.m. OK Java 11 TESTS 21 358 4505600
210606271 saoodahmad B June 22, 2023, 1:38 a.m. OK Java 11 TESTS 21 452 0
210495591 Blueberry_1 B June 21, 2023, 1:50 a.m. OK Java 11 TESTS 21 545 0
210609593 s.afsan B June 22, 2023, 2:42 a.m. OK Java 11 TESTS 21 545 0
210562774 polsage B June 21, 2023, 3:15 p.m. OK Java 11 TESTS 21 545 0
210534211 sulthanso73 B June 21, 2023, 10:39 a.m. OK Java 11 TESTS 21 546 0
210534639 soumit915 B June 21, 2023, 10:44 a.m. OK Java 17 TESTS 21 202 512000
210542610 jimmyd211 B June 21, 2023, 12:05 p.m. OK Java 17 TESTS 21 233 0
210619039 cpp10 B June 22, 2023, 5:25 a.m. OK Java 17 TESTS 21 233 307200
210618993 cpp10 B June 22, 2023, 5:25 a.m. OK Java 17 TESTS 21 265 921600
210536470 Sergazy04 B June 21, 2023, 11:03 a.m. OK Java 17 TESTS 21 280 512000
210553187 atheshwarank21cs B June 21, 2023, 1:45 p.m. OK Java 17 TESTS 21 280 1331200
210521804 coder_vishnu B June 21, 2023, 8:38 a.m. OK Java 17 TESTS 21 296 1024000
210617267 vikash_45 B June 22, 2023, 4:57 a.m. OK Java 17 TESTS 21 327 819200
210553294 Rohith_Kumar_Reddy B June 21, 2023, 1:46 p.m. OK Java 17 TESTS 21 342 21606400
210504252 vanshkambojkh B June 21, 2023, 4:39 a.m. OK Java 17 TESTS 21 358 716800
210497761 chuquwan9964 B June 21, 2023, 2:38 a.m. OK Java 8 TESTS 21 93 0
210606956 Monkey_de_Luffy B June 22, 2023, 1:51 a.m. OK Java 8 TESTS 21 124 2764800
210575908 iamdimonis B June 21, 2023, 5:28 p.m. OK Java 8 TESTS 21 140 2764800
210499336 xiaoshua B June 21, 2023, 3:08 a.m. OK Java 8 TESTS 21 140 2764800
210556906 WalterWhite. B June 21, 2023, 2:20 p.m. OK Java 8 TESTS 21 155 2764800
210500087 magic_kid B June 21, 2023, 3:23 a.m. OK Java 8 TESTS 21 155 2764800
210498588 QianCCC B June 21, 2023, 2:54 a.m. OK Java 8 TESTS 21 171 0
210532387 esmusssein B June 21, 2023, 10:19 a.m. OK Java 8 TESTS 21 171 66355200
210497118 Ahmad_Hoseiny B June 21, 2023, 2:24 a.m. OK Java 8 TESTS 21 187 3686400
210491950 sb10 B June 21, 2023, 12:08 a.m. OK Java 8 TESTS 21 405 21708800
210536001 hartiksalaria B June 21, 2023, 10:58 a.m. OK Kotlin 1.6 TESTS 21 233 0
210541197 linxiaotian B June 21, 2023, 11:51 a.m. OK Kotlin 1.6 TESTS 21 327 12697600
210560349 yato01 B June 21, 2023, 2:52 p.m. OK Kotlin 1.6 TESTS 21 545 0
210543862 Krantzy B June 21, 2023, 12:17 p.m. OK Kotlin 1.7 TESTS 21 733 60108800
210601348 _Ahmed_Samy B June 21, 2023, 11:49 p.m. OK Kotlin 1.7 TESTS 21 764 57856000
210568474 AlicesRating B June 21, 2023, 4:10 p.m. OK MS C++ 2017 TESTS 21 77 819200
210525966 Ganseblumchen B June 21, 2023, 9:16 a.m. OK MS C++ 2017 TESTS 21 124 1638400
210589352 Gadi B June 21, 2023, 8:22 p.m. OK MS C++ 2017 TESTS 21 171 819200
210546559 Mo7amed_nabil B June 21, 2023, 12:43 p.m. OK MS C++ 2017 TESTS 21 171 1638400
210577264 286d B June 21, 2023, 5:43 p.m. OK MS C++ 2017 TESTS 21 171 3276800
210529196 At1L B June 21, 2023, 9:47 a.m. OK MS C++ 2017 TESTS 21 187 819200
210552354 samia_safa B June 21, 2023, 1:37 p.m. OK MS C++ 2017 TESTS 21 202 0
210515661 nanu123 B June 21, 2023, 7:35 a.m. OK MS C++ 2017 TESTS 21 202 0
210505597 exilesome B June 21, 2023, 5:05 a.m. OK MS C++ 2017 TESTS 21 202 819200
210583195 Aneeba B June 21, 2023, 6:57 p.m. OK MS C++ 2017 TESTS 21 202 1638400
210585110 patulka B June 21, 2023, 7:24 p.m. OK PyPy 3 TESTS 21 342 18739200
210560189 LCJLY B June 21, 2023, 2:50 p.m. OK PyPy 3 TESTS 21 483 18944000
210530488 abishek0suresh B June 21, 2023, 9:59 a.m. OK PyPy 3 TESTS 21 514 18944000
210526709 ram_1728 B June 21, 2023, 9:24 a.m. OK PyPy 3 TESTS 21 514 18944000
210519117 K1o0n B June 21, 2023, 8:12 a.m. OK PyPy 3 TESTS 21 514 19148800
210526633 nevermind___ B June 21, 2023, 9:23 a.m. OK PyPy 3 TESTS 21 530 22220800
210584134 BLACKDEX09 B June 21, 2023, 7:10 p.m. OK PyPy 3 TESTS 21 545 18944000
210609600 FedericoCardona B June 22, 2023, 2:42 a.m. OK PyPy 3-64 TESTS 21 124 20275200
210583687 ijk-1 B June 21, 2023, 7:04 p.m. OK PyPy 3-64 TESTS 21 124 22425600
210611200 layzer B June 22, 2023, 3:13 a.m. OK PyPy 3-64 TESTS 21 124 27545600
210524504 reijnnn B June 21, 2023, 9:02 a.m. OK PyPy 3-64 TESTS 21 139 22425600
210556788 riroan B June 21, 2023, 2:19 p.m. OK PyPy 3-64 TESTS 21 139 27545600
210587900 stalkmarket B June 21, 2023, 8:03 p.m. OK PyPy 3-64 TESTS 21 139 30003200
210537636 HaisTous B June 21, 2023, 11:15 a.m. OK PyPy 3-64 TESTS 21 139 33587200
210521020 rmr B June 21, 2023, 8:31 a.m. OK PyPy 3-64 TESTS 21 140 20787200
210610259 Raindrops1117 B June 22, 2023, 2:55 a.m. OK PyPy 3-64 TESTS 21 140 26828800
210499337 koder_ap B June 21, 2023, 3:08 a.m. OK PyPy 3-64 TESTS 21 140 30515200
210570984 -BOOGEYMAN- B June 21, 2023, 4:34 p.m. OK Python 3 TESTS 21 124 28057600
210571325 -BOOGEYMAN- B June 21, 2023, 4:38 p.m. OK Python 3 TESTS 21 124 28262400
210597458 hossam_2003 B June 21, 2023, 10:27 p.m. OK Python 3 TESTS 21 139 22220800
210569258 Harshav2 B June 21, 2023, 4:17 p.m. OK Python 3 TESTS 21 139 28672000
210572111 -BOOGEYMAN- B June 21, 2023, 4:46 p.m. OK Python 3 TESTS 21 140 28262400
210568875 sagamantus B June 21, 2023, 4:14 p.m. OK Python 3 TESTS 21 155 28672000
210515270 saber_02 B June 21, 2023, 7:31 a.m. OK Python 3 TESTS 21 170 28672000
210558552 Saket_Ahlawat B June 21, 2023, 2:34 p.m. OK Python 3 TESTS 21 171 26521600
210564597 Red_Kaiser B June 21, 2023, 3:32 p.m. OK Python 3 TESTS 21 171 27033600
210503653 paqi B June 21, 2023, 4:28 a.m. OK Python 3 TESTS 21 171 27033600
210539253 Stan_Marsh Kenny__McCormick Thief_Executive_Officer B June 21, 2023, 11:31 a.m. OK Rust 2021 TESTS 21 93 8396800

remove filters

Back to search problems