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 |
---|---|---|---|---|---|---|
1225 | Technocup 2020 - Elimination Round 2 | FINISHED | False | 7200 | 165351287 | Oct. 26, 2019, 11:05 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 9121 ) | C | p-binary | PROGRAMMING | bitmasks brute force math | 1600 |
B'Vasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only likes a single integer p (which may be positive, negative, or zero). To combine their tastes, they invented p -binary numbers of the form 2^x + p , where x is a non-negative integer. For example, some -9 -binary ("minus nine" binary) numbers are: -8 (minus eight), 7 and 1015 ( -8=2^0-9 , 7=2^4-9 , 1015=2^{10}-9 ). The boys now use p -binary numbers to represent everything. They now face a problem: given a positive integer n , what 's the smallest number of p -binary numbers (not necessarily distinct) they need to represent n as their sum? It may be possible that representation is impossible altogether. Help them solve this problem. For example, if p=0 we can represent 7 as 2^0 + 2^1 + 2^2 . And if p=-9 we can represent 7 as one number (2^4-9) . Note that negative p -binary numbers are allowed to be in the sum (see the Notes section for an example). The only line contains two integers n and p ( 1 <= q n <= q 10^9 , -1000 <= q p <= q 1000 ). If it is impossible to represent n as the sum of any number of p -binary numbers, print a single integer -1 . Otherwise, print the smallest possible number of summands. 0 -binary numbers are just regular binary powers, thus in the first sample case we can represent 24 = (2^4 + 0) + (2^3 + 0) . In the second sample case, we can represent 24 = (2^4 + 1) + (2^2 + 1) + (2^0 + 1) . In the third sample case, we can represent 24 = (2^4 - 1) + (2^2 - 1) + (2^2 - 1) + (2^2 - 1) . Note that repeated summands are allowed. In the fourth sample case, we can represent 4 = (2^4 - 7) + (2^1 - 7) . Note that the second summand is negative, which is allowed. In the fifth sample case, no representation is possible. '... |
70898 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
65875654 | zakhar0 | C | Nov. 27, 2019, 4:55 p.m. | OK | Clang++17 Diagnostics | TESTS | 50 | 61 | 0 | 1600 | |
66295953 | abcd227 | C | Dec. 5, 2019, 4:19 a.m. | OK | GNU C11 | TESTS | 50 | 31 | 0 | 1600 | |
63898311 | luogu_bot1 | C | Oct. 31, 2019, 3:39 a.m. | OK | GNU C++11 | TESTS | 50 | 30 | 0 | 1600 | |
69618556 | Apsara | C | Jan. 27, 2020, 1:55 p.m. | OK | GNU C++11 | TESTS | 50 | 31 | 0 | 1600 | |
69285555 | xukaiwen | C | Jan. 22, 2020, 8:01 a.m. | OK | GNU C++11 | TESTS | 50 | 31 | 0 | 1600 | |
69227301 | luogu_bot4 | C | Jan. 21, 2020, 7:52 a.m. | OK | GNU C++11 | TESTS | 50 | 31 | 0 | 1600 | |
69187357 | luogu_bot2 | C | Jan. 20, 2020, 12:24 p.m. | OK | GNU C++11 | TESTS | 50 | 31 | 0 | 1600 | |
69076095 | luogu_bot4 | C | Jan. 19, 2020, 3:15 a.m. | OK | GNU C++11 | TESTS | 50 | 31 | 0 | 1600 | |
69907426 | Pranshu54 | C | Jan. 31, 2020, 2:30 p.m. | OK | GNU C++11 | TESTS | 50 | 31 | 0 | 1600 | |
69867554 | Eltoney | C | Jan. 30, 2020, 9:15 p.m. | OK | GNU C++11 | TESTS | 50 | 31 | 0 | 1600 | |
69618844 | zhaoxiaoyun | C | Jan. 27, 2020, 1:59 p.m. | OK | GNU C++11 | TESTS | 50 | 31 | 0 | 1600 | |
69884916 | luogu_bot3 | C | Jan. 31, 2020, 7:51 a.m. | OK | GNU C++11 | TESTS | 50 | 31 | 0 | 1600 | |
63494483 | yana1234 | C | Oct. 26, 2019, 3:10 p.m. | OK | GNU C++14 | TESTS | 50 | 15 | 0 | 1600 | |
63612795 | qwerty12343434 | C | Oct. 27, 2019, 6:03 p.m. | OK | GNU C++14 | TESTS | 50 | 15 | 204800 | 1600 | |
66481856 | xxxplaystation | C | Dec. 8, 2019, 3:29 a.m. | OK | GNU C++14 | TESTS | 50 | 30 | 0 | 1600 | |
69293655 | theviralv | C | Jan. 22, 2020, 11:21 a.m. | OK | GNU C++14 | TESTS | 50 | 30 | 0 | 1600 | |
69068815 | SachRestated | C | Jan. 18, 2020, 8:07 p.m. | OK | GNU C++14 | TESTS | 50 | 30 | 0 | 1600 | |
66791544 | tourist_ka_chacha | C | Dec. 13, 2019, 3:27 p.m. | OK | GNU C++14 | TESTS | 50 | 30 | 0 | 1600 | |
66680195 | squishy1337 | C | Dec. 12, 2019, 12:49 p.m. | OK | GNU C++14 | TESTS | 50 | 30 | 0 | 1600 | |
64756705 | Hydra_HQ | C | Nov. 12, 2019, 5:15 p.m. | OK | GNU C++14 | TESTS | 50 | 30 | 0 | 1600 | |
63987268 | tiberiuiancu | C | Nov. 1, 2019, 12:08 p.m. | OK | GNU C++14 | TESTS | 50 | 30 | 0 | 1600 | |
63771236 | qwe | C | Oct. 30, 2019, 8:04 a.m. | OK | GNU C++14 | TESTS | 50 | 30 | 0 | 1600 | |
64171124 | Sammarize | C | Nov. 3, 2019, 6:26 p.m. | OK | GNU C++17 | TESTS | 50 | 15 | 0 | 1600 | |
63693757 | PedroDMonteiro | C | Oct. 29, 2019, 4:22 a.m. | OK | GNU C++17 | TESTS | 50 | 15 | 0 | 1600 | |
65927918 | ioyeoa | C | Nov. 28, 2019, 7:16 p.m. | OK | GNU C++17 | TESTS | 50 | 15 | 0 | 1600 | |
63505895 | MemeCat | C | Oct. 26, 2019, 6:41 p.m. | OK | GNU C++17 | TESTS | 50 | 15 | 0 | 1600 | |
63499311 | enabl3d | C | Oct. 26, 2019, 4:38 p.m. | OK | GNU C++17 | TESTS | 50 | 15 | 0 | 1600 | |
63494910 | -lwl- | C | Oct. 26, 2019, 3:17 p.m. | OK | GNU C++17 | TESTS | 50 | 15 | 0 | 1600 | |
64592090 | Bombers | C | Nov. 9, 2019, 3:08 p.m. | OK | GNU C++17 | TESTS | 50 | 15 | 0 | 1600 | |
68999852 | kk11 | C | Jan. 17, 2020, 7:03 p.m. | OK | GNU C++17 | TESTS | 50 | 30 | 0 | 1600 | |
68455451 | trl777 | C | Jan. 9, 2020, 4:02 p.m. | OK | GNU C++17 | TESTS | 50 | 30 | 0 | 1600 | |
68156952 | ayushheritage18 | C | Jan. 4, 2020, 9:18 a.m. | OK | GNU C++17 | TESTS | 50 | 30 | 0 | 1600 | |
63521359 | z20124528 | C | Oct. 27, 2019, 3:50 a.m. | OK | Go | TESTS | 50 | 31 | 0 | 1600 | |
63656626 | jegfault | C | Oct. 28, 2019, 12:53 p.m. | OK | Haskell | TESTS | 50 | 31 | 102400 | 1600 | |
63655191 | jegfault | C | Oct. 28, 2019, 12:30 p.m. | OK | Haskell | TESTS | 50 | 46 | 102400 | 1600 | |
63612496 | daniilzimin4 | C | Oct. 27, 2019, 5:55 p.m. | OK | Java 8 | TESTS | 50 | 109 | 0 | 1600 | |
69058185 | lazypanda | C | Jan. 18, 2020, 3:21 p.m. | OK | Java 8 | TESTS | 50 | 109 | 0 | 1600 | |
68626396 | GiantTornado | C | Jan. 11, 2020, 10:16 p.m. | OK | Java 8 | TESTS | 50 | 109 | 0 | 1600 | |
65894262 | tmwilliamlin168 | C | Nov. 28, 2019, 5:14 a.m. | OK | Java 8 | TESTS | 50 | 109 | 0 | 1600 | |
64433627 | 4mda4mda | C | Nov. 6, 2019, 11:21 p.m. | OK | Java 8 | TESTS | 50 | 109 | 0 | 1600 | |
64433467 | 4mda4mda | C | Nov. 6, 2019, 11:13 p.m. | OK | Java 8 | TESTS | 50 | 109 | 0 | 1600 | |
63646933 | utkarshrai491 | C | Oct. 28, 2019, 10:03 a.m. | OK | Java 8 | TESTS | 50 | 109 | 0 | 1600 | |
63509621 | prem_cse | C | Oct. 26, 2019, 8 p.m. | OK | Java 8 | TESTS | 50 | 109 | 0 | 1600 | |
63494153 | Vishal_dhanani | C | Oct. 26, 2019, 3:05 p.m. | OK | Java 8 | TESTS | 50 | 109 | 0 | 1600 | |
64505160 | sakuya9t | C | Nov. 8, 2019, 6:31 a.m. | OK | Java 8 | TESTS | 50 | 124 | 0 | 1600 | |
63626704 | seirion | C | Oct. 28, 2019, 4:15 a.m. | OK | Kotlin | TESTS | 50 | 155 | 614400 | 1600 | |
63882224 | vitaly_megabyte | C | Oct. 30, 2019, 9:41 p.m. | OK | Mono C# | TESTS | 50 | 61 | 0 | 1600 | |
63555684 | fastnoise | C | Oct. 27, 2019, 12:47 p.m. | OK | Mono C# | TESTS | 50 | 77 | 3584000 | 1600 | |
63788407 | vjudge2 | C | Oct. 30, 2019, 12:57 p.m. | OK | MS C++ | TESTS | 50 | 31 | 0 | 1600 | |
64055111 | sunnyorrainy | C | Nov. 2, 2019, 12:52 a.m. | OK | MS C++ | TESTS | 50 | 31 | 0 | 1600 | |
64055316 | sunnyorrainy | C | Nov. 2, 2019, 1:02 a.m. | OK | MS C++ | TESTS | 50 | 31 | 0 | 1600 | |
63578586 | ORA_ORA_MUDA_MUDA | C | Oct. 27, 2019, 3:55 p.m. | OK | MS C++ 2017 | TESTS | 50 | 31 | 0 | 1600 | |
69191295 | Parsa84 | C | Jan. 20, 2020, 1:35 p.m. | OK | MS C++ 2017 | TESTS | 50 | 31 | 0 | 1600 | |
65571820 | rokirovochka | C | Nov. 23, 2019, 8:06 a.m. | OK | MS C++ 2017 | TESTS | 50 | 31 | 0 | 1600 | |
64524454 | BorONE | C | Nov. 8, 2019, 1:20 p.m. | OK | MS C++ 2017 | TESTS | 50 | 31 | 0 | 1600 | |
63788247 | Mo_maek | C | Oct. 30, 2019, 12:55 p.m. | OK | MS C++ 2017 | TESTS | 50 | 31 | 0 | 1600 | |
63477329 | FlyBot | C | Oct. 26, 2019, 12:35 p.m. | OK | MS C++ 2017 | TESTS | 50 | 31 | 0 | 1600 | |
63610525 | holder94 | C | Oct. 27, 2019, 5:01 p.m. | OK | MS C++ 2017 | TESTS | 50 | 31 | 307200 | 1600 | |
63534675 | maxim0000 | C | Oct. 27, 2019, 7:43 a.m. | OK | MS C++ 2017 | TESTS | 50 | 31 | 307200 | 1600 | |
63635573 | dbelov | C | Oct. 28, 2019, 8:07 a.m. | OK | MS C++ 2017 | TESTS | 50 | 31 | 307200 | 1600 | |
65953013 | kurs | C | Nov. 29, 2019, 11:40 a.m. | OK | MS C++ 2017 | TESTS | 50 | 31 | 307200 | 1600 | |
64299161 | Sergienko | C | Nov. 5, 2019, 9:28 a.m. | OK | PascalABC.NET | TESTS | 50 | 187 | 0 | 1600 | |
68968529 | YESMAths | C | Jan. 17, 2020, 6:06 a.m. | OK | PyPy 2 | TESTS | 50 | 139 | 0 | 1600 | |
63613847 | wol | C | Oct. 27, 2019, 6:32 p.m. | OK | PyPy 3 | TESTS | 50 | 124 | 102400 | 1600 | |
66672967 | sruthi_1729 | C | Dec. 12, 2019, 10:09 a.m. | OK | PyPy 3 | TESTS | 50 | 139 | 0 | 1600 | |
63512694 | Siberian | C | Oct. 26, 2019, 9:28 p.m. | OK | PyPy 3 | TESTS | 50 | 139 | 102400 | 1600 | |
66785162 | 23sergey03 | C | Dec. 13, 2019, 1:24 p.m. | OK | PyPy 3 | TESTS | 50 | 140 | 0 | 1600 | |
65578510 | Vladithur | C | Nov. 23, 2019, 10:14 a.m. | OK | PyPy 3 | TESTS | 50 | 140 | 0 | 1600 | |
65248932 | teexone | C | Nov. 17, 2019, 11:25 a.m. | OK | PyPy 3 | TESTS | 50 | 140 | 0 | 1600 | |
64352529 | sasuke4981 | C | Nov. 6, 2019, 8:58 a.m. | OK | PyPy 3 | TESTS | 50 | 140 | 0 | 1600 | |
63612144 | wol | C | Oct. 27, 2019, 5:45 p.m. | OK | PyPy 3 | TESTS | 50 | 140 | 0 | 1600 | |
63519881 | lowoncode | C | Oct. 27, 2019, 3:13 a.m. | OK | PyPy 3 | TESTS | 50 | 140 | 0 | 1600 | |
63496225 | Ormlis | C | Oct. 26, 2019, 3:39 p.m. | OK | PyPy 3 | TESTS | 50 | 140 | 0 | 1600 | |
63523207 | vovosch | C | Oct. 27, 2019, 4:27 a.m. | OK | Python 3 | TESTS | 50 | 109 | 0 | 1600 | |
63503323 | Wannagrow | C | Oct. 26, 2019, 5:56 p.m. | OK | Python 3 | TESTS | 50 | 109 | 0 | 1600 | |
63502824 | gerasikov.fml31 | C | Oct. 26, 2019, 5:46 p.m. | OK | Python 3 | TESTS | 50 | 109 | 0 | 1600 | |
63500318 | fire_alchemist | C | Oct. 26, 2019, 4:58 p.m. | OK | Python 3 | TESTS | 50 | 109 | 0 | 1600 | |
65244511 | Embim | C | Nov. 17, 2019, 9:52 a.m. | OK | Python 3 | TESTS | 50 | 124 | 0 | 1600 | |
65242436 | meme_lord | C | Nov. 17, 2019, 9:11 a.m. | OK | Python 3 | TESTS | 50 | 124 | 0 | 1600 | |
64871076 | pac-man21 | C | Nov. 14, 2019, 8:11 a.m. | OK | Python 3 | TESTS | 50 | 124 | 0 | 1600 | |
63938791 | SinKing | C | Oct. 31, 2019, 4:47 p.m. | OK | Python 3 | TESTS | 50 | 124 | 0 | 1600 | |
63691825 | ghjk0498 | C | Oct. 29, 2019, 3:07 a.m. | OK | Python 3 | TESTS | 50 | 124 | 0 | 1600 | |
63676308 | LintuStorm | C | Oct. 28, 2019, 6:28 p.m. | OK | Python 3 | TESTS | 50 | 124 | 0 | 1600 |
Back to search problems