VK Cup 2022 - Финальный раунд (Engine)

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
1784 VK Cup 2022 - Финальный раунд (Engine) FINISHED False 10800 56224499 Feb. 5, 2023, 12:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1682 ) C Monsters (hard version) PROGRAMMING data structures

B"This is the hard version of the problem. In this version, you need to find the answer for every prefix of the monster array. In a computer game, you are fighting against n monsters. Monster number i has a_i health points, all a_i are integers. A monster is alive while it has at least 1 health point. You can cast spells of two types: Dealing 1 damage to a monster reduces its health by 1 . Spells of type 1 can be cast any number of times, while a spell of type 2 can be cast at most once during the game. For every k = 1, 2, ldots, n , answer the following question. Suppose that only the first k monsters, with numbers 1, 2, ldots, k , are present in the game. What is the smallest number of times you need to cast spells of type 1 to kill all k monsters? Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The description of the test cases follows. Each test case consists of two lines. The first line contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of monsters. The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= n ) -- monsters' health points. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, print n integers. The k -th of these integers must be equal to the smallest number of times you need to cast spells of type 1 to kill all k monsters, if only monsters with numbers 1, 2, ldots, k are present in the game. In the first test case, for k = n , the initial health points of the monsters are [3, 1, 2] . It is enough to cast a spell of type 2: Since it is possible to use no spells of type 1 at all, the answer is 0 . In the second test case, for k = n , the initial health points of the monsters are [4, 1, 5, 4, 1, 1] . Here is one of the optimal"...

Tutorials

Codeforces Round #850 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
192410777 Leasier C Feb. 6, 2023, 1:44 a.m. OK GNU C++14 TESTS 78 171 13619200
192408487 william556 C Feb. 6, 2023, 12:50 a.m. OK GNU C++14 TESTS 78 187 7270400
192408595 zuytong C Feb. 6, 2023, 12:52 a.m. OK GNU C++14 TESTS 78 202 12800000
192411504 zzt_ C Feb. 6, 2023, 2 a.m. OK GNU C++14 TESTS 78 202 24268800
192415980 rui_er C Feb. 6, 2023, 3:23 a.m. OK GNU C++14 TESTS 78 234 12800000
192401419 b6e0 C Feb. 5, 2023, 10:26 p.m. OK GNU C++14 TESTS 78 499 13004800
192404274 zltzlt C Feb. 5, 2023, 11:15 p.m. OK GNU C++14 TESTS 78 576 32051200
192415845 intmain111 C Feb. 6, 2023, 3:21 a.m. OK GNU C++14 TESTS 78 888 19251200
192377812 Azimjonm0012 C Feb. 5, 2023, 5:59 p.m. OK GNU C++17 TESTS 78 124 5324800
192406542 Onolt_de C Feb. 6, 2023, 12:06 a.m. OK GNU C++17 TESTS 78 171 12390400
192303373 353cerega C Feb. 5, 2023, 12:44 p.m. OK GNU C++17 (64) TESTS 78 187 30515200
192415187 hokarikanae C Feb. 6, 2023, 3:09 a.m. OK GNU C++17 (64) TESTS 78 499 29798400
192303415 Maksim1744 C Feb. 5, 2023, 12:45 p.m. OK GNU C++20 (64) TESTS 78 124 7168000
192305396 Ormlis C Feb. 5, 2023, 12:49 p.m. OK GNU C++20 (64) TESTS 78 124 16896000
192390486 grishared C Feb. 5, 2023, 7:59 p.m. OK GNU C++20 (64) TESTS 78 155 10035200
192390352 fstmgth C Feb. 5, 2023, 7:57 p.m. OK GNU C++20 (64) TESTS 78 155 10035200
192296261 never_giveup C Feb. 5, 2023, 12:31 p.m. OK GNU C++20 (64) TESTS 78 202 7168000
192317910 isaf27 C Feb. 5, 2023, 1:18 p.m. OK GNU C++20 (64) TESTS 78 218 17612800
192305972 Kirill22 C Feb. 5, 2023, 12:50 p.m. OK GNU C++20 (64) TESTS 78 249 39526400
192315549 Golovanov399 C Feb. 5, 2023, 1:12 p.m. OK GNU C++20 (64) TESTS 78 312 17408000
192313357 244mhq C Feb. 5, 2023, 1:06 p.m. OK GNU C++20 (64) TESTS 78 405 28262400
192326400 Allvik06 C Feb. 5, 2023, 1:40 p.m. OK GNU C++20 (64) TESTS 78 436 18432000
192324921 Egor C Feb. 5, 2023, 1:35 p.m. OK Rust 2021 TESTS 78 265 28057600

remove filters

Back to search problems