Codeforces Round 954 (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
1986 Codeforces Round 954 (Div. 3) FINISHED False 8100 18025763 June 23, 2024, 2:50 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 9152 ) E Beautiful Array PROGRAMMING dp math sortings

B'You are given an array of integers a_1, a_2, ldots, a_n and an integer k . You need to make it beautiful with the least amount of operations. Before applying operations, you can shuffle the array elements as you like. For one operation, you can do the following: The array b_1, b_2, ldots, b_n is beautiful if b_i = b_{n - i + 1} for all 1 <= q i <= q n . Find the minimum number of operations needed to make the array beautiful, or report that it is impossible. Each test consists of several sets of input data. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of sets of input data. Then follows their description. The first line of each set of input data contains two integers n and k ( 1 <= q n <= q 10^5 , 1 <= q k <= q 10^9 ) -- the size of the array a and the number k from the problem statement. The second line of each set of input data contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^9 ) -- the elements of the array a . It is guaranteed that the sum of n over all sets of input data does not exceed 2 cdot 10^5 . For each set of input data, output the minimum number of operations needed to make the array beautiful, or -1 if it is impossible. In the first set of input data, the array is already beautiful. In the second set of input data, you can shuffle the array before the operations and perform the operation with index i = 1 for 83966524 times. In the third set of input data, you can shuffle the array a and make it equal to [2, 3, 1] . Then apply the operation with index i = 3 to get the array [2, 3, 2] , which is beautiful. In the eighth set of input data, there is no set of operations and no way to shuffle the elements to make the array beautiful. In the ninth set of input data, the array is already beautiful. '...

Tutorials

