Codeforces Round 786 (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
1674 Codeforces Round 786 (Div. 3) FINISHED False 7200 80321099 May 2, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6484 ) E Breaking the Wall PROGRAMMING binary search brute force constructive algorithms greedy math

B'Monocarp plays "Rage of Empires II: Definitive Edition" -- a strategic computer game. Right now he 's planning to attack his opponent in the game, but Monocarp 's forces cannot enter the opponent 's territory since the opponent has built a wall. The wall consists of n sections, aligned in a row. The i -th section initially has durability a_i . If durability of some section becomes 0 or less, this section is considered broken. To attack the opponent, Monocarp needs to break at least two sections of the wall (any two sections: possibly adjacent, possibly not). To do this, he plans to use an onager -- a special siege weapon. The onager can be used to shoot any section of the wall; the shot deals 2 damage to the target section and 1 damage to adjacent sections. In other words, if the onager shoots at the section x , then the durability of the section x decreases by 2 , and the durability of the sections x - 1 and x + 1 (if they exist) decreases by 1 each. Monocarp can shoot at any sections any number of times, he can even shoot at broken sections. Monocarp wants to calculate the minimum number of onager shots needed to break at least two sections. Help him! The first line contains one integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of sections. The second line contains the sequence of integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^6 ), where a_i is the initial durability of the i -th section. Print one integer -- the minimum number of onager shots needed to break at least two sections of the wall. In the first example, it is possible to break the 2 -nd and the 4 -th section in 10 shots, for example, by shooting the third section 10 times. After that, the durabilities become [20, 0, 10, 0, 20] . Another way of doing it is firing 5 shots at the 2 -nd section, and another 5 shots at the 4 -th section. After t'...

Tutorials

