Kotlin Heroes: Episode 4

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
1346 Kotlin Heroes: Episode 4 FINISHED False 9000 146589911 May 29, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 51 ) H Game with Segments PROGRAMMING *special data structures games 2700

B"Alice and Bob are playing a game (yet again). They have two sequences of segments of the coordinate axis: a sequence of n initial segments: [l_1, r_1] , [l_2, r_2] , ..., [l_n, r_n] , and a sequence of m terminal segments: [L_1, R_1] , [L_2, R_2] , ..., [L_m, R_m] . At the beginning of the game, they choose one of the initial segments and set it as the current segment. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so on. During each move, the current player must shrink the current segment either by increasing its left endpoint by 1 , or by decreasing its right endpoint by 1 . So, if the current segment is [c_l, c_r] , it becomes either [c_l + 1, c_r] , or [c_l, c_r - 1] . If at the beginning of the game or after Bob's move the current segment coincides with one of the terminal segments, Bob wins. If the current segment becomes degenerate ( c_l = c_r ), and Bob hasn't won yet, Alice wins. If the current segment coincides with one of the terminal segments after Alice's move, nothing happens -- the game continues. Both players play optimally -- if they can win, they always use a strategy that leads them to victory in the minimum number of turns, and if they cannot win, they try to prolong the game, using the strategy allowing them to make the maximum possible number of moves until their defeat. For each of the initial segments you have to determine who will win the game if this segment is chosen as the current segment at the beginning of the game. If Bob wins, you also have to calculate the number of moves Alice will make before her defeat. The first line contains two integers n and m ( 1 <= n, m <= 2 cdot 10^5 ) -- the number of initial segments and terminal segments, respectively. Then n lines follow, the i -th line contains two integers l_i and r_i ( 1 <= l_i < r"...

Tutorials

Kotlin Heroes: Episode 4 — Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
81907566 Egor H May 29, 2020, 4:07 p.m. OK Kotlin TESTS 44 280 44236800 2700
81907550 eatmore H May 29, 2020, 4:07 p.m. OK Kotlin TESTS 44 358 21606400 2700
82471897 Spheniscine H June 4, 2020, 10:18 a.m. OK Kotlin TESTS 44 483 65433600 2700
81989270 Beta_R H May 30, 2020, 6:33 p.m. OK Kotlin TESTS 44 576 37068800 2700
81910837 pashka H May 29, 2020, 4:37 p.m. OK Kotlin TESTS 44 577 37171200 2700
82317551 Ra16bit H June 2, 2020, 2:30 p.m. OK Kotlin TESTS 44 795 92467200 2700
81914886 user202729_ H May 29, 2020, 5:18 p.m. OK Kotlin TESTS 44 1060 68812800 2700
81913442 uwi H May 29, 2020, 5:02 p.m. OK Kotlin TESTS 44 1076 64512000 2700
81936390 lucifer1004 H May 30, 2020, 5:35 a.m. OK Kotlin TESTS 44 1138 92979200 2700
82026480 phiSgr H May 31, 2020, 9:18 a.m. OK Kotlin TESTS 44 1170 58982400 2700

remove filters

Back to search problems