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 |
---|---|---|---|---|---|---|
( 15185 ) | C | Absolute Zero | PROGRAMMING | constructive algorithms greedy math |
B'You are given an array a of n integers. In one operation, you will perform the following two-step move: For example, by choosing x = 8 , the array [5, 7, 10] will be changed into [|5-8|, |7-8|, |10-8|] = [3,1,2] . Construct a sequence of operations to make all elements of a equal to 0 in at most 40 operations or determine that it is impossible. You do not need to minimize the number of operations. 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 ( 1 <= n <= 2 cdot 10^5 ) -- the length of the array a . The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 0 <= a_i <= 10^9 ) -- the elements of the array a . It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer -1 if it is impossible to make all array elements equal to 0 in at most 40 operations. Otherwise, output two lines. The first line of output should contain a single integer k ( 0 <= k <= 40 ) -- the number of operations. The second line of output should contain k integers x_1, x_2, ldots, x_k ( 0 <= x_i <= 10^{9} ) -- the sequence of operations, denoting that on the i -th operation, you chose x=x_i . If there are multiple solutions, output any of them. You do not need to minimize the number of operations. In the first test case, we can perform only one operation by choosing x = 5 , changing the array from [5] to [0] . In the second test case, no operations are needed because all elements of the array are already 0 . In the third test case, we can choose x = 6 to change the array from [4, 6, 8] to [2, 0, 2] , the'... |
Video Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
273240033 | nemars | C | July 28, 2024, 7:37 p.m. | OK | C# 10 | TESTS | 6 | 280 | 13824000 | ||
273277650 | A1ternate | C | July 29, 2024, 4:59 a.m. | OK | C# 10 | TESTS | 6 | 296 | 18841600 | ||
273274347 | himanshu12102004 | C | July 29, 2024, 4:20 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 93 | 0 | ||
273264844 | KagariII | C | July 29, 2024, 2:28 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 93 | 0 | ||
273250059 | Shah_0024 | C | July 28, 2024, 10:10 p.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 93 | 0 | ||
273260376 | wmz422 | C | July 29, 2024, 1:35 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 93 | 819200 | ||
273273643 | ycZhou | C | July 29, 2024, 4:11 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 93 | 1638400 | ||
273269390 | WyLx | C | July 29, 2024, 3:20 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 93 | 32051200 | ||
273265237 | Datpth | C | July 29, 2024, 2:34 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 108 | 0 | ||
273273982 | ycZhou | C | July 29, 2024, 4:15 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 108 | 1638400 | ||
273280983 | QianJiayu | C | July 29, 2024, 5:36 a.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 109 | 0 | ||
273254957 | wiza_rd | C | July 28, 2024, 11:59 p.m. | OK | C++14 (GCC 6-32) | TESTS | 6 | 109 | 0 | ||
273279649 | iij | C | July 29, 2024, 5:22 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 92 | 0 | ||
273280004 | Ngunguoi45 | C | July 29, 2024, 5:25 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 93 | 0 | ||
273276404 | Lubesh | C | July 29, 2024, 4:44 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 93 | 0 | ||
273275928 | sgm007 | C | July 29, 2024, 4:39 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 93 | 0 | ||
273269620 | noala | C | July 29, 2024, 3:23 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 93 | 0 | ||
273264113 | kkzjyy | C | July 29, 2024, 2:20 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 93 | 0 | ||
273262356 | A7med_Mousa | C | July 29, 2024, 2:01 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 93 | 0 | ||
273245103 | Nakerah | C | July 28, 2024, 8:51 p.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 93 | 0 | ||
273242908 | Quraan | C | July 28, 2024, 8:13 p.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 93 | 0 | ||
273241540 | Kritika094 | C | July 28, 2024, 7:55 p.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 93 | 0 | ||
273264886 | previously | C | July 29, 2024, 2:29 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 62 | 0 | ||
273250746 | Vladithur | C | July 28, 2024, 10:23 p.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 62 | 0 | ||
273281756 | CanShangya | C | July 29, 2024, 5:44 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 77 | 0 | ||
273280707 | Abhishek_Pant_pr | C | July 29, 2024, 5:33 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 77 | 0 | ||
273280601 | YMMW | C | July 29, 2024, 5:32 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 77 | 0 | ||
273277783 | rdcamelot | C | July 29, 2024, 5 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 77 | 0 | ||
273276344 | primefury | C | July 29, 2024, 4:44 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 77 | 0 | ||
273270528 | klb326327 | C | July 29, 2024, 3:34 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 77 | 0 | ||
273270245 | Miracle._. | C | July 29, 2024, 3:31 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 77 | 0 | ||
273268092 | Cold_Green_Dragon | C | July 29, 2024, 3:06 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 77 | 0 | ||
273228490 | shubhk8 | C | July 28, 2024, 5:34 p.m. | OK | GNU C11 | TESTS | 6 | 421 | 1638400 | ||
273221088 | vansh_oberoi07 | C | July 28, 2024, 5:16 p.m. | OK | GNU C11 | TESTS | 6 | 452 | 921600 | ||
273275473 | fanfly | C | July 29, 2024, 4:33 a.m. | OK | GNU C11 | TESTS | 6 | 656 | 921600 | ||
273235660 | iffatul_anon | C | July 28, 2024, 7 p.m. | OK | GNU C11 | TESTS | 6 | 734 | 1638400 | ||
273273160 | NoobCoderWT | C | July 29, 2024, 4:05 a.m. | OK | GNU C11 | TESTS | 6 | 874 | 921600 | ||
273253639 | 1936557 | C | July 28, 2024, 11:27 p.m. | OK | Haskell | TESTS | 6 | 124 | 11571200 | ||
273249208 | bhataktaBhai | C | July 28, 2024, 9:54 p.m. | OK | Haskell | TESTS | 6 | 687 | 55705600 | ||
273269141 | santuan | C | July 29, 2024, 3:18 a.m. | OK | Java 21 | TESTS | 6 | 327 | 512000 | ||
273237273 | codeWithDarshan | C | July 28, 2024, 7:11 p.m. | OK | Java 21 | TESTS | 6 | 327 | 1126400 | ||
273247446 | dzhi | C | July 28, 2024, 9:24 p.m. | OK | Java 21 | TESTS | 6 | 390 | 716800 | ||
273239577 | OsamaNassar | C | July 28, 2024, 7:32 p.m. | OK | Java 21 | TESTS | 6 | 405 | 307200 | ||
273235239 | mohit458 | C | July 28, 2024, 6:58 p.m. | OK | Java 21 | TESTS | 6 | 405 | 512000 | ||
273270887 | amit_roy | C | July 29, 2024, 3:38 a.m. | OK | Java 21 | TESTS | 6 | 421 | 16486400 | ||
273273599 | AkshatSaxena_05 | C | July 29, 2024, 4:10 a.m. | OK | Java 21 | TESTS | 6 | 437 | 819200 | ||
273253083 | sharmashirish8500 | C | July 28, 2024, 11:14 p.m. | OK | Java 21 | TESTS | 6 | 655 | 819200 | ||
273239256 | PlayDate | C | July 28, 2024, 7:29 p.m. | OK | Java 21 | TESTS | 6 | 702 | 716800 | ||
273250867 | Son_Goku_ | C | July 28, 2024, 10:26 p.m. | OK | Java 21 | TESTS | 6 | 718 | 614400 | ||
273259182 | dark_knight_5656 | C | July 29, 2024, 1:20 a.m. | OK | Java 8 | TESTS | 6 | 218 | 3788800 | ||
273241127 | CipherSphinx_Raj | C | July 28, 2024, 7:50 p.m. | OK | Java 8 | TESTS | 6 | 296 | 39424000 | ||
273236195 | zhai123 | C | July 28, 2024, 7:03 p.m. | OK | Java 8 | TESTS | 6 | 436 | 3584000 | ||
273255172 | nis1234 | C | July 29, 2024, 12:03 a.m. | OK | Java 8 | TESTS | 6 | 499 | 0 | ||
273244457 | y.d.chandra_kumar | C | July 28, 2024, 8:39 p.m. | OK | Java 8 | TESTS | 6 | 578 | 0 | ||
273241201 | CipherSphinx_Raj | C | July 28, 2024, 7:51 p.m. | OK | Java 8 | TESTS | 6 | 624 | 67174400 | ||
273220403 | shivakumar07 | C | July 28, 2024, 5:14 p.m. | OK | Java 8 | TESTS | 6 | 639 | 0 | ||
273222017 | IronCoderx | C | July 28, 2024, 5:19 p.m. | OK | Java 8 | TESTS | 6 | 640 | 0 | ||
273221415 | valipidineshreddy | C | July 28, 2024, 5:17 p.m. | OK | Java 8 | TESTS | 6 | 655 | 0 | ||
273242499 | Yossefayman | C | July 28, 2024, 8:06 p.m. | OK | Java 8 | TESTS | 6 | 671 | 0 | ||
273264192 | raunakgiri21 | C | July 29, 2024, 2:21 a.m. | OK | Node.js | TESTS | 6 | 358 | 29388800 | ||
273275619 | nealzane | C | July 29, 2024, 4:35 a.m. | OK | PyPy 3 | TESTS | 6 | 406 | 19558400 | ||
273252081 | arady3337 | C | July 28, 2024, 10:51 p.m. | OK | PyPy 3 | TESTS | 6 | 437 | 27545600 | ||
273221598 | vaibhav2740 | C | July 28, 2024, 5:17 p.m. | OK | PyPy 3 | TESTS | 6 | 484 | 27852800 | ||
273252356 | arady3337 | C | July 28, 2024, 10:57 p.m. | OK | PyPy 3 | TESTS | 6 | 530 | 24473600 | ||
273252381 | arady3337 | C | July 28, 2024, 10:57 p.m. | OK | PyPy 3 | TESTS | 6 | 531 | 24576000 | ||
273223315 | pulkit_garg14 | C | July 28, 2024, 5:22 p.m. | OK | PyPy 3 | TESTS | 6 | 624 | 16179200 | ||
273252640 | arady3337 | C | July 28, 2024, 11:03 p.m. | OK | PyPy 3 | TESTS | 6 | 625 | 18124800 | ||
273264602 | WW416 | C | July 29, 2024, 2:26 a.m. | OK | PyPy 3 | TESTS | 6 | 655 | 17100800 | ||
273275178 | poseidontom | C | July 29, 2024, 4:29 a.m. | OK | PyPy 3 | TESTS | 6 | 655 | 17612800 | ||
273256968 | bpdolson | C | July 29, 2024, 12:44 a.m. | OK | PyPy 3 | TESTS | 6 | 733 | 23449600 | ||
273256227 | daveshub | C | July 29, 2024, 12:29 a.m. | OK | PyPy 3-64 | TESTS | 6 | 139 | 20172800 | ||
273256337 | daveshub | C | July 29, 2024, 12:31 a.m. | OK | PyPy 3-64 | TESTS | 6 | 140 | 20070400 | ||
273245566 | egor_uchevatkin | C | July 28, 2024, 8:57 p.m. | OK | PyPy 3-64 | TESTS | 6 | 140 | 26419200 | ||
273255395 | daveshub | C | July 29, 2024, 12:08 a.m. | OK | PyPy 3-64 | TESTS | 6 | 171 | 20172800 | ||
273242078 | Om_Singh_ | C | July 28, 2024, 8:01 p.m. | OK | PyPy 3-64 | TESTS | 6 | 171 | 26521600 | ||
273238837 | RobinFromTheHood | C | July 28, 2024, 7:25 p.m. | OK | PyPy 3-64 | TESTS | 6 | 186 | 26419200 | ||
273256078 | daveshub | C | July 29, 2024, 12:25 a.m. | OK | PyPy 3-64 | TESTS | 6 | 187 | 20172800 | ||
273278196 | debashish_1 | C | July 29, 2024, 5:05 a.m. | OK | PyPy 3-64 | TESTS | 6 | 187 | 27033600 | ||
273247900 | singh.eureka | C | July 28, 2024, 9:31 p.m. | OK | PyPy 3-64 | TESTS | 6 | 202 | 26521600 | ||
273273264 | gardengnome | C | July 29, 2024, 4:06 a.m. | OK | PyPy 3-64 | TESTS | 6 | 202 | 26624000 | ||
273275375 | ryanimal | C | July 29, 2024, 4:32 a.m. | OK | Python 3 | TESTS | 6 | 218 | 27750400 | ||
273273093 | 20203246 | C | July 29, 2024, 4:04 a.m. | OK | Python 3 | TESTS | 6 | 218 | 27750400 | ||
273281347 | deadshot_24 | C | July 29, 2024, 5:40 a.m. | OK | Python 3 | TESTS | 6 | 280 | 26112000 | ||
273270312 | wyy2004 | C | July 29, 2024, 3:32 a.m. | OK | Python 3 | TESTS | 6 | 327 | 25702400 | ||
273254744 | daveshub | C | July 28, 2024, 11:53 p.m. | OK | Python 3 | TESTS | 6 | 342 | 26112000 | ||
273279505 | 2210030020m | C | July 29, 2024, 5:20 a.m. | OK | Python 3 | TESTS | 6 | 374 | 19558400 | ||
273255247 | daveshub | C | July 29, 2024, 12:05 a.m. | OK | Python 3 | TESTS | 6 | 374 | 19558400 | ||
273264018 | Hajame_Kyoya | C | July 29, 2024, 2:19 a.m. | OK | Python 3 | TESTS | 6 | 390 | 25702400 | ||
273222611 | TheWinter | C | July 28, 2024, 5:20 p.m. | OK | Python 3 | TESTS | 6 | 390 | 27750400 | ||
273280126 | def337485 | C | July 29, 2024, 5:27 a.m. | OK | Python 3 | TESTS | 6 | 1030 | 26112000 |
Back to search problems