Codeforces Round 1027 (Div. 3)

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
2114 Codeforces Round 1027 (Div. 3) FINISHED False 8100 28135523 May 26, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 2026 ) G Build an Array PROGRAMMING bitmasks dp math number theory

Yesterday, Dima found an empty array and decided to add some integers to it. He can perform the following operation an unlimited number of times: add any integer to the left or right end of the array. then, as long as there is a pair of identical adjacent elements in the array, they will be replaced by their sum. It can be shown that there can be at most one such pair in the array at the same time. For example, if the array is (3, 6, 4) and we add the number (3) to the left, the array will first become (3, 3, 6, 4), then the first two elements will be replaced by (6), and the array will become (6, 6, 4), and then — (12, 4). After performing the operation exactly (k) times, he thinks he has obtained an array (a) of length (n), but he does not remember which operations he applied. Determine if there exists a sequence of (k) operations that could result in the given array (a) from an empty array, or determine that it is impossible. The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The descriptions of the test cases follow. The first line of each test case description contains two integers (n) and (k) ((1 \le n \le 10^5), (n \le k \le 10^6)) — the length of the resulting array and the number of operations. The second line contains (n) integers (a_i) ((1 \le a_i \le 10^9, a_{i - 1} \ne a_i)) — the elements of the resulting array. It is guaranteed that the sum of the values of (n) across all test cases does not exceed (10^5). For each test case, if there is no suitable sequence of operations of length (k), output " NO ". Otherwise, output " YES ". You may output " YES " and " NO " in any case (for example, the strings " yEs ", " yes ", " Yes ", and " YES " will be recognized as a positive answer).

Tutorials

