Good Bye 2024: 2025 is NEAR

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
2053 Good Bye 2024: 2025 is NEAR FINISHED False 10800 41009123 Dec. 28, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 75 ) H Delicate Anti-monotonous Operations PROGRAMMING constructive algorithms implementation

There are always many repetitive tasks in life. Iris always dislikes them, so she refuses to repeat them. However, time cannot be turned back; we only have to move forward. Formally, Iris has an integer sequence (a_1, a_2, \ldots, a_n), where each number in the sequence is between (1) and (w), inclusive. It is guaranteed that (w \geq 2). Iris defines an operation as selecting two numbers (a_i, a_{i+1}) satisfying (a_i = a_{i+1}), and then changing them to two arbitrary integers within the range (1, w). Iris does not like equality, so she must guarantee that (a_i \neq a_{i+1}) after the operation. Two identical pairs (a_i, a_{i+1}) can be selected multiple times. Iris wants to know the maximum possible sum of all elements of (a) after several (possible, zero) operations , as well as the minimum number of operations required to achieve this maximum value. Each test contains multiple test cases. The first line contains an integer (t) ((1 \leq t \leq 10^5)) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers (n) and (w) ((1 \leq n \leq 2\cdot 10^5), (2 \leq w \leq 10^8)) — the length of the array, and the maximum allowed value of the elements. The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \leq a_i \leq w)) — the elements in the array. It is guaranteed that the sum of (n) over all test cases does not exceed (10^6). For each test case, output two integers — the maximum possible sum of all elements of (a) and the minimum number of operations required, respectively. In the first test case, no operation can be performed so the answers are (\sum a_i = 15) and (0), respectively. In the second test case, the operations can be performed as follows: ()3, 1, 2, 3, 4, \underline{1, 1} \rightarrow 3, 1, 2, 3, \underline{4, 4}, 5 \rightarrow [3, 1, 2, \underli

Tutorials

Good Bye 2024: 2025 is NEAR Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
298898159 mike286928 H Dec. 28, 2024, 7 p.m. OK C++17 (GCC 7-32) TESTS 177 374 819200
298907878 D.Trump H Dec. 28, 2024, 9:29 p.m. OK C++20 (GCC 13-64) TESTS 177 265 102400
298899805 D.Trump H Dec. 28, 2024, 7:18 p.m. OK C++20 (GCC 13-64) TESTS 177 265 102400
298899330 BernatP H Dec. 28, 2024, 7:13 p.m. OK C++20 (GCC 13-64) TESTS 177 265 102400
298897652 D.Trump H Dec. 28, 2024, 6:55 p.m. OK C++20 (GCC 13-64) TESTS 177 265 102400
298899363 Puigdemont H Dec. 28, 2024, 7:13 p.m. OK C++20 (GCC 13-64) TESTS 177 280 102400
298902258 D.Trump H Dec. 28, 2024, 7:51 p.m. OK C++20 (GCC 13-64) TESTS 177 296 102400
298918985 djq_cpp H Dec. 29, 2024, 3:26 a.m. OK C++20 (GCC 13-64) TESTS 177 749 3276800
298895124 Radewoosh H Dec. 28, 2024, 6:33 p.m. OK C++20 (GCC 13-64) TESTS 177 781 8704000
298884989 ksun48 H Dec. 28, 2024, 5:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 177 265 102400
298882044 jiangly H Dec. 28, 2024, 5:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 177 281 102400
298907587 Benq H Dec. 28, 2024, 9:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 177 312 409600
298908714 antontrygubO_o H Dec. 28, 2024, 9:48 p.m. OK C++23 (GCC 14-64, msys2) TESTS 177 375 819200
298898821 rainboy H Dec. 28, 2024, 7:07 p.m. OK GNU C11 TESTS 177 624 921600
298880147 Egor H Dec. 28, 2024, 4:55 p.m. OK Rust 2021 TESTS 177 187 2969600

remove filters

Back to search problems