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 |
---|---|---|---|---|---|---|
1744 | Codeforces Round 828 (Div. 3) | FINISHED | False | 8100 | 71335463 | Oct. 16, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 22036 ) | D | Divisibility by 2^n | PROGRAMMING | greedy math sortings |
B'You are given an array of positive integers a_1, a_2, ldots, a_n . Make the product of all the numbers in the array (that is, a_1 cdot a_2 cdot ldots cdot a_n ) divisible by 2^n . You can perform the following operation as many times as you like: You cannot apply the operation repeatedly to a single index. In other words, all selected values of i must be different. Find the smallest number of operations you need to perform to make the product of all the elements in the array divisible by 2^n . Note that such a set of operations does not always exist. The first line of the input contains a single integer t (1 <= q t <= q 10^4 ) -- the number test cases. Then the descriptions of the input data sets follow. The first line of each test case contains a single integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the length of array a . The second line of each test case contains exactly n integers: a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^9 ). It is guaranteed that the sum of n values over all test cases in a test does not exceed 2 cdot 10^5 . For each test case, print the least number of operations to make the product of all numbers in the array divisible by 2^n . If the answer does not exist, print -1. In the first test case, the product of all elements is initially 2 , so no operations needed. In the second test case, the product of elements initially equals 6 . We can apply the operation for i = 2 , and then a_2 becomes 2 cdot2=4 , and the product of numbers becomes 3 cdot4=12 , and this product of numbers is divided by 2^n=2^2=4 . In the fourth test case, even if we apply all possible operations, we still cannot make the product of numbers divisible by 2^n -- it will be (13 cdot1) cdot(17 cdot2) cdot(1 cdot3) cdot(1 cdot4)=5304 , which does not divide by 2^n=2^4=16 . In the fifth test case, we can apply operations for $'... |
Codeforces Round #828 (Div. 3) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
176596289 | cyrus_msk | D | Oct. 16, 2022, 5:06 p.m. | OK | D | TESTS | 14 | 109 | 16793600 | ||
176603090 | Abhishek_Tewatia | D | Oct. 16, 2022, 5:58 p.m. | OK | GNU C11 | TESTS | 14 | 78 | 8499200 | ||
176596983 | gsomani | D | Oct. 16, 2022, 5:10 p.m. | OK | GNU C++14 | TESTS | 14 | 46 | 1843200 | ||
176598502 | KhaledFarhat | D | Oct. 16, 2022, 5:20 p.m. | OK | GNU C++14 | TESTS | 14 | 61 | 2662400 | ||
176634818 | tuxuanming2024 | D | Oct. 17, 2022, 3:56 a.m. | OK | GNU C++14 | TESTS | 14 | 62 | 819200 | ||
176637744 | woshishe | D | Oct. 17, 2022, 4:52 a.m. | OK | GNU C++14 | TESTS | 14 | 62 | 819200 | ||
176594785 | ycccc319 | D | Oct. 16, 2022, 4:58 p.m. | OK | GNU C++14 | TESTS | 14 | 62 | 1024000 | ||
176636954 | lms_1012 | D | Oct. 17, 2022, 4:38 a.m. | OK | GNU C++14 | TESTS | 14 | 62 | 1638400 | ||
176634369 | MediationalField | D | Oct. 17, 2022, 3:49 a.m. | OK | GNU C++14 | TESTS | 14 | 62 | 1740800 | ||
176602739 | ReimuHakurei | D | Oct. 16, 2022, 5:55 p.m. | OK | GNU C++14 | TESTS | 14 | 62 | 1843200 | ||
176601936 | ankush_kumar_gupta | D | Oct. 16, 2022, 5:48 p.m. | OK | GNU C++14 | TESTS | 14 | 62 | 2662400 | ||
176605941 | _vaibhavr_ | D | Oct. 16, 2022, 6:24 p.m. | OK | GNU C++14 | TESTS | 14 | 62 | 2662400 | ||
176613959 | TheRedLegend | D | Oct. 16, 2022, 7:54 p.m. | OK | GNU C++17 | TESTS | 14 | 46 | 3481600 | ||
176629145 | love147love | D | Oct. 17, 2022, 2:06 a.m. | OK | GNU C++17 | TESTS | 14 | 61 | 2457600 | ||
176618957 | farah___moh | D | Oct. 16, 2022, 9:08 p.m. | OK | GNU C++17 | TESTS | 14 | 61 | 2662400 | ||
176589833 | jinliuxi | D | Oct. 16, 2022, 4:46 p.m. | OK | GNU C++17 | TESTS | 14 | 61 | 3174400 | ||
176608762 | sixplusfour | D | Oct. 16, 2022, 6:53 p.m. | OK | GNU C++17 | TESTS | 14 | 61 | 3481600 | ||
176628346 | Isaac___ | D | Oct. 17, 2022, 1:46 a.m. | OK | GNU C++17 | TESTS | 14 | 62 | 921600 | ||
176628097 | zwu2020015020 | D | Oct. 17, 2022, 1:39 a.m. | OK | GNU C++17 | TESTS | 14 | 62 | 921600 | ||
176641585 | RFSS_ | D | Oct. 17, 2022, 5:58 a.m. | OK | GNU C++17 | TESTS | 14 | 62 | 921600 | ||
176600325 | yashbabel4 | D | Oct. 16, 2022, 5:34 p.m. | OK | GNU C++17 | TESTS | 14 | 62 | 1024000 | ||
176614417 | pogson | D | Oct. 16, 2022, 8 p.m. | OK | GNU C++17 | TESTS | 14 | 62 | 1024000 | ||
176638604 | Freedom__King | D | Oct. 17, 2022, 5:11 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 15 | 3072000 | ||
176629007 | Fan_zf | D | Oct. 17, 2022, 2:03 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 46 | 0 | ||
176628378 | LunaScamanderLovegood | D | Oct. 17, 2022, 1:47 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 46 | 819200 | ||
176637820 | Diegogrc | D | Oct. 17, 2022, 4:54 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 46 | 1126400 | ||
176618768 | PurpleCrayon | D | Oct. 16, 2022, 9:05 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 46 | 2048000 | ||
176632839 | Jakon | D | Oct. 17, 2022, 3:21 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 46 | 2150400 | ||
176624382 | Jame___boy | D | Oct. 16, 2022, 11:54 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 46 | 2355200 | ||
176600908 | TrendBattles | D | Oct. 16, 2022, 5:39 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 46 | 2867200 | ||
176634938 | Kidding_M | D | Oct. 17, 2022, 3:59 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 46 | 2969600 | ||
176597485 | Chime | D | Oct. 16, 2022, 5:14 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 46 | 3174400 | ||
176634057 | Fly_999 | D | Oct. 17, 2022, 3:43 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 31 | 819200 | ||
176611839 | deadpool28 | D | Oct. 16, 2022, 7:28 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 31 | 1228800 | ||
176614121 | gojo_senpai | D | Oct. 16, 2022, 7:56 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 31 | 1228800 | ||
176640361 | freakin23 | D | Oct. 17, 2022, 5:40 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 31 | 1638400 | ||
176640456 | UtTaRaN | D | Oct. 17, 2022, 5:42 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 31 | 2150400 | ||
176598858 | YassineBY | D | Oct. 16, 2022, 5:23 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 31 | 2764800 | ||
176589893 | somerandomdude | D | Oct. 16, 2022, 4:46 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 31 | 2867200 | ||
176634501 | oldyan | D | Oct. 17, 2022, 3:51 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 31 | 2969600 | ||
176640259 | devkudawla | D | Oct. 17, 2022, 5:39 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 31 | 3174400 | ||
176594748 | mistcola | D | Oct. 16, 2022, 4:58 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 31 | 3174400 | ||
176604341 | nRookie7 | D | Oct. 16, 2022, 6:09 p.m. | OK | Go | TESTS | 14 | 124 | 23347200 | ||
176629482 | im0use | D | Oct. 17, 2022, 2:14 a.m. | OK | Go | TESTS | 14 | 139 | 38604800 | ||
176604515 | himanshu19468 | D | Oct. 16, 2022, 6:11 p.m. | OK | Java 11 | TESTS | 14 | 264 | 24678400 | ||
176634744 | NithinBharathi | D | Oct. 17, 2022, 3:55 a.m. | OK | Java 11 | TESTS | 14 | 280 | 0 | ||
176593648 | x21svage | D | Oct. 16, 2022, 4:53 p.m. | OK | Java 11 | TESTS | 14 | 280 | 24883200 | ||
176588143 | anand_a3b | D | Oct. 16, 2022, 4:43 p.m. | OK | Java 11 | TESTS | 14 | 296 | 24576000 | ||
176597158 | pranp_24 | D | Oct. 16, 2022, 5:12 p.m. | OK | Java 11 | TESTS | 14 | 327 | 24576000 | ||
176610132 | Saurabh_jayaswal | D | Oct. 16, 2022, 7:08 p.m. | OK | Java 11 | TESTS | 14 | 342 | 24780800 | ||
176604881 | tiger10092002 | D | Oct. 16, 2022, 6:14 p.m. | OK | Java 11 | TESTS | 14 | 342 | 66764800 | ||
176592521 | mishraadarsh02 | D | Oct. 16, 2022, 4:49 p.m. | OK | Java 11 | TESTS | 14 | 343 | 24576000 | ||
176616915 | AyushS_cg170 | D | Oct. 16, 2022, 8:36 p.m. | OK | Java 11 | TESTS | 14 | 467 | 38912000 | ||
176591435 | PlayDate | D | Oct. 16, 2022, 4:48 p.m. | OK | Java 11 | TESTS | 14 | 545 | 25292800 | ||
176594640 | Utsav82 | D | Oct. 16, 2022, 4:58 p.m. | OK | Java 17 | TESTS | 14 | 264 | 40345600 | ||
176626493 | Mamimi | D | Oct. 17, 2022, 12:58 a.m. | OK | Java 17 | TESTS | 14 | 311 | 40755200 | ||
176588365 | harman1148 | D | Oct. 16, 2022, 4:44 p.m. | OK | Java 17 | TESTS | 14 | 389 | 55091200 | ||
176601842 | Dukkha | D | Oct. 16, 2022, 5:47 p.m. | OK | Java 17 | TESTS | 14 | 608 | 40550400 | ||
176616821 | bigBull2 | D | Oct. 16, 2022, 8:34 p.m. | OK | Java 17 | TESTS | 14 | 608 | 40857600 | ||
176640584 | 3.1415926535... | D | Oct. 17, 2022, 5:43 a.m. | OK | Java 8 | TESTS | 14 | 171 | 0 | ||
176591075 | Eslam_Ahmed | D | Oct. 16, 2022, 4:48 p.m. | OK | Java 8 | TESTS | 14 | 171 | 24064000 | ||
176614124 | Do_not_Look_Back | D | Oct. 16, 2022, 7:56 p.m. | OK | Java 8 | TESTS | 14 | 187 | 24064000 | ||
176623403 | ahmedtawfik | D | Oct. 16, 2022, 10:59 p.m. | OK | Java 8 | TESTS | 14 | 202 | 24268800 | ||
176604135 | ahmedtawfik | D | Oct. 16, 2022, 6:07 p.m. | OK | Java 8 | TESTS | 14 | 202 | 24268800 | ||
176591198 | abhi2501 | D | Oct. 16, 2022, 4:48 p.m. | OK | Java 8 | TESTS | 14 | 202 | 24268800 | ||
176641413 | kausanubhav2018 | D | Oct. 17, 2022, 5:56 a.m. | OK | Java 8 | TESTS | 14 | 202 | 66150400 | ||
176639336 | depurador_ik | D | Oct. 17, 2022, 5:25 a.m. | OK | Java 8 | TESTS | 14 | 280 | 4096000 | ||
176613348 | Kaldaruly | D | Oct. 16, 2022, 7:46 p.m. | OK | Java 8 | TESTS | 14 | 280 | 81920000 | ||
176598855 | _NursultaN_ | D | Oct. 16, 2022, 5:23 p.m. | OK | Java 8 | TESTS | 14 | 295 | 24268800 | ||
176637794 | lxllxs | D | Oct. 17, 2022, 4:53 a.m. | OK | MS C++ 2017 | TESTS | 14 | 78 | 1638400 | ||
176637660 | merzgling | D | Oct. 17, 2022, 4:51 a.m. | OK | MS C++ 2017 | TESTS | 14 | 202 | 1638400 | ||
176616033 | gharsh_69 | D | Oct. 16, 2022, 8:22 p.m. | OK | MS C++ 2017 | TESTS | 14 | 202 | 1945600 | ||
176595396 | zeritonik | D | Oct. 16, 2022, 5:02 p.m. | OK | MS C++ 2017 | TESTS | 14 | 202 | 1945600 | ||
176593847 | OmarRnr | D | Oct. 16, 2022, 4:54 p.m. | OK | MS C++ 2017 | TESTS | 14 | 202 | 4198400 | ||
176599636 | wafla | D | Oct. 16, 2022, 5:28 p.m. | OK | MS C++ 2017 | TESTS | 14 | 218 | 3891200 | ||
176589819 | DimaKhovrov | D | Oct. 16, 2022, 4:46 p.m. | OK | MS C++ 2017 | TESTS | 14 | 233 | 5120000 | ||
176621748 | kaskelot | D | Oct. 16, 2022, 10:08 p.m. | OK | MS C++ 2017 | TESTS | 14 | 249 | 4300800 | ||
176612311 | rsFalse | D | Oct. 16, 2022, 7:34 p.m. | OK | Perl | TESTS | 14 | 779 | 44441600 | ||
176605376 | yashsarda2002 | D | Oct. 16, 2022, 6:19 p.m. | OK | PyPy 3 | TESTS | 14 | 202 | 38400000 | ||
176597421 | MohamedHamed123 | D | Oct. 16, 2022, 5:13 p.m. | OK | PyPy 3 | TESTS | 14 | 327 | 37580800 | ||
176594230 | f20210555 | D | Oct. 16, 2022, 4:56 p.m. | OK | PyPy 3 | TESTS | 14 | 546 | 36761600 | ||
176601794 | akshat11 | D | Oct. 16, 2022, 5:47 p.m. | OK | PyPy 3 | TESTS | 14 | 561 | 36044800 | ||
176634054 | FrozenKandy | D | Oct. 17, 2022, 3:43 a.m. | OK | PyPy 3-64 | TESTS | 14 | 155 | 30412800 | ||
176631654 | bokunopicolo | D | Oct. 17, 2022, 2:57 a.m. | OK | PyPy 3-64 | TESTS | 14 | 170 | 27545600 | ||
176606165 | avolventa | D | Oct. 16, 2022, 6:26 p.m. | OK | PyPy 3-64 | TESTS | 14 | 171 | 53145600 | ||
176639677 | ketanraut88 | D | Oct. 17, 2022, 5:30 a.m. | OK | PyPy 3-64 | TESTS | 14 | 186 | 31744000 | ||
176618839 | kavorka | D | Oct. 16, 2022, 9:06 p.m. | OK | PyPy 3-64 | TESTS | 14 | 186 | 60928000 | ||
176640842 | valentk777 | D | Oct. 17, 2022, 5:47 a.m. | OK | PyPy 3-64 | TESTS | 14 | 187 | 27852800 | ||
176615747 | AhmdJabr | D | Oct. 16, 2022, 8:18 p.m. | OK | PyPy 3-64 | TESTS | 14 | 187 | 58675200 | ||
176605961 | avolventa | D | Oct. 16, 2022, 6:24 p.m. | OK | PyPy 3-64 | TESTS | 14 | 202 | 48537600 | ||
176603133 | Alex239 | D | Oct. 16, 2022, 5:59 p.m. | OK | PyPy 3-64 | TESTS | 14 | 217 | 49049600 | ||
176596416 | JinJooLove | D | Oct. 16, 2022, 5:07 p.m. | OK | PyPy 3-64 | TESTS | 14 | 217 | 59596800 | ||
176599944 | Prithiviraj | D | Oct. 16, 2022, 5:31 p.m. | OK | Python 3 | TESTS | 14 | 1076 | 20684800 | ||
176603846 | Karcher | D | Oct. 16, 2022, 6:05 p.m. | OK | Python 3 | TESTS | 14 | 1091 | 20582400 | ||
176599741 | Prithiviraj | D | Oct. 16, 2022, 5:29 p.m. | OK | Python 3 | TESTS | 14 | 1091 | 20787200 | ||
176590678 | TheAbbie | D | Oct. 16, 2022, 4:47 p.m. | OK | Python 3 | TESTS | 14 | 1154 | 20684800 | ||
176618979 | flownn | D | Oct. 16, 2022, 9:09 p.m. | OK | Python 3 | TESTS | 14 | 1200 | 20275200 | ||
176595984 | dmitri_the_cat | D | Oct. 16, 2022, 5:05 p.m. | OK | Python 3 | TESTS | 14 | 1232 | 20787200 | ||
176636229 | hp685 | D | Oct. 17, 2022, 4:25 a.m. | OK | Python 3 | TESTS | 14 | 1294 | 16076800 | ||
176636496 | hp685 | D | Oct. 17, 2022, 4:30 a.m. | OK | Python 3 | TESTS | 14 | 1310 | 15667200 | ||
176641774 | kingutus | D | Oct. 17, 2022, 6 a.m. | OK | Python 3 | TESTS | 14 | 1372 | 16179200 | ||
176606577 | Manikya_0309 | D | Oct. 16, 2022, 6:30 p.m. | OK | Python 3 | TESTS | 14 | 1466 | 18227200 | ||
176631420 | Andrew.Tweddle | D | Oct. 17, 2022, 2:53 a.m. | OK | Rust 2021 | TESTS | 14 | 108 | 6246400 |
Back to search problems