Good Bye 2025

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
2178 Good Bye 2025 FINISHED False 10800 9559523 Dec. 27, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 6653 ) D Xmas or Hysteria PROGRAMMING constructive algorithms graphs greedy implementation

Franklin is plotting a Christmas attack where he casts the spell Mass Hysteria on a village of elves. There are (n) elves numbered (1) to (n), where elf (i) has a health value of (h_i) and an attack value of (a_i). Initially, (h_i=a_i) for all (i), and all (a_i) are distinct. Elf (i) is alive if and only if its health is positive (i.e., (h_i>0)). When Franklin casts Mass Hysteria , the following process is repeated: Choose a pair of distinct living elves (x) and (y) ((h_x,h_y>0)) such that elf (x) has not attacked before. If no such pair exists, terminate the process. Then, elf (x) attacks elf (y), decreasing (h_y) by (a_x). Additionally, due to recoil, (h_x) is decreased by (a_y). Note that (a_x) and (a_y) remain unchanged. The process will repeat until it is impossible to choose a valid pair of elves. It can be shown that Mass Hysteria terminates after at most (n) iterations. Given an integer (m), construct a valid sequence of attacks such that exactly (m) elves are alive when the process ends; or determine that no such sequence exists. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ((2\le n\le 2\cdot 10^5, 0\le m\le n)) — the number of elves in the village and the number of elves to be left alive. The second line contains (n) integers (a_1,a_2,\ldots,a_n) ((1\le a_i\le 10^9)) — the initial attack and health values of the elves. It is guaranteed that all (a_i) are distinct. It is guaranteed that the sum of (n) over all test cases does not exceed (2\cdot 10 ^ 5). For each test case, if it is impossible for exactly (m) elves to remain alive, print (-1). Otherwise, output a valid sequence of attacks as follows: On the first line,

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
355397563 dawDaw D Dec. 27, 2025, 5:04 p.m. OK C++17 (GCC 7-32) TESTS 20 109 819200
355402572 x_pogboy D Dec. 27, 2025, 5:19 p.m. OK C++17 (GCC 7-32) TESTS 20 109 5017600
355436065 devecent D Dec. 28, 2025, 3:31 a.m. OK C++17 (GCC 7-32) TESTS 20 125 0
355426169 024dsun D Dec. 27, 2025, 11:02 p.m. OK C++17 (GCC 7-32) TESTS 20 125 0
355419130 ekssolve D Dec. 27, 2025, 8:37 p.m. OK C++17 (GCC 7-32) TESTS 20 125 0
355433999 SpicyOctopus D Dec. 28, 2025, 2:49 a.m. OK C++17 (GCC 7-32) TESTS 20 125 819200
355420066 majju D Dec. 27, 2025, 8:50 p.m. OK C++17 (GCC 7-32) TESTS 20 125 819200
355419649 anonymous42069 D Dec. 27, 2025, 8:44 p.m. OK C++17 (GCC 7-32) TESTS 20 125 819200
355408593 BananaKatana D Dec. 27, 2025, 5:34 p.m. OK C++17 (GCC 7-32) TESTS 20 125 819200
355404607 The_One_Who D Dec. 27, 2025, 5:25 p.m. OK C++17 (GCC 7-32) TESTS 20 125 819200
355446700 yunchuke D Dec. 28, 2025, 6:10 a.m. OK C++20 (GCC 13-64) TESTS 20 78 2457600
355417678 msiad D Dec. 27, 2025, 8:21 p.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
355440042 lftroq D Dec. 28, 2025, 4:42 a.m. OK C++20 (GCC 13-64) TESTS 20 93 1945600
355425224 JoelCH04 D Dec. 27, 2025, 10:36 p.m. OK C++20 (GCC 13-64) TESTS 20 93 1945600
355404797 nithin0810 D Dec. 27, 2025, 5:25 p.m. OK C++20 (GCC 13-64) TESTS 20 93 1945600
355393173 Loloka D Dec. 27, 2025, 4:51 p.m. OK C++20 (GCC 13-64) TESTS 20 93 2457600
355393063 joonyou D Dec. 27, 2025, 4:51 p.m. OK C++20 (GCC 13-64) TESTS 20 93 2662400
355396652 adilkhan11 D Dec. 27, 2025, 5:01 p.m. OK C++20 (GCC 13-64) TESTS 20 93 2764800
355405916 HuangZekai D Dec. 27, 2025, 5:28 p.m. OK C++20 (GCC 13-64) TESTS 20 93 3276800
355428445 MLttt D Dec. 28, 2025, 12:27 a.m. OK C++20 (GCC 13-64) TESTS 20 93 3481600

remove filters

Back to search problems