143268

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
321620019 _Equinox G May 27, 2025, 9:31 a.m. OK C# 10 TESTS 35 249 13824000
321618931 -firefly- G May 27, 2025, 9:24 a.m. OK C# 10 TESTS 35 296 13824000
321694937 Dipif G May 27, 2025, 6:54 p.m. OK C++17 (GCC 7-32) TESTS 35 77 102400
321668124 PolarisDA G May 27, 2025, 3:09 p.m. OK C++17 (GCC 7-32) TESTS 35 77 102400
321721612 sqsfx G May 28, 2025, 3:56 a.m. OK C++17 (GCC 7-32) TESTS 35 77 307200
321617402 sujalxpro G May 27, 2025, 9:14 a.m. OK C++17 (GCC 7-32) TESTS 35 77 307200
321690910 w-- G May 27, 2025, 6:12 p.m. OK C++17 (GCC 7-32) TESTS 35 77 1331200
321629822 jcelin G May 27, 2025, 10:42 a.m. OK C++17 (GCC 7-32) TESTS 35 77 20070400
321700259 Code937 G May 27, 2025, 7:59 p.m. OK C++17 (GCC 7-32) TESTS 35 77 24064000
321689665 birsnot G May 27, 2025, 6 p.m. OK C++17 (GCC 7-32) TESTS 35 78 0
321637539 ad_offcl G May 27, 2025, 11:38 a.m. OK C++17 (GCC 7-32) TESTS 35 78 0
321716479 Luvidi G May 28, 2025, 2:33 a.m. OK C++17 (GCC 7-32) TESTS 35 78 102400
321723273 MagnusCarlsen321 G May 28, 2025, 4:21 a.m. OK C++20 (GCC 13-64) TESTS 35 62 102400
321701598 BillyGyde001 G May 27, 2025, 8:17 p.m. OK C++20 (GCC 13-64) TESTS 35 62 102400
321674494 FISHKI_RABOTAUT G May 27, 2025, 3:57 p.m. OK C++20 (GCC 13-64) TESTS 35 62 102400
321642575 flying_saucer G May 27, 2025, 12:11 p.m. OK C++20 (GCC 13-64) TESTS 35 62 102400
321631276 Too_Weak_To_Anything G May 27, 2025, 10:53 a.m. OK C++20 (GCC 13-64) TESTS 35 62 102400
321624924 clashgamer1050 G May 27, 2025, 10:06 a.m. OK C++20 (GCC 13-64) TESTS 35 62 307200
321631439 hawk851 G May 27, 2025, 10:54 a.m. OK C++20 (GCC 13-64) TESTS 35 62 1638400
321627739 Carucao G May 27, 2025, 10:26 a.m. OK C++20 (GCC 13-64) TESTS 35 62 2048000
321715895 Mkswll G May 28, 2025, 2:23 a.m. OK C++20 (GCC 13-64) TESTS 35 62 7270400
321641108 Mindeveloped G May 27, 2025, 12:01 p.m. OK C++20 (GCC 13-64) TESTS 35 62 40140800
321718185 Tenryon G May 28, 2025, 3:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 62 102400
321716298 molongdadi G May 28, 2025, 2:30 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 62 102400
321709227 Owll G May 27, 2025, 11:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 35 62 102400
321695919 Shtn G May 27, 2025, 7:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 35 62 102400
321689129 nguyenkhangninh99 G May 27, 2025, 5:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 35 62 102400
321636147 asxziill G May 27, 2025, 11:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 62 102400
321664294 ZeppZeppelin G May 27, 2025, 2:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 35 62 409600
321721103 ngu_dot G May 28, 2025, 3:48 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 62 2457600
321717900 XUNRAN_XXXX G May 28, 2025, 2:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 62 3276800
321659717 chenjue G May 27, 2025, 2:07 p.m. OK C++23 (GCC 14-64, msys2) TESTS 35 62 40140800
321686263 lyongwolf G May 27, 2025, 5:31 p.m. OK Java 21 TESTS 35 265 1638400
321716210 cpp10 G May 28, 2025, 2:28 a.m. OK Java 21 TESTS 35 296 819200
321716279 cpp10 G May 28, 2025, 2:30 a.m. OK Java 21 TESTS 35 312 1740800
321691299 NpHardcore_05 G May 27, 2025, 6:16 p.m. OK Java 21 TESTS 35 327 1536000
321737648 late_night_order G May 28, 2025, 6:02 a.m. OK Java 8 TESTS 35 358 0
321634860 gardengnome G May 27, 2025, 11:20 a.m. OK PyPy 3-64 TESTS 35 202 13824000
321633677 gardengnome G May 27, 2025, 11:12 a.m. OK PyPy 3-64 TESTS 35 202 14336000
321683309 wyzl G May 27, 2025, 5:06 p.m. OK PyPy 3-64 TESTS 35 234 20172800
321680604 Sam_Jiang G May 27, 2025, 4:45 p.m. OK PyPy 3-64 TESTS 35 281 13312000
321696938 0471740 G May 27, 2025, 7:16 p.m. OK PyPy 3-64 TESTS 35 327 15155200
321704787 Creym G May 27, 2025, 9:11 p.m. OK PyPy 3-64 TESTS 35 343 14336000
321627845 El-Qadi G May 27, 2025, 10:26 a.m. OK Python 3 TESTS 35 671 34713600
321670867 AmanRaj-25 G May 27, 2025, 3:29 p.m. OK Python 3 TESTS 35 765 16281600
321718557 A_G G May 28, 2025, 3:07 a.m. OK Rust 2021 TESTS 35 62 5427200
321639157 Martician G May 27, 2025, 11:48 a.m. OK Rust 2021 TESTS 35 77 102400
321644516 jyom G May 27, 2025, 12:24 p.m. OK Rust 2021 TESTS 35 77 512000
321671910 Ming_Xu G May 27, 2025, 3:37 p.m. OK Rust 2021 TESTS 35 77 3891200
321651411 DanielAnker G May 27, 2025, 1:09 p.m. OK Rust 2021 TESTS 35 108 0

remove filters

Back to search problems