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
( 570 ) B Showmatch PROGRAMMING *special

In a showmatch for a computer game, (2n) esports players are set to participate; the rating of the (i)-th player is (a_i). The ratings of all players are distinct. For each player, the most exciting match will be with the player whose rating is the closest to theirs. Formally, for the (i)-th player, the best opponent is another player (j) such that the absolute difference in their ratings (|a_i-a_j|) is minimized among all ways to choose player (j). Note that some player can have more than one best opponent. For example, if there are (4) esports players with ratings (3, 7, 5, 12), then: for player (1), the best opponent is player (3); for player (2), the best opponent is player (3); for player (3), the best opponents are players (1) and (2); for player (4), the best opponent is player (2). The organizers of the showmatch want to pair the participants so that each player is in exactly one pair, and in each pair, the players are best opponents for each other. Determine whether such a pairing exists. The first line contains a single integer (t) ((1 \le t \le 100)) — the number of test cases. Each test case consists of two lines: the first line contains a single integer (n) ((2 \le n \le 50)); the second line contains (2n) integers (a_1, a_2, \dots, a_{2n}) ((1 \le a_i \le 10^5); all (a_i) are distinct). For each test case, if it is possible to pair the participants such that in each pair the participants are best opponents for each other, output YES . Otherwise, output NO . In the first example, pairing is impossible. For instance, if we form pairs ((1, 3)) and ((2, 4)), participant (4) will not be the best opponent for participant (2). In the second example, it is possible to pair the participants as ((1, 3)) and ((2, 4)).

Tutorials

141608

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
314377314 nguyenhoangminh2003 B April 7, 2025, 2:43 p.m. OK Kotlin 1.7 TESTS 10 264 1536000
314379467 ThienNhan13 B April 7, 2025, 2:54 p.m. OK Kotlin 1.7 TESTS 10 265 1331200
314378642 potatoo B April 7, 2025, 2:50 p.m. OK Kotlin 1.7 TESTS 10 265 1433600
314391681 kunalkhurana B April 7, 2025, 4:04 p.m. OK Kotlin 1.7 TESTS 10 281 716800
314389666 DonChipilin B April 7, 2025, 3:51 p.m. OK Kotlin 1.7 TESTS 10 281 9830400
314379334 syloe1 B April 7, 2025, 2:53 p.m. OK Kotlin 1.7 TESTS 10 296 512000
314381379 Faisal-Saqib B April 7, 2025, 3:03 p.m. OK Kotlin 1.7 TESTS 10 296 614400
314384797 ravigod22 B April 7, 2025, 3:22 p.m. OK Kotlin 1.7 TESTS 10 296 921600
314377150 anony_12345 B April 7, 2025, 2:43 p.m. OK Kotlin 1.7 TESTS 10 296 1433600
314377042 WiwiHo B April 7, 2025, 2:42 p.m. OK Kotlin 1.7 TESTS 10 296 2969600
314376902 tabr B April 7, 2025, 2:41 p.m. OK Kotlin 1.9 TESTS 10 155 0
314377431 __jk__ B April 7, 2025, 2:44 p.m. OK Kotlin 1.9 TESTS 10 155 307200
314384832 lto5 B April 7, 2025, 3:22 p.m. OK Kotlin 1.9 TESTS 10 155 512000
314377369 sahasrad B April 7, 2025, 2:44 p.m. OK Kotlin 1.9 TESTS 10 156 0
314390113 gargsajal61 B April 7, 2025, 3:54 p.m. OK Kotlin 1.9 TESTS 10 156 102400
314377483 Ra16bit B April 7, 2025, 2:44 p.m. OK Kotlin 1.9 TESTS 10 156 307200
314393469 Sabb1r_Hossa1n B April 7, 2025, 4:16 p.m. OK Kotlin 1.9 TESTS 10 171 102400
314378497 Sora213 B April 7, 2025, 2:49 p.m. OK Kotlin 1.9 TESTS 10 171 102400
314377950 shade34 B April 7, 2025, 2:46 p.m. OK Kotlin 1.9 TESTS 10 171 102400
314377691 Yoichi_Isagi1 B April 7, 2025, 2:45 p.m. OK Kotlin 1.9 TESTS 10 171 102400

remove filters

Back to search problems