Kotlin Heroes: Episode 13

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
2141 Kotlin Heroes: Episode 13 FINISHED False 9000 18717923 Sept. 12, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1411 ) B Games PROGRAMMING *special greedy

Alice and Bob are planning to play an online game together but haven't decided on which one yet. Alice has a list of (n) games she enjoys: (a_1, a_2, \dots, a_n). Bob, on the other hand, has a list of (m) games he likes: (b_1, b_2, \dots, b_m). They share at least one game in common between their lists. To choose a game, they take turns suggesting games from their lists. Alice begins by suggesting one of her favorite games. If Bob likes it, they play that game. If not, Bob suggests one of his favorite games. If Alice likes it, they play that game. This alternating process continues, with Alice and Bob each suggesting games from their lists in turn, ensuring that no game is suggested more than once. Your task is to calculate the maximum possible number of suggestions they will make while choosing which game to play. The first line contains a single integer (t) ((1 \le t \le 1000)) — the number of test cases. The first line of each test case contains two integers (n) and (m) ((1 \le n, m \le 100)). The second line contains (n) integers (a_1 < a_2 < \cdots < a_n) ((1 \le a_i \le 100)). The third line contains (m) integers (b_1 < b_2 < \cdots < b_m) ((1 \le b_i \le 100)). Arrays (a) and (b) contain at least one common integer. For each test case, print a single integer — the maximum possible number of suggestions they will make while choosing which game to play. In the first test case, the maximum number of suggestions is (3). It is achieved as follows: Alice suggests game (1), but Bob does not like it; Bob suggests game (5), but Alice does not like it; Alice suggests game (2), which Bob likes, and they go to play that game. In the second test case, Alice can only suggest game (5), which Bob likes, so they will immediately go to play it. In the third test case, the maximum number of suggestions is (4). It is achieved as follows: Alice suggests game (7), but Bob does

Tutorials

Kotlin Heroes 13 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
338245838 ChristuRufina B Sept. 12, 2025, 4:48 p.m. OK Kotlin 1.7 TESTS 4 217 0
338241278 Systuumatic B Sept. 12, 2025, 4:16 p.m. OK Kotlin 1.7 TESTS 4 217 0
338227933 aman1020 B Sept. 12, 2025, 2:55 p.m. OK Kotlin 1.7 TESTS 4 218 0
338243082 Oxitocina B Sept. 12, 2025, 4:28 p.m. OK Kotlin 1.7 TESTS 4 218 716800
338241997 sunnydev B Sept. 12, 2025, 4:21 p.m. OK Kotlin 1.7 TESTS 4 218 7782400
338244902 bhawnapannu27 B Sept. 12, 2025, 4:42 p.m. OK Kotlin 1.7 TESTS 4 233 0
338229570 Patronus2002 B Sept. 12, 2025, 3:04 p.m. OK Kotlin 1.7 TESTS 4 233 0
338227047 manhmkl87 B Sept. 12, 2025, 2:51 p.m. OK Kotlin 1.7 TESTS 4 233 0
338235995 216master B Sept. 12, 2025, 3:41 p.m. OK Kotlin 1.7 TESTS 4 233 921600
338257259 PMSK B Sept. 12, 2025, 6:22 p.m. OK Kotlin 1.7 TESTS 4 233 7168000
338228274 MDelPiero B Sept. 12, 2025, 2:57 p.m. OK Kotlin 1.9 TESTS 4 124 0
338225130 __jk__ B Sept. 12, 2025, 2:42 p.m. OK Kotlin 1.9 TESTS 4 124 0
338228551 dpatel_108 B Sept. 12, 2025, 2:59 p.m. OK Kotlin 1.9 TESTS 4 139 0
338230619 MagicalGirl B Sept. 12, 2025, 3:10 p.m. OK Kotlin 1.9 TESTS 4 140 0
338227966 NHiL B Sept. 12, 2025, 2:56 p.m. OK Kotlin 1.9 TESTS 4 140 0
338227476 MohamedAboOkail B Sept. 12, 2025, 2:53 p.m. OK Kotlin 1.9 TESTS 4 140 0
338240390 vighnesh.tripathi B Sept. 12, 2025, 4:10 p.m. OK Kotlin 1.9 TESTS 4 155 0
338226594 Intellegent B Sept. 12, 2025, 2:49 p.m. OK Kotlin 1.9 TESTS 4 155 0
338225402 MohamedSaeed B Sept. 12, 2025, 2:43 p.m. OK Kotlin 1.9 TESTS 4 155 0
338281234 Eye_of_God B Sept. 13, 2025, 12:22 a.m. OK Kotlin 1.9 TESTS 4 171 0
338231611 p4106650 B Sept. 12, 2025, 3:15 p.m. OK Kotlin 2.2 TESTS 4 124 0
338230089 OpGm B Sept. 12, 2025, 3:07 p.m. OK Kotlin 2.2 TESTS 4 124 0
338244539 abhaykumar70953 B Sept. 12, 2025, 4:39 p.m. OK Kotlin 2.2 TESTS 4 140 0
338229244 lto5 B Sept. 12, 2025, 3:02 p.m. OK Kotlin 2.2 TESTS 4 140 0
338227962 malo223 B Sept. 12, 2025, 2:56 p.m. OK Kotlin 2.2 TESTS 4 140 0
338225947 Jlyfish B Sept. 12, 2025, 2:46 p.m. OK Kotlin 2.2 TESTS 4 140 0
338225861 pyromon B Sept. 12, 2025, 2:45 p.m. OK Kotlin 2.2 TESTS 4 140 0
338232464 uk369 B Sept. 12, 2025, 3:20 p.m. OK Kotlin 2.2 TESTS 4 155 0
338229655 binminh01 B Sept. 12, 2025, 3:05 p.m. OK Kotlin 2.2 TESTS 4 155 0
338228122 zabojeb B Sept. 12, 2025, 2:57 p.m. OK Kotlin 2.2 TESTS 4 155 0

remove filters

Back to search problems