Codeforces Round 1068 (Div. 2)

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
2173 Codeforces Round 1068 (Div. 2) FINISHED False 7200 11460323 Dec. 5, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 12221 ) C Kanade's Perfect Multiples PROGRAMMING greedy number theory

In the afterlife school, Kanade studies a peculiar number game. She gives you two integers (n) and (k), as well as an array (a) consisting of (n) integers, where (1 \le a_i \le k) holds. For an integer set (B = \{b_1, b_2, \ldots, b_m\}) where (1\le b_i\le k), we call it complete if and only if both of the following hold: For each (1\le i\le n), at least one divisor of (a_i) is contained in (B); For each (1\le j\le m), all positive multiples of (b_j) which are less than or equal to (k) appear in the array (a) at least once. You have to find a complete set (B) with minimum possible size, or determine that no such set 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 (k) ((1\le n\le 2\cdot 10^5), (1\le k\le 10^9)) — the length of (a) and the upper bound of elements of (a). The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((1\le a_i\le k)) — the elements of (a). It is guaranteed that the sum of (n) over all test cases does not exceed (2\cdot 10^5). For each test case: If no complete set (B) exists, print a single integer (-1) in the only line of output. Otherwise: First print a single integer (m) ((1\le m\le n)) in the first line of output — the size of (B). Note that you have to minimize the size of (B). Then output (m) integers (b_1, b_2, \ldots, b_m) ((1 \le b_i \le k)) in the second line — the set you constructed. First print a single integer (m) ((1\le m\le n)) in the first line of output — the size of (B). Note that you have to minimize the size of (B). Then output (m) integers (b_1, b_2, \ldots, b_m) ((1 \le b_i \le k)) in the second line — the set you constructed. If there are multiple

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
352098717 gyomihaly C Dec. 5, 2025, 4:33 p.m. OK C# 13 TESTS 15 156 62054400
352105816 muscari_1 C Dec. 5, 2025, 5:31 p.m. OK C++17 (GCC 7-32) TESTS 15 78 102400
352105911 siddharth1119sid C Dec. 5, 2025, 5:31 p.m. OK C++17 (GCC 7-32) TESTS 15 78 307200
352103023 woruo27 C Dec. 5, 2025, 5:17 p.m. OK C++17 (GCC 7-32) TESTS 15 78 1638400
352122373 Mr._Hulk C Dec. 5, 2025, 7:32 p.m. OK C++17 (GCC 7-32) TESTS 15 78 4505600
352116229 omar_faruk132 C Dec. 5, 2025, 6:40 p.m. OK C++17 (GCC 7-32) TESTS 15 93 0
352161455 k_s_r C Dec. 6, 2025, 5:02 a.m. OK C++17 (GCC 7-32) TESTS 15 93 102400
352149454 huy1304 C Dec. 6, 2025, 2:46 a.m. OK C++17 (GCC 7-32) TESTS 15 93 102400
352121809 IITG28_DhananjitDas C Dec. 5, 2025, 7:27 p.m. OK C++17 (GCC 7-32) TESTS 15 93 102400
352115829 null_reference C Dec. 5, 2025, 6:37 p.m. OK C++17 (GCC 7-32) TESTS 15 93 102400
352097492 Invisigal C Dec. 5, 2025, 4:30 p.m. OK C++17 (GCC 7-32) TESTS 15 93 102400
352143138 dark__moon C Dec. 6, 2025, 1:25 a.m. OK C++20 (GCC 13-64) TESTS 15 62 0
352168089 vikasreddy1308 C Dec. 6, 2025, 6 a.m. OK C++20 (GCC 13-64) TESTS 15 62 102400
352104501 jigyasaaa_ C Dec. 5, 2025, 5:23 p.m. OK C++20 (GCC 13-64) TESTS 15 62 4608000
352149667 Aphelic22 C Dec. 6, 2025, 2:48 a.m. OK C++20 (GCC 13-64) TESTS 15 78 0
352149374 Aphelic22 C Dec. 6, 2025, 2:45 a.m. OK C++20 (GCC 13-64) TESTS 15 78 0
352127377 Omar_Mohammad C Dec. 5, 2025, 8:23 p.m. OK C++20 (GCC 13-64) TESTS 15 78 0
352113043 Hasan_as C Dec. 5, 2025, 6:16 p.m. OK C++20 (GCC 13-64) TESTS 15 78 0
352103355 feev1x C Dec. 5, 2025, 5:18 p.m. OK C++20 (GCC 13-64) TESTS 15 78 0
352125588 cf_pomoyka5252 C Dec. 5, 2025, 8:03 p.m. OK C++20 (GCC 13-64) TESTS 15 78 102400
352094853 NotCon C Dec. 5, 2025, 4:25 p.m. OK C++20 (GCC 13-64) TESTS 15 78 102400
352130204 logonax C Dec. 5, 2025, 9 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 0
352116825 Jadeninja_12a C Dec. 5, 2025, 6:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 0
352106623 Spicy_Syntax C Dec. 5, 2025, 5:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 0
352095501 srujan.karthikey C Dec. 5, 2025, 4:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 0
352150326 Serendipity__ C Dec. 6, 2025, 2:56 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 102400
352141410 YouKn0wMe2005 C Dec. 6, 2025, 12:47 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 102400
352163667 Irelia201307 C Dec. 6, 2025, 5:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 819200
352098304 vinayakmittal027 C Dec. 5, 2025, 4:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 1536000
352163929 gunuruhemanthkumar C Dec. 6, 2025, 5:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 1945600
352165036 Zzzr12345 C Dec. 6, 2025, 5:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 2048000
352105068 ruban C Dec. 5, 2025, 5:26 p.m. OK FPC TESTS 15 218 148889600
352091024 sucharitak_2006 C Dec. 5, 2025, 4:17 p.m. OK GNU C11 TESTS 15 859 1843200
352093182 bughunter_newb C Dec. 5, 2025, 4:22 p.m. OK GNU C11 TESTS 15 1046 12595200
352099149 xiannu116ccc C Dec. 5, 2025, 4:33 p.m. OK Go TESTS 15 125 11776000
352113149 chethan_coding C Dec. 5, 2025, 6:17 p.m. OK Go TESTS 15 125 29593600
352168143 bailimice C Dec. 6, 2025, 6 a.m. OK Go TESTS 15 140 14336000
352158555 Cai_Guang C Dec. 6, 2025, 4:34 a.m. OK Go TESTS 15 171 14233600
352092719 treasuryonly C Dec. 5, 2025, 4:21 p.m. OK Haskell TESTS 15 203 18944000
352095078 xiannu114ccc C Dec. 5, 2025, 4:26 p.m. OK Java 21 TESTS 15 250 1945600
352094881 Khushboo_Singh1111 C Dec. 5, 2025, 4:25 p.m. OK Java 21 TESTS 15 265 5734400
352092393 gy2134 C Dec. 5, 2025, 4:20 p.m. OK Java 21 TESTS 15 343 20070400
352093480 xiannu113ccc C Dec. 5, 2025, 4:23 p.m. OK Java 21 TESTS 15 343 20582400
352158769 _infinite_loop C Dec. 6, 2025, 4:36 a.m. OK Java 21 TESTS 15 343 36044800
352096360 xiannu115ccc C Dec. 5, 2025, 4:28 p.m. OK Java 21 TESTS 15 359 1228800
352168569 jacksparrow53536 C Dec. 6, 2025, 6:04 a.m. OK Java 21 TESTS 15 406 7270400
352094268 shubhyadav4838 C Dec. 5, 2025, 4:24 p.m. OK Java 21 TESTS 15 406 24780800
352151283 dzhi C Dec. 6, 2025, 3:07 a.m. OK Java 21 TESTS 15 421 27750400
352091941 Aisenh037 C Dec. 5, 2025, 4:19 p.m. OK Java 21 TESTS 15 421 32768000
352095993 aditya_0013 C Dec. 5, 2025, 4:28 p.m. OK Java 8 TESTS 15 468 39116800
352103688 abhayrajnegi0416 C Dec. 5, 2025, 5:20 p.m. OK Java 8 TESTS 15 515 46284800
352092675 YatiTiwari C Dec. 5, 2025, 4:21 p.m. OK Java 8 TESTS 15 734 6041600
352096342 mnshakib79 C Dec. 5, 2025, 4:28 p.m. OK Java 8 TESTS 15 781 33484800
352096029 opgod_07 C Dec. 5, 2025, 4:28 p.m. OK PyPy 3 TESTS 15 406 38092800
352141016 gopikrishna9968 C Dec. 6, 2025, 12:34 a.m. OK PyPy 3 TESTS 15 437 21196800
352108476 ps2006 C Dec. 5, 2025, 5:46 p.m. OK PyPy 3 TESTS 15 453 31232000
352094384 subhash_01 C Dec. 5, 2025, 4:24 p.m. OK PyPy 3 TESTS 15 500 26624000
352099867 daehyuck2000 C Dec. 5, 2025, 4:34 p.m. OK PyPy 3 TESTS 15 531 27136000
352092854 Dharanidharram C Dec. 5, 2025, 4:21 p.m. OK PyPy 3 TESTS 15 625 38604800
352122185 Sai_nikhilchakravarthi C Dec. 5, 2025, 7:31 p.m. OK PyPy 3-64 TESTS 15 125 37990400
352134786 Polynomu C Dec. 5, 2025, 10:26 p.m. OK PyPy 3-64 TESTS 15 156 34713600
352151566 tequila_sunrise C Dec. 6, 2025, 3:11 a.m. OK PyPy 3-64 TESTS 15 156 35635200
352127688 gbasecom C Dec. 5, 2025, 8:26 p.m. OK PyPy 3-64 TESTS 15 156 46387200
352164304 youngdp C Dec. 6, 2025, 5:30 a.m. OK PyPy 3-64 TESTS 15 171 27136000
352168564 Little_Sheep_Yawn C Dec. 6, 2025, 6:03 a.m. OK PyPy 3-64 TESTS 15 171 39628800
352108371 Terminator-7 C Dec. 5, 2025, 5:45 p.m. OK PyPy 3-64 TESTS 15 171 56934400
352107037 saksafonio C Dec. 5, 2025, 5:38 p.m. OK PyPy 3-64 TESTS 15 187 29184000
352113399 nik1009 C Dec. 5, 2025, 6:19 p.m. OK PyPy 3-64 TESTS 15 187 29491200
352103572 Vanekss C Dec. 5, 2025, 5:19 p.m. OK PyPy 3-64 TESTS 15 187 31436800
352113547 KAMALASHKUMAARC C Dec. 5, 2025, 6:19 p.m. OK Python 3 TESTS 15 187 54784000
352168414 ChanTP C Dec. 6, 2025, 6:02 a.m. OK Python 3 TESTS 15 203 34816000
352099164 sbt214 C Dec. 5, 2025, 4:33 p.m. OK Python 3 TESTS 15 234 73932800
352158207 Havuanh C Dec. 6, 2025, 4:30 a.m. OK Python 3 TESTS 15 265 53145600
352092091 xiannu112ccc C Dec. 5, 2025, 4:20 p.m. OK Python 3 TESTS 15 296 67481600
352097100 javidbid C Dec. 5, 2025, 4:30 p.m. OK Python 3 TESTS 15 312 44134400
352120442 jayanth_yjr C Dec. 5, 2025, 7:16 p.m. OK Python 3 TESTS 15 328 35635200
352091088 muluken_k C Dec. 5, 2025, 4:18 p.m. OK Python 3 TESTS 15 343 36352000
352155613 TimTeng C Dec. 6, 2025, 4:01 a.m. OK Python 3 TESTS 15 359 44134400
352094181 Ruiming_0822 C Dec. 5, 2025, 4:24 p.m. OK Python 3 TESTS 15 468 63078400
352112612 allcaps C Dec. 5, 2025, 6:13 p.m. OK Rust 2024 TESTS 15 125 9625600

remove filters

Back to search problems