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 |
---|---|---|---|---|---|---|
1991 | Pinely Round 4 (Div. 1 + Div. 2) | FINISHED | False | 10800 | 15002663 | July 28, 2024, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 16880 ) | B | AND Reconstruction | PROGRAMMING | bitmasks constructive algorithms greedy |
B'You are given an array b of n - 1 integers. An array a of n integers is called good if b_i = a_i , & , a_{i + 1} for 1 <= i <= n-1 , where & denotes the bitwise AND operator. Construct a good array, or report that no good arrays exist. Each test contains multiple test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 10^5 ) -- the length of the array a . The second line of each test case contains n - 1 integers b_1, b_2, ldots, b_{n - 1} ( 0 <= b_i < 2^{30} ) -- the elements of the array b . It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, output a single integer -1 if no good arrays exist. Otherwise, output n space-separated integers a_1, a_2, ldots, a_n ( 0 <= a_i < 2^{30} ) -- the elements of a good array a . If there are multiple solutions, you may output any of them. In the first test case, b = [1] . A possible good array is a=[5, 3] , because a_1 , & , a_2 = 5 , & , 3 = 1 = b_1 . In the second test case, b = [2, 0] . A possible good array is a=[3, 2, 1] , because a_1 , & , a_2 = 3 , & , 2 = 2 = b_1 and a_2 , & , a_3 = 2 , & , 1 = 0 = b_2 . In the third test case, b = [1, 2, 3] . It can be shown that no good arrays exist, so the output is -1 . In the fourth test case, b = [3, 5, 4, 2] . A possible good array is a=[3, 7, 5, 6, 3] . '... |
Video Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
273239233 | nemars | B | July 28, 2024, 7:29 p.m. | OK | C# 10 | TESTS | 6 | 124 | 9728000 | ||
273275387 | A1ternate | B | July 29, 2024, 4:32 a.m. | OK | C# 10 | TESTS | 6 | 186 | 20172800 | ||
273257818 | qiubobo | B | July 29, 2024, 12:59 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 62 | 0 | ||
273277553 | Marrakesh | B | July 29, 2024, 4:58 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 77 | 0 | ||
273271696 | 03shree | B | July 29, 2024, 3:48 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 77 | 0 | ||
273257944 | qiqill | B | July 29, 2024, 1:01 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 77 | 0 | ||
273234825 | goku_786 | B | July 28, 2024, 6:56 p.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 77 | 0 | ||
273272601 | zxliu66 | B | July 29, 2024, 3:58 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 77 | 819200 | ||
273255943 | chenye3 | B | July 29, 2024, 12:22 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 77 | 819200 | ||
273255661 | yeminghan | B | July 29, 2024, 12:15 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 77 | 819200 | ||
273241950 | ibrahimhanifceker | B | July 28, 2024, 8 p.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 78 | 0 | ||
273261576 | PsephurusGladius | B | July 29, 2024, 1:51 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 78 | 819200 | ||
273251515 | angadsingh9271 | B | July 28, 2024, 10:39 p.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 61 | 0 | ||
273281055 | Never_afraid | B | July 29, 2024, 5:37 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 62 | 0 | ||
273278768 | AtomFirst | B | July 29, 2024, 5:11 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 62 | 0 | ||
273283349 | code_legend1 | B | July 29, 2024, 6 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 77 | 0 | ||
273282312 | TreaBoy | B | July 29, 2024, 5:50 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 77 | 0 | ||
273279536 | _sous | B | July 29, 2024, 5:20 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 77 | 0 | ||
273278863 | Sunshyne | B | July 29, 2024, 5:13 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 77 | 0 | ||
273278551 | astabakasta | B | July 29, 2024, 5:09 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 77 | 0 | ||
273278047 | yup_imRishav | B | July 29, 2024, 5:03 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 77 | 0 | ||
273278001 | Diganta_IITKGP | B | July 29, 2024, 5:03 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 77 | 0 | ||
273282471 | Haneochi | B | July 29, 2024, 5:51 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 46 | 0 | ||
273283252 | Fresca | B | July 29, 2024, 5:59 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 61 | 0 | ||
273280309 | knightstour | B | July 29, 2024, 5:29 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 61 | 0 | ||
273275759 | CanShangya | B | July 29, 2024, 4:37 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 61 | 0 | ||
273275228 | Mahmuda-1-t | B | July 29, 2024, 4:30 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 61 | 0 | ||
273274678 | __andromeDa | B | July 29, 2024, 4:24 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 61 | 0 | ||
273274497 | ehdxbc | B | July 29, 2024, 4:22 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 61 | 0 | ||
273265649 | ov_vo | B | July 29, 2024, 2:38 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 61 | 0 | ||
273260703 | I_love_GSNQK | B | July 29, 2024, 1:39 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 61 | 0 | ||
273256561 | atd | B | July 29, 2024, 12:35 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 61 | 0 | ||
273273476 | fanfly | B | July 29, 2024, 4:09 a.m. | OK | GNU C11 | TESTS | 6 | 483 | 819200 | ||
273248140 | bjeljik | B | July 28, 2024, 9:35 p.m. | OK | GNU C11 | TESTS | 6 | 484 | 921600 | ||
273268391 | NoobCoderWT | B | July 29, 2024, 3:09 a.m. | OK | GNU C11 | TESTS | 6 | 655 | 921600 | ||
273252987 | 1936557 | B | July 28, 2024, 11:11 p.m. | OK | Haskell | TESTS | 6 | 155 | 5222400 | ||
273247576 | bhataktaBhai | B | July 28, 2024, 9:26 p.m. | OK | Haskell | TESTS | 6 | 593 | 46182400 | ||
273262628 | bobib | B | July 29, 2024, 2:04 a.m. | OK | Java 21 | TESTS | 6 | 281 | 819200 | ||
273279240 | vikash_45 | B | July 29, 2024, 5:17 a.m. | OK | Java 21 | TESTS | 6 | 296 | 204800 | ||
273246504 | dzhi | B | July 28, 2024, 9:10 p.m. | OK | Java 21 | TESTS | 6 | 327 | 204800 | ||
273254014 | Mo7amed_3nan | B | July 28, 2024, 11:36 p.m. | OK | Java 21 | TESTS | 6 | 328 | 307200 | ||
273242241 | dineshchandran311 | B | July 28, 2024, 8:03 p.m. | OK | Java 21 | TESTS | 6 | 328 | 409600 | ||
273279384 | vinay_panwar | B | July 29, 2024, 5:19 a.m. | OK | Java 21 | TESTS | 6 | 343 | 1536000 | ||
273278644 | anshpatel2434 | B | July 29, 2024, 5:10 a.m. | OK | Java 21 | TESTS | 6 | 359 | 1024000 | ||
273241123 | sharmashirish8500 | B | July 28, 2024, 7:50 p.m. | OK | Java 21 | TESTS | 6 | 467 | 409600 | ||
273254140 | Amir_Tarek | B | July 28, 2024, 11:39 p.m. | OK | Java 21 | TESTS | 6 | 484 | 1024000 | ||
273223352 | owess | B | July 28, 2024, 5:22 p.m. | OK | Java 21 | TESTS | 6 | 499 | 2252800 | ||
273241032 | CipherSphinx_Raj | B | July 28, 2024, 7:49 p.m. | OK | Java 8 | TESTS | 6 | 202 | 39526400 | ||
273254009 | nis1234 | B | July 28, 2024, 11:36 p.m. | OK | Java 8 | TESTS | 6 | 296 | 0 | ||
273248987 | shashankp10 | B | July 28, 2024, 9:50 p.m. | OK | Java 8 | TESTS | 6 | 296 | 0 | ||
273267974 | om172 | B | July 29, 2024, 3:05 a.m. | OK | Java 8 | TESTS | 6 | 311 | 0 | ||
273241135 | sharmavinayak85000 | B | July 28, 2024, 7:50 p.m. | OK | Java 8 | TESTS | 6 | 452 | 0 | ||
273242007 | Mahf | B | July 28, 2024, 8 p.m. | OK | Java 8 | TESTS | 6 | 467 | 0 | ||
273282176 | JBGZ | B | July 29, 2024, 5:48 a.m. | OK | Java 8 | TESTS | 6 | 468 | 0 | ||
273226152 | Baidiki | B | July 28, 2024, 5:29 p.m. | OK | Java 8 | TESTS | 6 | 483 | 0 | ||
273259941 | MiTuA | B | July 29, 2024, 1:29 a.m. | OK | Java 8 | TESTS | 6 | 500 | 0 | ||
273243824 | devpascal | B | July 28, 2024, 8:28 p.m. | OK | Node.js | TESTS | 6 | 218 | 33280000 | ||
273234872 | shilpabanerjee50 | B | July 28, 2024, 6:56 p.m. | OK | PyPy 2 | TESTS | 6 | 203 | 11673600 | ||
273274026 | nealzane | B | July 29, 2024, 4:16 a.m. | OK | PyPy 3 | TESTS | 6 | 421 | 14745600 | ||
273236860 | oAsis_88 | B | July 28, 2024, 7:08 p.m. | OK | PyPy 3 | TESTS | 6 | 452 | 10956800 | ||
273263379 | WW416 | B | July 29, 2024, 2:12 a.m. | OK | PyPy 3 | TESTS | 6 | 452 | 11468800 | ||
273225119 | kanish217 | B | July 28, 2024, 5:26 p.m. | OK | PyPy 3 | TESTS | 6 | 515 | 10752000 | ||
273256547 | bpdolson | B | July 29, 2024, 12:35 a.m. | OK | PyPy 3 | TESTS | 6 | 546 | 11980800 | ||
273275027 | yatohiyo | B | July 29, 2024, 4:28 a.m. | OK | PyPy 3 | TESTS | 6 | 608 | 10342400 | ||
273252954 | elnazar | B | July 28, 2024, 11:10 p.m. | OK | PyPy 3-64 | TESTS | 6 | 109 | 15155200 | ||
273273220 | gardengnome | B | July 29, 2024, 4:06 a.m. | OK | PyPy 3-64 | TESTS | 6 | 140 | 14540800 | ||
273239738 | RobinFromTheHood | B | July 28, 2024, 7:34 p.m. | OK | PyPy 3-64 | TESTS | 6 | 140 | 15052800 | ||
273271184 | Newbie_ | B | July 29, 2024, 3:42 a.m. | OK | PyPy 3-64 | TESTS | 6 | 140 | 18534400 | ||
273243280 | Monocrap | B | July 28, 2024, 8:19 p.m. | OK | PyPy 3-64 | TESTS | 6 | 156 | 14643200 | ||
273260524 | SYED.ARHAM.SAROOSH | B | July 29, 2024, 1:37 a.m. | OK | PyPy 3-64 | TESTS | 6 | 171 | 14848000 | ||
273248814 | mer_on | B | July 28, 2024, 9:47 p.m. | OK | PyPy 3-64 | TESTS | 6 | 171 | 18227200 | ||
273277908 | bokuto_alright | B | July 29, 2024, 5:02 a.m. | OK | PyPy 3-64 | TESTS | 6 | 186 | 15667200 | ||
273244616 | singh.eureka | B | July 28, 2024, 8:43 p.m. | OK | PyPy 3-64 | TESTS | 6 | 186 | 16076800 | ||
273240645 | thestonedape | B | July 28, 2024, 7:45 p.m. | OK | PyPy 3-64 | TESTS | 6 | 186 | 18124800 | ||
273275359 | ryanimal | B | July 29, 2024, 4:32 a.m. | OK | Python 3 | TESTS | 6 | 140 | 24985600 | ||
273279400 | 2210030020m | B | July 29, 2024, 5:19 a.m. | OK | Python 3 | TESTS | 6 | 171 | 16179200 | ||
273270940 | 20203246 | B | July 29, 2024, 3:39 a.m. | OK | Python 3 | TESTS | 6 | 171 | 18227200 | ||
273225545 | LilyCahill | B | July 28, 2024, 5:27 p.m. | OK | Python 3 | TESTS | 6 | 186 | 18227200 | ||
273221690 | Shanky_16 | B | July 28, 2024, 5:18 p.m. | OK | Python 3 | TESTS | 6 | 186 | 18227200 | ||
273223509 | MdNazmulHossain | B | July 28, 2024, 5:22 p.m. | OK | Python 3 | TESTS | 6 | 186 | 24883200 | ||
273282208 | tah23seen | B | July 29, 2024, 5:49 a.m. | OK | Python 3 | TESTS | 6 | 202 | 12697600 | ||
273252980 | eugalt | B | July 28, 2024, 11:11 p.m. | OK | Python 3 | TESTS | 6 | 202 | 16179200 | ||
273224745 | rod101 | B | July 28, 2024, 5:25 p.m. | OK | Python 3 | TESTS | 6 | 233 | 18227200 | ||
273273603 | Mayank0875 | B | July 29, 2024, 4:10 a.m. | OK | Python 3 | TESTS | 6 | 249 | 12083200 |
Back to search problems