Kotlin Heroes: Episode 14

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
2199 Kotlin Heroes: Episode 14 FINISHED False 9000 3943523 March 2, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 271 ) D Two Arrays PROGRAMMING *special math

The median of the sequence (s_1, s_2, \dots, s_k) is defined as the element that appears at position (\lfloor \frac{k+1}{2} \rfloor) when the sequence is sorted in non-decreasing order. For example, the median of the sequence (4, 5, 6, 1, 2, 2) is (2); the median of the sequence (3, 6, 3, 4, 5) is (4). You are given two arrays (a_1, a_2, \dots, a_n) and (b_1, b_2, \dots, b_m), sorted in non-decreasing order. Both arrays have odd lengths. In one operation, you can do the following: choose one of the arrays and mark an odd number of elements in it; calculate (x) — the median of the marked elements; remove all marked elements; insert (x) into any position of the array on which the operation was performed. Your task is to determine whether it is possible to make the arrays equal. The first line contains one integer (t) ((1 \le t \le 10^4)) — the number of test cases. Each test case consists of three lines: the first line contains two integers (n) and (m) ((1 \le n, m \le 3 \cdot 10^5)); the second line contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_1 \le a_2 \le \dots \le a_n \le 10^9)); the third line contains (m) integers (b_1, b_2, \dots, b_m) ((1 \le b_1 \le b_2 \le \dots \le b_m \le 10^9)). Additional constraints on the input: the sum of ((n+m)) across all test cases does not exceed (3 \cdot 10^5); in every test case, (n \bmod 2 = 1) and (m \bmod 2 = 1). For each test case, output YES if it is possible to make the arrays equal, or NO if it is not possible. In the first example, the arrays can be made equal by applying the following sequence of operations: for the array (a = 1, 2, 3, 4, 5), mark the (2)-nd, (4)-th, and (5)-th elements. Their median is (4). We insert it at the end of the array, resulting in (a = 1, 3, 4); for the array (b = 1, 3, 7), mark all elements. Their median is (3). We get the arr

Tutorials

151783

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
365110858 yatuoximeng D March 2, 2026, 3:38 p.m. OK Kotlin 1.7 TESTS 10 218 307200
365121477 hellovir D March 2, 2026, 5 p.m. OK Kotlin 1.7 TESTS 10 218 9420800
365112575 kriradhaks D March 2, 2026, 3:51 p.m. OK Kotlin 1.7 TESTS 10 234 8601600
365105334 khba D March 2, 2026, 3:02 p.m. OK Kotlin 1.7 TESTS 10 250 2560000
365103174 potato167 D March 2, 2026, 2:50 p.m. OK Kotlin 1.7 TESTS 10 250 2662400
365105013 p0tato D March 2, 2026, 3 p.m. OK Kotlin 1.7 TESTS 10 250 4300800
365114510 RitikaBaliyan8 D March 2, 2026, 4:06 p.m. OK Kotlin 1.7 TESTS 10 250 42496000
365107840 ellorodeantony D March 2, 2026, 3:18 p.m. OK Kotlin 1.7 TESTS 10 265 614400
365104912 Majukios D March 2, 2026, 2:59 p.m. OK Kotlin 1.7 TESTS 10 265 7372800
365113575 ujjawalmishra816 D March 2, 2026, 3:58 p.m. OK Kotlin 1.7 TESTS 10 281 819200
365118554 jinxedcat D March 2, 2026, 4:38 p.m. OK Kotlin 1.9 TESTS 10 93 0
365104414 __jk__ D March 2, 2026, 2:56 p.m. OK Kotlin 1.9 TESTS 10 250 5427200
365115637 1435730 D March 2, 2026, 4:15 p.m. OK Kotlin 1.9 TESTS 10 312 35225600
365106978 ktobarsuk D March 2, 2026, 3:13 p.m. OK Kotlin 1.9 TESTS 10 343 35123200
365113566 hot D March 2, 2026, 3:58 p.m. OK Kotlin 1.9 TESTS 10 359 36966400
365106959 yudedako D March 2, 2026, 3:12 p.m. OK Kotlin 1.9 TESTS 10 375 35430400
365145303 hocln D March 2, 2026, 8:55 p.m. OK Kotlin 1.9 TESTS 10 390 35123200
365112956 snnr D March 2, 2026, 3:53 p.m. OK Kotlin 1.9 TESTS 10 390 35123200
365110807 BERNARB.01 D March 2, 2026, 3:38 p.m. OK Kotlin 1.9 TESTS 10 390 35123200
365110066 zornlemma D March 2, 2026, 3:33 p.m. OK Kotlin 1.9 TESTS 10 390 35225600
365108845 Joskmo D March 2, 2026, 3:25 p.m. OK Kotlin 2.2 TESTS 10 93 23756800
365165111 thanhnguyxn07 D March 3, 2026, 3:41 a.m. OK Kotlin 2.2 TESTS 10 125 23756800
365118575 BKkoi D March 2, 2026, 4:38 p.m. OK Kotlin 2.2 TESTS 10 125 23756800
365112182 PelicanPilot D March 2, 2026, 3:48 p.m. OK Kotlin 2.2 TESTS 10 125 23756800
365117657 theYogi D March 2, 2026, 4:31 p.m. OK Kotlin 2.2 TESTS 10 140 4198400
365106783 longago_06 D March 2, 2026, 3:11 p.m. OK Kotlin 2.2 TESTS 10 140 23961600
365115925 I_love_GSNQK D March 2, 2026, 4:17 p.m. OK Kotlin 2.2 TESTS 10 156 0
365109850 SINNOCENT D March 2, 2026, 3:31 p.m. OK Kotlin 2.2 TESTS 10 156 23859200
365108230 E49869826 D March 2, 2026, 3:21 p.m. OK Kotlin 2.2 TESTS 10 171 25292800
365118524 maddalasreekar D March 2, 2026, 4:38 p.m. OK Kotlin 2.2 TESTS 10 171 35225600

remove filters

Back to search problems