130762

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
267076851 aqwalnut E June 23, 2024, 5:03 p.m. OK C# 10 TESTS 20 156 24166400
267082028 dhrxv_ E June 23, 2024, 5:26 p.m. OK C++14 (GCC 6-32) TESTS 20 109 0
267077997 snakefoot E June 23, 2024, 5:04 p.m. OK C++14 (GCC 6-32) TESTS 20 109 1126400
267086648 enlighted_prani E June 23, 2024, 6:02 p.m. OK C++14 (GCC 6-32) TESTS 20 124 1126400
267088127 ridim99 E June 23, 2024, 6:15 p.m. OK C++14 (GCC 6-32) TESTS 20 124 1433600
267080461 abcdxyznmasad E June 23, 2024, 5:17 p.m. OK C++14 (GCC 6-32) TESTS 20 124 1638400
267091301 yuyc E June 23, 2024, 6:46 p.m. OK C++14 (GCC 6-32) TESTS 20 124 3174400
267095612 pandearindam E June 23, 2024, 7:36 p.m. OK C++14 (GCC 6-32) TESTS 20 139 0
267076845 snakefoot E June 23, 2024, 5:03 p.m. OK C++14 (GCC 6-32) TESTS 20 139 0
267093067 spacedate_xacs E June 23, 2024, 7:06 p.m. OK C++14 (GCC 6-32) TESTS 20 139 921600
267076365 example_1 E June 23, 2024, 5:02 p.m. OK C++14 (GCC 6-32) TESTS 20 140 0
267085487 ScraperNerd E June 23, 2024, 5:53 p.m. OK C++17 (GCC 7-32) TESTS 20 93 0
267095769 pushkarr_t19027 E June 23, 2024, 7:39 p.m. OK C++17 (GCC 7-32) TESTS 20 108 0
267092805 Ayush_IITKgp E June 23, 2024, 7:03 p.m. OK C++17 (GCC 7-32) TESTS 20 108 0
267085720 cooler_killer E June 23, 2024, 5:54 p.m. OK C++17 (GCC 7-32) TESTS 20 108 0
267083285 mohitk54522 E June 23, 2024, 5:35 p.m. OK C++17 (GCC 7-32) TESTS 20 108 0
267080671 _0-1_nap_nap_ E June 23, 2024, 5:18 p.m. OK C++17 (GCC 7-32) TESTS 20 108 0
267099274 Higgsino E June 23, 2024, 8:26 p.m. OK C++17 (GCC 7-32) TESTS 20 109 0
267098941 Francis010 E June 23, 2024, 8:21 p.m. OK C++17 (GCC 7-32) TESTS 20 109 0
267092725 Francis010 E June 23, 2024, 7:02 p.m. OK C++17 (GCC 7-32) TESTS 20 109 0
267090776 rakhi__07d E June 23, 2024, 6:40 p.m. OK C++17 (GCC 7-32) TESTS 20 109 0
267101301 aneee E June 23, 2024, 8:57 p.m. OK C++20 (GCC 13-64) TESTS 31 93 0
267093318 kevin_Durant_ E June 23, 2024, 7:09 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
267092565 heisenberg_120 E June 23, 2024, 7:01 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
267092085 Manjot1151 E June 23, 2024, 6:55 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
267084655 _998244353 E June 23, 2024, 5:46 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
267079765 RHEXAOC E June 23, 2024, 5:13 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
267093048 themehulpahuja E June 23, 2024, 7:06 p.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
267086952 LilBunnyKing E June 23, 2024, 6:04 p.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
267086673 _AhSaN_ E June 23, 2024, 6:02 p.m. OK C++20 (GCC 13-64) TESTS 20 93 204800
267086183 strikerrr E June 23, 2024, 5:58 p.m. OK C++20 (GCC 13-64) TESTS 20 93 307200
267079445 AKhacks E June 23, 2024, 5:11 p.m. OK Java 21 TESTS 20 374 1638400
267118784 priyaroy3370 E June 24, 2024, 2:56 a.m. OK Java 21 TESTS 31 390 19865600
267077416 ferfer E June 23, 2024, 5:04 p.m. OK Java 21 TESTS 20 406 1536000
267100008 pranp_24 E June 23, 2024, 8:36 p.m. OK Java 21 TESTS 31 421 10649600
267087278 whd_CN E June 23, 2024, 6:07 p.m. OK Java 21 TESTS 20 437 5427200
267075921 dev_loop E June 23, 2024, 5:02 p.m. OK Java 21 TESTS 20 452 3276800
267083715 dineshchandran311 E June 23, 2024, 5:38 p.m. OK Java 21 TESTS 20 467 7270400
267117774 testtest111ksjfrdvn E June 24, 2024, 2:39 a.m. OK Java 21 TESTS 31 515 25395200
267079645 Utsav82 E June 23, 2024, 5:12 p.m. OK Java 21 TESTS 20 530 42598400
267082352 SD125 E June 23, 2024, 5:28 p.m. OK Java 21 TESTS 20 546 11161600
267079294 Prime369 E June 23, 2024, 5:11 p.m. OK Java 8 TESTS 20 281 4608000
267091991 Sumitsingh7 E June 23, 2024, 6:54 p.m. OK Java 8 TESTS 20 296 21094400
267127167 achyut88 E June 24, 2024, 4:48 a.m. OK Java 8 TESTS 31 311 10649600
267078177 yadavDipesh E June 23, 2024, 5:04 p.m. OK Java 8 TESTS 20 327 409600
267077367 yadavDipesh E June 23, 2024, 5:04 p.m. OK Java 8 TESTS 20 327 409600
267124844 yadavDipesh E June 24, 2024, 4:20 a.m. OK Java 8 TESTS 31 328 22323200
267081427 dauletomarov1130 E June 23, 2024, 5:23 p.m. OK Java 8 TESTS 20 546 0
267090394 PlayDate E June 23, 2024, 6:36 p.m. OK Java 8 TESTS 20 561 0
267116770 aditya888 E June 24, 2024, 2:22 a.m. OK Java 8 TESTS 31 608 23449600
267127404 om172 E June 24, 2024, 4:50 a.m. OK Java 8 TESTS 31 842 17408000
267095096 hssn E June 23, 2024, 7:31 p.m. OK Kotlin 1.9 TESTS 20 452 8704000
267132602 nesco E June 24, 2024, 5:53 a.m. OK Kotlin 1.9 TESTS 31 483 15872000
267111287 KingofCSES E June 24, 2024, 12:23 a.m. OK PyPy 3 TESTS 31 484 15257600
267077251 anatemsf E June 23, 2024, 5:04 p.m. OK PyPy 3 TESTS 20 515 14643200
267099329 cecilia.chan E June 23, 2024, 8:27 p.m. OK PyPy 3-64 TESTS 20 187 23142400
267080601 VidGa E June 23, 2024, 5:18 p.m. OK PyPy 3-64 TESTS 20 202 19251200
267130373 accelerate_nju E June 24, 2024, 5:28 a.m. OK PyPy 3-64 TESTS 31 233 23654400
267094643 DeadMan69 E June 23, 2024, 7:25 p.m. OK PyPy 3-64 TESTS 20 234 22732800
267087132 Charles_LHN E June 23, 2024, 6:06 p.m. OK PyPy 3-64 TESTS 20 234 22835200
267109339 Deecey01 E June 23, 2024, 11:33 p.m. OK PyPy 3-64 TESTS 31 234 23654400
267117434 zhengyi20thu E June 24, 2024, 2:33 a.m. OK PyPy 3-64 TESTS 31 234 24473600
267117323 zhengyi20thu E June 24, 2024, 2:31 a.m. OK PyPy 3-64 TESTS 31 234 24576000
267119482 cybsbbb E June 24, 2024, 3:07 a.m. OK PyPy 3-64 TESTS 31 234 26316800
267079635 KimJinwoo E June 23, 2024, 5:12 p.m. OK PyPy 3-64 TESTS 20 249 22016000
267098632 bigdamdam E June 23, 2024, 8:17 p.m. OK Python 3 TESTS 20 312 13721600
267100424 prathamsibal81 E June 23, 2024, 8:43 p.m. OK Python 3 TESTS 31 328 26624000
267075644 soumya_sakshi E June 23, 2024, 5:01 p.m. OK Python 3 TESTS 20 374 30515200
267084777 nazeeftham007 E June 23, 2024, 5:47 p.m. OK Python 3 TESTS 20 500 20684800
267087754 mumuslp E June 23, 2024, 6:11 p.m. OK Python 3 TESTS 20 515 41574400
267089409 mihir111p E June 23, 2024, 6:26 p.m. OK Python 3 TESTS 20 562 26521600
267101029 0x81 E June 23, 2024, 8:52 p.m. OK Ruby 3 TESTS 31 1171 33280000
267080161 fieubat2x E June 23, 2024, 5:15 p.m. OK Rust 2021 TESTS 20 109 6041600

remove filters

Back to search problems