102482

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
155763532 Sempr E May 3, 2022, 12:58 p.m. OK GNU C11 TESTS 381 46 0
155730675 BlueJade E May 3, 2022, 6:50 a.m. OK GNU C++14 TESTS 381 46 0
155766052 DonoToT E May 3, 2022, 1:25 p.m. OK GNU C++14 TESTS 381 46 819200
155726037 junglee_panda E May 3, 2022, 5:40 a.m. OK GNU C++14 TESTS 381 46 819200
155807917 LZH2008 E May 4, 2022, 3:09 a.m. OK GNU C++14 TESTS 381 46 819200
155736531 grass8cow E May 3, 2022, 8:04 a.m. OK GNU C++14 TESTS 381 46 1638400
155808877 huangjinwen2021 E May 4, 2022, 3:34 a.m. OK GNU C++14 TESTS 381 46 1638400
155730576 2018339901318 E May 3, 2022, 6:49 a.m. OK GNU C++14 TESTS 381 61 0
155726575 wzc_IOI_czw E May 3, 2022, 5:48 a.m. OK GNU C++14 TESTS 381 61 1638400
155746500 WYJ_zzzzzzZ E May 3, 2022, 9:53 a.m. OK GNU C++14 TESTS 381 61 3993600
155815732 wwch E May 4, 2022, 6 a.m. OK GNU C++14 TESTS 381 62 819200
155781694 PineapplesOnPizza E May 3, 2022, 4:08 p.m. OK GNU C++17 TESTS 381 46 1945600
155747541 wa_maker E May 3, 2022, 10:05 a.m. OK GNU C++17 TESTS 381 61 819200
155729540 CrazyCoder00 E May 3, 2022, 6:36 a.m. OK GNU C++17 TESTS 381 61 819200
155726208 punitpatel E May 3, 2022, 5:42 a.m. OK GNU C++17 TESTS 381 61 819200
155806446 letgo8 E May 4, 2022, 2:31 a.m. OK GNU C++17 TESTS 381 62 819200
155804074 Firefrog418 E May 4, 2022, 1:21 a.m. OK GNU C++17 TESTS 381 62 819200
155797484 yunny_world E May 3, 2022, 9:13 p.m. OK GNU C++17 TESTS 381 62 819200
155796547 Riblji_Keksic E May 3, 2022, 8:46 p.m. OK GNU C++17 TESTS 381 62 819200
155796347 will_be_fine E May 3, 2022, 8:40 p.m. OK GNU C++17 TESTS 381 62 819200
155793667 magnuseifr E May 3, 2022, 7:30 p.m. OK GNU C++17 TESTS 381 62 819200
155743275 Azusamitsusa E May 3, 2022, 9:18 a.m. OK GNU C++17 (64) TESTS 381 31 3174400
155759865 BhaTTa E May 3, 2022, 12:18 p.m. OK GNU C++17 (64) TESTS 381 46 819200
155814314 Graphter E May 4, 2022, 5:36 a.m. OK GNU C++17 (64) TESTS 381 46 819200
155807209 Nanako E May 4, 2022, 2:50 a.m. OK GNU C++17 (64) TESTS 381 46 819200
155789217 mbdbr E May 3, 2022, 6:05 p.m. OK GNU C++17 (64) TESTS 381 46 819200
155788619 l_pavan_l E May 3, 2022, 5:56 p.m. OK GNU C++17 (64) TESTS 381 46 819200
155787856 tonkitude E May 3, 2022, 5:44 p.m. OK GNU C++17 (64) TESTS 381 46 819200
155775143 placik E May 3, 2022, 2:40 p.m. OK GNU C++17 (64) TESTS 381 46 819200
155761766 gqf123 E May 3, 2022, 12:39 p.m. OK GNU C++17 (64) TESTS 381 46 819200
155760271 Th_K E May 3, 2022, 12:23 p.m. OK GNU C++17 (64) TESTS 381 46 819200
155795556 ale_np E May 3, 2022, 8:19 p.m. OK GNU C++20 (64) TESTS 381 31 819200
155783960 goczbali E May 3, 2022, 4:40 p.m. OK GNU C++20 (64) TESTS 381 31 819200
155759788 Just_Josh E May 3, 2022, 12:17 p.m. OK GNU C++20 (64) TESTS 381 31 819200
155741537 HEltim7 E May 3, 2022, 9 a.m. OK GNU C++20 (64) TESTS 381 31 819200
155729455 Ganter E May 3, 2022, 6:34 a.m. OK GNU C++20 (64) TESTS 381 31 819200
155729185 KalbAsad E May 3, 2022, 6:31 a.m. OK GNU C++20 (64) TESTS 381 31 819200
155738689 shaosy E May 3, 2022, 8:29 a.m. OK GNU C++20 (64) TESTS 381 31 1638400
155728807 SaiPrasad_27 E May 3, 2022, 6:26 a.m. OK GNU C++20 (64) TESTS 381 31 1638400
155740207 Bit_8 E May 3, 2022, 8:46 a.m. OK GNU C++20 (64) TESTS 381 31 3174400
155757773 EmadSamy E May 3, 2022, 11:55 a.m. OK GNU C++20 (64) TESTS 381 31 12800000
155760273 koqo E May 3, 2022, 12:23 p.m. OK Go TESTS 381 139 2457600
155770242 tongtongac E May 3, 2022, 1:39 p.m. OK Go TESTS 381 187 3276800
155734502 Satyaa E May 3, 2022, 7:37 a.m. OK Java 11 TESTS 381 202 0
155800460 YadunandanAhuja E May 3, 2022, 10:53 p.m. OK Java 11 TESTS 381 202 0
155776525 sf14t E May 3, 2022, 2:59 p.m. OK Java 11 TESTS 381 202 0
155740089 ae167671 E May 3, 2022, 8:45 a.m. OK Java 11 TESTS 381 217 0
155805267 kkz666 E May 4, 2022, 1:58 a.m. OK Java 11 TESTS 381 217 0
155725766 ChenHuaXin E May 3, 2022, 5:35 a.m. OK Java 11 TESTS 381 218 0
155783149 sharnit E May 3, 2022, 4:29 p.m. OK Java 11 TESTS 381 233 0
155791954 Aaryendra E May 3, 2022, 6:53 p.m. OK Java 11 TESTS 381 233 0
155778808 msarthak E May 3, 2022, 3:30 p.m. OK Java 11 TESTS 381 233 0
155749355 Vipul_Yadav E May 3, 2022, 10:25 a.m. OK Java 11 TESTS 381 233 0
155782884 gunner7 E May 3, 2022, 4:25 p.m. OK Java 8 TESTS 381 140 1843200
155753653 sandy11jr E May 3, 2022, 11:11 a.m. OK Java 8 TESTS 381 156 0
155798147 Yehia8 E May 3, 2022, 9:31 p.m. OK Java 8 TESTS 381 171 2252800
155773662 ak_ankit E May 3, 2022, 2:21 p.m. OK Java 8 TESTS 381 171 2252800
155760141 govindrajput E May 3, 2022, 12:21 p.m. OK Java 8 TESTS 381 202 5222400
155739997 UniversalAdmin E May 3, 2022, 8:44 a.m. OK Java 8 TESTS 381 217 2867200
155725784 ninjamayank E May 3, 2022, 5:36 a.m. OK Java 8 TESTS 381 217 3788800
155761601 Zicode E May 3, 2022, 12:37 p.m. OK Java 8 TESTS 381 217 8396800
155739289 pranayrana14 E May 3, 2022, 8:36 a.m. OK Java 8 TESTS 381 218 3072000
155773703 invincible777 E May 3, 2022, 2:22 p.m. OK Java 8 TESTS 381 233 4300800
155781767 BruteForcee E May 3, 2022, 4:08 p.m. OK Kotlin 1.4 TESTS 381 249 7270400
155738516 CrashMaster E May 3, 2022, 8:27 a.m. OK MS C++ 2017 TESTS 381 140 819200
155734322 chika10 E May 3, 2022, 7:35 a.m. OK MS C++ 2017 TESTS 381 156 1638400
155730374 xsc E May 3, 2022, 6:46 a.m. OK MS C++ 2017 TESTS 381 171 819200
155751616 kibastian E May 3, 2022, 10:51 a.m. OK MS C++ 2017 TESTS 381 171 9625600
155740255 vishvjoshi E May 3, 2022, 8:47 a.m. OK MS C++ 2017 TESTS 381 202 819200
155783904 Tangerine E May 3, 2022, 4:39 p.m. OK MS C++ 2017 TESTS 381 234 3174400
155749843 Lyova E May 3, 2022, 10:31 a.m. OK .NET Core C# TESTS 381 124 15667200
155723471 XYShaoKang E May 3, 2022, 5:03 a.m. OK Node.js TESTS 381 218 27033600
155780583 lemiao12 E May 3, 2022, 3:53 p.m. OK PyPy 3 TESTS 381 170 17100800
155724752 NecroSean38 E May 3, 2022, 5:21 a.m. OK PyPy 3 TESTS 381 187 16793600
155784404 y.vvt E May 3, 2022, 4:47 p.m. OK PyPy 3 TESTS 381 265 16281600
155731456 random__person E May 3, 2022, 6:59 a.m. OK PyPy 3 TESTS 381 265 20992000
155807281 devveZE E May 4, 2022, 2:51 a.m. OK PyPy 3 TESTS 381 280 16384000
155771110 artifexbm E May 3, 2022, 1:49 p.m. OK PyPy 3 TESTS 381 311 81305600
155739758 shiviDON E May 3, 2022, 8:41 a.m. OK PyPy 3 TESTS 381 327 16384000
155736020 minm E May 3, 2022, 7:58 a.m. OK PyPy 3 TESTS 381 389 21606400
155779786 skp_r E May 3, 2022, 3:43 p.m. OK PyPy 3-64 TESTS 381 171 28774400
155733625 _Frust E May 3, 2022, 7:26 a.m. OK PyPy 3-64 TESTS 381 186 29388800
155724224 rahulmittall E May 3, 2022, 5:13 a.m. OK PyPy 3-64 TESTS 381 234 24780800
155806084 mina2000gt E May 4, 2022, 2:21 a.m. OK PyPy 3-64 TESTS 381 249 24780800
155743963 7tranger E May 3, 2022, 9:25 a.m. OK PyPy 3-64 TESTS 381 249 24883200
155749744 serpent0917 E May 3, 2022, 10:30 a.m. OK PyPy 3-64 TESTS 381 264 24780800
155744197 ktthree E May 3, 2022, 9:28 a.m. OK PyPy 3-64 TESTS 381 264 25804800
155735975 i_emerge16 E May 3, 2022, 7:57 a.m. OK PyPy 3-64 TESTS 381 280 24576000
155811743 sPARTY E May 4, 2022, 4:49 a.m. OK PyPy 3-64 TESTS 381 280 24780800
155793468 mugiwaraa E May 3, 2022, 7:25 p.m. OK PyPy 3-64 TESTS 381 280 24985600
155728657 Ak_basniwal E May 3, 2022, 6:24 a.m. OK Python 3 TESTS 381 607 13926400
155779919 kritikasinha256 E May 3, 2022, 3:45 p.m. OK Python 3 TESTS 381 670 13516800
155774015 Maks_na_codforce E May 3, 2022, 2:26 p.m. OK Python 3 TESTS 381 701 13926400
155812812 geek_nero E May 4, 2022, 5:08 a.m. OK Python 3 TESTS 381 717 13926400
155733795 khvoya E May 3, 2022, 7:28 a.m. OK Python 3 TESTS 381 717 13926400
155809727 nutsjamie E May 4, 2022, 3:56 a.m. OK Python 3 TESTS 381 732 13516800
155773082 ggs4 E May 3, 2022, 2:14 p.m. OK Python 3 TESTS 381 842 13926400
155792365 Tanguyvans E May 3, 2022, 7:02 p.m. OK Python 3 TESTS 381 1045 13926400
155764877 Pythonic__Python E May 3, 2022, 1:12 p.m. OK Python 3 TESTS 381 1232 18124800
155815096 shokal_kishan E May 4, 2022, 5:49 a.m. OK Python 3 TESTS 381 1263 13926400
155741256 zeronosu77108_ E May 3, 2022, 8:57 a.m. OK Rust 2021 TESTS 381 46 6348800
155742191 sansen E May 3, 2022, 9:07 a.m. OK Rust 2021 TESTS 381 46 7168000

remove filters

Back to search problems