Kotlin Heroes: Episode 12

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
2087 Kotlin Heroes: Episode 12 FINISHED False 9000 32369123 April 7, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 89 ) G Esports in Berland PROGRAMMING *special *special greedy greedy

Recently, esports has been recognized as an official sport in Berland, and regular competitions have begun to take place. Riding the wave of popularity, Monocarp also decided to participate in the upcoming competitions (besides, prizes have never hurt anyone). In each of the following (n) days, one competition will be held. Monocarp would like to participate in all of them, but unfortunately, his current skill level (s) is (0). At the same time, the prize money Monocarp can earn in competitions depends on his skill level. Therefore, Monocarp decided that he could sacrifice participating in some competitions to train and increase his skill level on those days. In general, on the (i)-th day, Monocarp can: either participate in the (i)-th competition and earn (a_i + s) units of money, where (s) is his current skill level; or skip the competition to train: Monocarp will earn nothing but will increase his skill level (s) by (1). Help Monocarp calculate his maximum total income and the number of training plans with such income. Two training plans are considered different if there exists a day that is a training day in one plan and a competition day in the other one. The first line contains a single integer (n) ((1 \le n \le 2 \cdot 10^5)) — the number of days when competitions will take place. The second line contains (n) integers (a_1, a_2, \dots, a_n) ((0 \le a_i \le 10^6)) — the base prize money that Monocarp can expect. Print two integers — the maximum total income that Monocarp can achieve with an optimal training plan and the number of such plans. Since the number of plans may be too big, print it modulo (998\,244\,353). In the first example, Monocarp can either participate or skip the competition — in both cases he will get (0) units. In the second example, it is optimal to simply participate in the competition. In the third example, there are two training plans. Monocarp can either train for

Tutorials

141608

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
314399465 potatoo G April 7, 2025, 4:55 p.m. OK Kotlin 1.7 TESTS 49 687 24064000
314395771 Puranya G April 7, 2025, 4:31 p.m. OK Kotlin 1.7 TESTS 49 687 62156800
314398180 taran_1407 G April 7, 2025, 4:47 p.m. OK Kotlin 1.7 TESTS 49 874 65228800
314395025 WiwiHo G April 7, 2025, 4:26 p.m. OK Kotlin 1.7 TESTS 49 889 112947200
314403562 ahmedafeef G April 7, 2025, 5:24 p.m. OK Kotlin 1.7 TESTS 49 936 84992000
314393080 Alpha_Q G April 7, 2025, 4:13 p.m. OK Kotlin 1.7 TESTS 49 936 84992000
314440139 Yae-Miko G April 8, 2025, 3:44 a.m. OK Kotlin 1.7 TESTS 49 999 76492800
314394668 Yae-Miko G April 7, 2025, 4:24 p.m. OK Kotlin 1.7 TESTS 49 1046 103628800
314399634 baluteshih G April 7, 2025, 4:57 p.m. OK Kotlin 1.7 TESTS 49 1046 123187200
314395872 NomadX G April 7, 2025, 4:32 p.m. OK Kotlin 1.7 TESTS 49 1062 64921600
314399601 Kira_Dev G April 7, 2025, 4:56 p.m. OK Kotlin 1.9 TESTS 49 280 8089600
314392411 __jk__ G April 7, 2025, 4:09 p.m. OK Kotlin 1.9 TESTS 49 280 16076800
314386971 arvindf232 G April 7, 2025, 3:35 p.m. OK Kotlin 1.9 TESTS 49 281 5324800
314395869 thenymphsofdelphi G April 7, 2025, 4:32 p.m. OK Kotlin 1.9 TESTS 49 327 0
314397097 Bazzas13 G April 7, 2025, 4:40 p.m. OK Kotlin 1.9 TESTS 49 343 8294400
314396038 Algebrant G April 7, 2025, 4:33 p.m. OK Kotlin 1.9 TESTS 49 374 19251200
314385685 tabr G April 7, 2025, 3:27 p.m. OK Kotlin 1.9 TESTS 49 389 19353600
314399322 priyanshu.p G April 7, 2025, 4:55 p.m. OK Kotlin 1.9 TESTS 49 390 27340800
314393990 huansir G April 7, 2025, 4:19 p.m. OK Kotlin 1.9 TESTS 49 421 0
314387663 Sunb1m G April 7, 2025, 3:39 p.m. OK Kotlin 1.9 TESTS 49 436 18124800

remove filters

Back to search problems