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 |
---|---|---|---|---|---|---|
1591 | Codeforces Round 759 (Div. 2, based on Technocup 2022 Elimination Round 3) | FINISHED | False | 7200 | 92501099 | Dec. 12, 2021, 3:15 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 5097 ) | C | Minimize Distance | PROGRAMMING | greedy math |
B'A total of n depots are located on a number line. Depot i lies at the point x_i for 1 <= i <= n . You are a salesman with n bags of goods, attempting to deliver one bag to each of the n depots. You and the n bags are initially at the origin 0 . You can carry up to k bags at a time. You must collect the required number of goods from the origin, deliver them to the respective depots, and then return to the origin to collect your next batch of goods. Calculate the minimum distance you need to cover to deliver all the bags of goods to the depots. You do not have to return to the origin after you have delivered all the bags. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10 ,500 ). Description of the test cases follows. The first line of each test case contains two integers n and k ( 1 <= k <= n <= 2 cdot 10^5 ). The second line of each test case contains n integers x_1, x_2, ldots, x_n ( -10^9 <= x_i <= 10^9 ). It is possible that some depots share the same position. 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 denoting the minimum distance you need to cover to deliver all the bags of goods to the depots. In the first test case, you can carry only one bag at a time. Thus, the following is a solution sequence that gives a minimum travel distance: 0 to 2 to 0 to 4 to 0 to 3 to 0 to 1 to 0 to 5 , where each 0 means you go the origin and grab one bag, and each positive integer means you deliver the bag to a depot at this coordinate, giving a total distance of 25 units. It must be noted that there are other sequences that give the same distance. In the second test case, you can follow the following sequence, among multiple such sequences, to travel minimum distance: 0 to 6 to 8 to'... |
Codeforces Round #759 (Div. 2, based on Technocup 2022 Elimination Round 3) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
138907504 | rainboy | C | Dec. 12, 2021, 4:26 p.m. | OK | GNU C11 | TESTS | 11 | 78 | 819200 | ||
138909195 | Linx. | C | Dec. 12, 2021, 4:32 p.m. | OK | GNU C11 | TESTS | 11 | 140 | 1638400 | ||
138927065 | lfarrives | C | Dec. 12, 2021, 6:09 p.m. | OK | GNU C++14 | TESTS | 11 | 46 | 1433600 | ||
138924972 | 664607530 | C | Dec. 12, 2021, 5:50 p.m. | OK | GNU C++14 | TESTS | 11 | 62 | 819200 | ||
138921987 | Rishabh_N | C | Dec. 12, 2021, 5:13 p.m. | OK | GNU C++14 | TESTS | 11 | 62 | 819200 | ||
138924671 | Ahmed__Nageh222 | C | Dec. 12, 2021, 5:49 p.m. | OK | GNU C++14 | TESTS | 11 | 62 | 819200 | ||
138951112 | XueYJ | C | Dec. 13, 2021, 5:11 a.m. | OK | GNU C++14 | TESTS | 11 | 62 | 819200 | ||
138943369 | ACOIer | C | Dec. 13, 2021, 1:18 a.m. | OK | GNU C++14 | TESTS | 11 | 62 | 819200 | ||
138905311 | kartikg02 | C | Dec. 12, 2021, 4:23 p.m. | OK | GNU C++14 | TESTS | 11 | 62 | 1433600 | ||
138929839 | mickeysingh.r44 | C | Dec. 12, 2021, 6:44 p.m. | OK | GNU C++14 | TESTS | 11 | 62 | 1433600 | ||
138924273 | Rohan2682001 | C | Dec. 12, 2021, 5:47 p.m. | OK | GNU C++14 | TESTS | 11 | 62 | 1433600 | ||
138907340 | ONE.EYED.OWL | C | Dec. 12, 2021, 4:26 p.m. | OK | GNU C++14 | TESTS | 11 | 62 | 1433600 | ||
138947573 | milan_s1 | C | Dec. 13, 2021, 3:48 a.m. | OK | GNU C++17 | TESTS | 11 | 46 | 819200 | ||
138919691 | shubham_dalmia | C | Dec. 12, 2021, 5:06 p.m. | OK | GNU C++17 | TESTS | 11 | 46 | 1433600 | ||
138913414 | Indialbedo | C | Dec. 12, 2021, 4:46 p.m. | OK | GNU C++17 | TESTS | 11 | 46 | 4915200 | ||
138945573 | rbl_p | C | Dec. 13, 2021, 2:51 a.m. | OK | GNU C++17 | TESTS | 11 | 61 | 819200 | ||
138905408 | riya_ranjan | C | Dec. 12, 2021, 4:24 p.m. | OK | GNU C++17 | TESTS | 11 | 61 | 819200 | ||
138915397 | adikajale_123 | C | Dec. 12, 2021, 4:52 p.m. | OK | GNU C++17 | TESTS | 11 | 61 | 1433600 | ||
138950600 | aryamantodkar | C | Dec. 13, 2021, 5:01 a.m. | OK | GNU C++17 | TESTS | 11 | 61 | 1433600 | ||
138921544 | Mnesy | C | Dec. 12, 2021, 5:12 p.m. | OK | GNU C++17 | TESTS | 11 | 61 | 1433600 | ||
138948283 | agcwha2567 | C | Dec. 13, 2021, 4:07 a.m. | OK | GNU C++17 | TESTS | 11 | 61 | 1638400 | ||
138953044 | encrypted_jpg | C | Dec. 13, 2021, 5:49 a.m. | OK | GNU C++17 | TESTS | 11 | 61 | 2969600 | ||
138946926 | luogu_bot2 | C | Dec. 13, 2021, 3:33 a.m. | OK | GNU C++17 (64) | TESTS | 11 | 31 | 3174400 | ||
138907753 | PurpleCrayon | C | Dec. 12, 2021, 4:27 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 46 | 1433600 | ||
138942477 | Porag_2742 | C | Dec. 13, 2021, 12:36 a.m. | OK | GNU C++17 (64) | TESTS | 11 | 46 | 1433600 | ||
138935904 | enjoying_loser_life | C | Dec. 12, 2021, 8:35 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 46 | 1433600 | ||
138927310 | Bu1bu1 | C | Dec. 12, 2021, 6:12 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 46 | 1433600 | ||
138905533 | AbdoGad | C | Dec. 12, 2021, 4:24 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 46 | 1536000 | ||
138932132 | Aero__ | C | Dec. 12, 2021, 7:20 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 46 | 1638400 | ||
138931941 | int_overflow | C | Dec. 12, 2021, 7:17 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 46 | 1638400 | ||
138931041 | old_school_Reborn | C | Dec. 12, 2021, 7:02 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 46 | 1638400 | ||
138905700 | Uppercase | C | Dec. 12, 2021, 4:24 p.m. | OK | GNU C++17 (64) | TESTS | 11 | 46 | 1638400 | ||
138912528 | wowsuchempty | C | Dec. 12, 2021, 4:43 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 31 | 2662400 | ||
138928365 | mohit_ahirwar | C | Dec. 12, 2021, 6:25 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 31 | 3993600 | ||
138928051 | shetaruchit990 | C | Dec. 12, 2021, 6:21 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 31 | 3993600 | ||
138911979 | chenmoooo | C | Dec. 12, 2021, 4:41 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 46 | 819200 | ||
138926876 | schiftyfive4 | C | Dec. 12, 2021, 6:07 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 46 | 1433600 | ||
138920345 | jughead__73 | C | Dec. 12, 2021, 5:08 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 46 | 1638400 | ||
138948151 | vrintle | C | Dec. 13, 2021, 4:03 a.m. | OK | GNU C++20 (64) | TESTS | 11 | 46 | 1638400 | ||
138927560 | greatarthur.exe | C | Dec. 12, 2021, 6:15 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 46 | 1638400 | ||
138926144 | iadityakumar | C | Dec. 12, 2021, 6 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 46 | 1638400 | ||
138904896 | SPyofgame3 | C | Dec. 12, 2021, 4:22 p.m. | OK | GNU C++20 (64) | TESTS | 11 | 46 | 1638400 | ||
138932402 | Satyaa | C | Dec. 12, 2021, 7:25 p.m. | OK | Java 11 | TESTS | 11 | 186 | 0 | ||
138911423 | sharnit | C | Dec. 12, 2021, 4:39 p.m. | OK | Java 11 | TESTS | 11 | 233 | 0 | ||
138934137 | SOME_ONEE | C | Dec. 12, 2021, 7:56 p.m. | OK | Java 11 | TESTS | 11 | 233 | 0 | ||
138944584 | yaminote | C | Dec. 13, 2021, 2:13 a.m. | OK | Java 11 | TESTS | 11 | 233 | 3686400 | ||
138904482 | nitin23329 | C | Dec. 12, 2021, 4:21 p.m. | OK | Java 11 | TESTS | 11 | 249 | 0 | ||
138920483 | tushar_patil | C | Dec. 12, 2021, 5:09 p.m. | OK | Java 11 | TESTS | 11 | 249 | 3379200 | ||
138929887 | punitg8 | C | Dec. 12, 2021, 6:45 p.m. | OK | Java 11 | TESTS | 11 | 264 | 921600 | ||
138904831 | yogii_123 | C | Dec. 12, 2021, 4:22 p.m. | OK | Java 11 | TESTS | 11 | 265 | 1331200 | ||
138936368 | oskarmartinvr | C | Dec. 12, 2021, 8:46 p.m. | OK | Java 11 | TESTS | 11 | 280 | 0 | ||
138919041 | Sandy_coder2001 | C | Dec. 12, 2021, 5:04 p.m. | OK | Java 11 | TESTS | 11 | 280 | 0 | ||
138908675 | Vinay_Goel_ | C | Dec. 12, 2021, 4:30 p.m. | OK | Java 8 | TESTS | 11 | 155 | 3072000 | ||
138924811 | anshulchou_123 | C | Dec. 12, 2021, 5:49 p.m. | OK | Java 8 | TESTS | 11 | 171 | 23449600 | ||
138948133 | sanjayram21 | C | Dec. 13, 2021, 4:03 a.m. | OK | Java 8 | TESTS | 11 | 186 | 4710400 | ||
138950455 | ruchir28 | C | Dec. 13, 2021, 4:58 a.m. | OK | Java 8 | TESTS | 11 | 186 | 4812800 | ||
138909246 | hu_tao | C | Dec. 12, 2021, 4:32 p.m. | OK | Java 8 | TESTS | 11 | 187 | 3379200 | ||
138917980 | Ghost_Fox_Sledgehammer | C | Dec. 12, 2021, 5:01 p.m. | OK | Java 8 | TESTS | 11 | 202 | 0 | ||
138946758 | Swapniltri | C | Dec. 13, 2021, 3:28 a.m. | OK | Java 8 | TESTS | 11 | 217 | 5427200 | ||
138918330 | conormuldoon | C | Dec. 12, 2021, 5:02 p.m. | OK | Java 8 | TESTS | 11 | 217 | 7475200 | ||
138929788 | NerfThis | C | Dec. 12, 2021, 6:43 p.m. | OK | Java 8 | TESTS | 11 | 218 | 4198400 | ||
138916790 | naitikvarshney | C | Dec. 12, 2021, 4:57 p.m. | OK | Java 8 | TESTS | 11 | 218 | 4915200 | ||
138911995 | _Astron | C | Dec. 12, 2021, 4:41 p.m. | OK | Kotlin 1.4 | TESTS | 11 | 217 | 7270400 | ||
138925965 | PanZverski | C | Dec. 12, 2021, 5:58 p.m. | OK | MS C++ 2017 | TESTS | 11 | 93 | 2355200 | ||
138926083 | PanZverski | C | Dec. 12, 2021, 6 p.m. | OK | MS C++ 2017 | TESTS | 11 | 93 | 2662400 | ||
138951238 | zeratul_34 | C | Dec. 13, 2021, 5:14 a.m. | OK | MS C++ 2017 | TESTS | 11 | 108 | 3174400 | ||
138922236 | ItsNikolor | C | Dec. 12, 2021, 5:13 p.m. | OK | MS C++ 2017 | TESTS | 11 | 202 | 4300800 | ||
138937389 | 13coder | C | Dec. 12, 2021, 9:11 p.m. | OK | MS C++ 2017 | TESTS | 11 | 218 | 1638400 | ||
138912871 | czm233 | C | Dec. 12, 2021, 4:44 p.m. | OK | MS C++ 2017 | TESTS | 11 | 218 | 4300800 | ||
138912410 | Torehalt | C | Dec. 12, 2021, 4:42 p.m. | OK | MS C++ 2017 | TESTS | 11 | 233 | 1638400 | ||
138917564 | vandr | C | Dec. 12, 2021, 5 p.m. | OK | MS C++ 2017 | TESTS | 11 | 233 | 2355200 | ||
138911129 | nguyencter | C | Dec. 12, 2021, 4:38 p.m. | OK | MS C++ 2017 | TESTS | 11 | 234 | 1638400 | ||
138924578 | nikuradze2006 | C | Dec. 12, 2021, 5:48 p.m. | OK | MS C++ 2017 | TESTS | 11 | 234 | 2355200 | ||
138918421 | satya_k | C | Dec. 12, 2021, 5:02 p.m. | OK | .NET Core C# | TESTS | 11 | 124 | 19865600 | ||
138935850 | anton9843 | C | Dec. 12, 2021, 8:34 p.m. | OK | .NET Core C# | TESTS | 11 | 124 | 20377600 | ||
138905470 | jeroeng | C | Dec. 12, 2021, 4:24 p.m. | OK | .NET Core C# | TESTS | 11 | 140 | 19660800 | ||
138946747 | morozov312 | C | Dec. 13, 2021, 3:27 a.m. | OK | Node.js | TESTS | 11 | 296 | 28774400 | ||
138910141 | wincss | C | Dec. 12, 2021, 4:35 p.m. | OK | PyPy 2 | TESTS | 11 | 171 | 16588800 | ||
138924523 | 1_2_3_4_5_9 | C | Dec. 12, 2021, 5:48 p.m. | OK | PyPy 2 | TESTS | 11 | 233 | 16998400 | ||
138905378 | 14_15_16 | C | Dec. 12, 2021, 4:24 p.m. | OK | PyPy 2 | TESTS | 11 | 233 | 16998400 | ||
138913396 | OLOGY | C | Dec. 12, 2021, 4:45 p.m. | OK | PyPy 2 | TESTS | 11 | 327 | 13004800 | ||
138907312 | Believer_Ayush | C | Dec. 12, 2021, 4:26 p.m. | OK | PyPy 3 | TESTS | 11 | 171 | 18739200 | ||
138925097 | abhijeetgupto | C | Dec. 12, 2021, 5:51 p.m. | OK | PyPy 3 | TESTS | 11 | 311 | 18329600 | ||
138927515 | legend.ary_as | C | Dec. 12, 2021, 6:14 p.m. | OK | PyPy 3 | TESTS | 11 | 326 | 18944000 | ||
138911142 | yonsweng | C | Dec. 12, 2021, 4:38 p.m. | OK | PyPy 3 | TESTS | 11 | 327 | 17203200 | ||
138927762 | armsusman | C | Dec. 12, 2021, 6:17 p.m. | OK | PyPy 3 | TESTS | 11 | 342 | 23756800 | ||
138912100 | armusman2 | C | Dec. 12, 2021, 4:41 p.m. | OK | PyPy 3 | TESTS | 11 | 342 | 23756800 | ||
138911670 | nguyenchicuong | C | Dec. 12, 2021, 4:40 p.m. | OK | PyPy 3 | TESTS | 11 | 342 | 27750400 | ||
138910704 | ayush_345 | C | Dec. 12, 2021, 4:37 p.m. | OK | PyPy 3 | TESTS | 11 | 343 | 24064000 | ||
138908696 | Malek_souissi | C | Dec. 12, 2021, 4:30 p.m. | OK | PyPy 3 | TESTS | 11 | 389 | 17612800 | ||
138937004 | kritarth21 | C | Dec. 12, 2021, 9:01 p.m. | OK | PyPy 3 | TESTS | 11 | 389 | 19353600 | ||
138912479 | sakurahashu | C | Dec. 12, 2021, 4:43 p.m. | OK | PyPy 3-64 | TESTS | 11 | 218 | 23449600 | ||
138917353 | reennn | C | Dec. 12, 2021, 4:59 p.m. | OK | PyPy 3-64 | TESTS | 11 | 296 | 24883200 | ||
138912020 | _heqzagone_ | C | Dec. 12, 2021, 4:41 p.m. | OK | PyPy 3-64 | TESTS | 11 | 311 | 16076800 | ||
138945443 | conqueror_of_tourist | C | Dec. 13, 2021, 2:46 a.m. | OK | PyPy 3-64 | TESTS | 11 | 311 | 19865600 | ||
138928145 | guineapig | C | Dec. 12, 2021, 6:22 p.m. | OK | PyPy 3-64 | TESTS | 11 | 327 | 19865600 | ||
138932130 | IkshitG | C | Dec. 12, 2021, 7:20 p.m. | OK | PyPy 3-64 | TESTS | 11 | 327 | 20172800 | ||
138924253 | lemiao12 | C | Dec. 12, 2021, 5:47 p.m. | OK | PyPy 3-64 | TESTS | 11 | 358 | 24166400 | ||
138910394 | p_r_a_n_a_v | C | Dec. 12, 2021, 4:36 p.m. | OK | PyPy 3-64 | TESTS | 11 | 358 | 24576000 | ||
138909288 | Up_there | C | Dec. 12, 2021, 4:32 p.m. | OK | PyPy 3-64 | TESTS | 11 | 405 | 14336000 | ||
138931402 | IkshitG | C | Dec. 12, 2021, 7:08 p.m. | OK | PyPy 3-64 | TESTS | 11 | 405 | 15052800 | ||
138937922 | OLOGY | C | Dec. 12, 2021, 9:25 p.m. | OK | Python 2 | TESTS | 11 | 171 | 11059200 | ||
138927058 | OLOGY | C | Dec. 12, 2021, 6:09 p.m. | OK | Python 2 | TESTS | 11 | 202 | 11059200 | ||
138909219 | pglutz | C | Dec. 12, 2021, 4:32 p.m. | OK | Python 3 | TESTS | 11 | 171 | 14950400 | ||
138917606 | MIRE | C | Dec. 12, 2021, 5 p.m. | OK | Python 3 | TESTS | 11 | 171 | 16486400 | ||
138905054 | NS3081992 | C | Dec. 12, 2021, 4:23 p.m. | OK | Python 3 | TESTS | 11 | 187 | 19148800 | ||
138930284 | sudhirMTS | C | Dec. 12, 2021, 6:50 p.m. | OK | Python 3 | TESTS | 11 | 234 | 16179200 | ||
138924726 | 2019286 | C | Dec. 12, 2021, 5:49 p.m. | OK | Python 3 | TESTS | 11 | 249 | 16486400 | ||
138916658 | gesserit | C | Dec. 12, 2021, 4:57 p.m. | OK | Python 3 | TESTS | 11 | 264 | 15872000 | ||
138915658 | 2019286 | C | Dec. 12, 2021, 4:53 p.m. | OK | Python 3 | TESTS | 11 | 264 | 16179200 | ||
138915847 | waterpower | C | Dec. 12, 2021, 4:54 p.m. | OK | Python 3 | TESTS | 11 | 265 | 16384000 | ||
138948590 | siddhantiiits | C | Dec. 13, 2021, 4:14 a.m. | OK | Python 3 | TESTS | 11 | 265 | 16486400 | ||
138916321 | Ratree | C | Dec. 12, 2021, 4:55 p.m. | OK | Python 3 | TESTS | 11 | 280 | 14540800 | ||
138936002 | Ganxel | C | Dec. 12, 2021, 8:37 p.m. | OK | Rust 2021 | TESTS | 11 | 140 | 7884800 | ||
138907520 | FakestAccount | C | Dec. 12, 2021, 4:27 p.m. | OK | Rust 2021 | TESTS | 11 | 171 | 17510400 |
Back to search problems