Codeforces Round 642 (Div. 3)

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
1353 Codeforces Round 642 (Div. 3) FINISHED False 7200 142356299 May 14, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 41172 ) A Most Unstable Array PROGRAMMING constructive algorithms greedy math 800

B"You are given two integers n and m . You have to construct the array a of length n consisting of non-negative integers (i.e. integers greater than or equal to zero) such that the sum of elements of this array is exactly m and the value sum limits_{i=1}^{n-1} |a_i - a_{i+1}| is the maximum possible. Recall that |x| is the absolute value of x . In other words, you have to maximize the sum of absolute differences between adjacent (consecutive) elements. For example, if the array a=[1, 3, 2, 5, 5, 0] then the value above for this array is |1-3| + |3-2| + |2-5| + |5-5| + |5-0| = 2 + 1 + 3 + 0 + 5 = 11 . Note that this example doesn't show the optimal answer but it shows how the required value for some array is calculated. You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then t test cases follow. The only line of the test case contains two integers n and m ( 1 <= n, m <= 10^9 ) -- the length of the array and its sum correspondingly. For each test case, print the answer -- the maximum possible value of sum limits_{i=1}^{n-1} |a_i - a_{i+1}| for the array a consisting of n non-negative integers with the sum m . In the first test case of the example, the only possible array is [100] and the answer is obviously 0 . In the second test case of the example, one of the possible arrays is [2, 0] and the answer is |2-0| = 2 . In the third test case of the example, one of the possible arrays is [0, 2, 0, 3, 0] and the answer is |0-2| + |2-0| + |0-3| + |3-0| = 10 . "...

Tutorials

Codeforces Round #642 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
81167648 vjudge4 A May 24, 2020, 10:45 a.m. OK Clang++17 Diagnostics TESTS 28 46 0 800
80699043 iamarijit A May 19, 2020, 2:42 p.m. OK Clang++17 Diagnostics TESTS 28 46 0 800
80206497 Harry_potter3107 A May 15, 2020, 8:47 a.m. OK GNU C11 TESTS 28 31 3686400 800
80156400 Joyanta_SUST_09 A May 14, 2020, 4:46 p.m. OK GNU C11 TESTS 28 31 3686400 800
80171381 EngineerLX A May 14, 2020, 7:51 p.m. OK GNU C11 TESTS 28 31 3686400 800
80289536 Itsmdshahin A May 16, 2020, 7:25 a.m. OK GNU C11 TESTS 28 31 3686400 800
80155609 bswethareddy A May 14, 2020, 4:41 p.m. OK GNU C11 TESTS 28 31 3686400 800
80280732 Shivansh13 A May 16, 2020, 5:26 a.m. OK GNU C11 TESTS 28 31 3686400 800
80232012 aadarsh_aadi A May 15, 2020, 1:56 p.m. OK GNU C11 TESTS 28 31 7680000 800
81632053 fahimalhasan2019 A May 27, 2020, 3:08 p.m. OK GNU C11 TESTS 28 46 0 800
81146454 Banty A May 24, 2020, 8:10 a.m. OK GNU C11 TESTS 28 46 0 800
81350207 thenewcoder25 A May 25, 2020, 5:39 a.m. OK GNU C11 TESTS 28 46 0 800
81024031 YangChen666 A May 23, 2020, 2:53 p.m. OK GNU C++11 TESTS 28 15 204800 800
80682137 yuzhechuan A May 19, 2020, 11:30 a.m. OK GNU C++11 TESTS 28 15 307200 800
80234706 Madeeyuth A May 15, 2020, 2:26 p.m. OK GNU C++11 TESTS 28 15 3686400 800
80251848 abi200415 A May 15, 2020, 5:58 p.m. OK GNU C++11 TESTS 28 15 3686400 800
80154808 heena1725 A May 14, 2020, 4:37 p.m. OK GNU C++11 TESTS 28 15 3686400 800
80185495 __Archer A May 15, 2020, 2:43 a.m. OK GNU C++11 TESTS 28 15 3891200 800
80514977 gzl A May 17, 2020, 11:38 a.m. OK GNU C++11 TESTS 28 15 3891200 800
80934589 MR072 A May 22, 2020, 12:42 p.m. OK GNU C++11 TESTS 28 30 0 800
81616857 shubham_bitsg A May 27, 2020, 12:20 p.m. OK GNU C++11 TESTS 28 30 0 800
81515389 linzi A May 26, 2020, 3:23 p.m. OK GNU C++11 TESTS 28 30 0 800
81094534 Sweety_._16 A May 24, 2020, 5:41 a.m. OK GNU C++14 TESTS 28 30 204800 800
80744994 nero_27 A May 20, 2020, 6:08 a.m. OK GNU C++14 TESTS 28 30 204800 800
80209158 shammianand A May 15, 2020, 9:21 a.m. OK GNU C++14 TESTS 28 30 3686400 800
80206647 _Mr_WicK A May 15, 2020, 8:49 a.m. OK GNU C++14 TESTS 28 30 3686400 800
80235752 Simon81 A May 15, 2020, 2:37 p.m. OK GNU C++14 TESTS 28 30 3686400 800
80237739 akt_114 A May 15, 2020, 3:02 p.m. OK GNU C++14 TESTS 28 30 3686400 800
80450047 ss_loves_ap A May 17, 2020, 8:34 a.m. OK GNU C++14 TESTS 28 30 3686400 800
81464394 atharva_adhav_ A May 26, 2020, 11:26 a.m. OK GNU C++14 TESTS 28 31 0 800
81521414 0toINF A May 26, 2020, 3:36 p.m. OK GNU C++14 TESTS 28 31 0 800
81464425 atharva_adhav_ A May 26, 2020, 11:27 a.m. OK GNU C++14 TESTS 28 31 0 800
80185848 _protector_ A May 15, 2020, 2:50 a.m. OK GNU C++17 TESTS 28 30 3686400 800
80197348 ready A May 15, 2020, 6:38 a.m. OK GNU C++17 TESTS 28 30 3686400 800
80155512 rahulaclesharma33 A May 14, 2020, 4:41 p.m. OK GNU C++17 TESTS 28 30 3686400 800
80252227 spaesk A May 15, 2020, 6:03 p.m. OK GNU C++17 TESTS 28 30 3686400 800
80259008 zeref_98 A May 15, 2020, 7:39 p.m. OK GNU C++17 TESTS 28 30 3686400 800
80265245 nd38287 A May 15, 2020, 9:56 p.m. OK GNU C++17 TESTS 28 30 3686400 800
80293664 hnie_king_wxl A May 16, 2020, 8:15 a.m. OK GNU C++17 TESTS 28 30 3686400 800
80202090 KodiaQ A May 15, 2020, 7:46 a.m. OK GNU C++17 TESTS 28 30 3686400 800
80157192 manojeet24 A May 14, 2020, 4:51 p.m. OK GNU C++17 TESTS 28 30 31641600 800
81687163 Xanthic A May 28, 2020, 8:46 a.m. OK GNU C++17 TESTS 28 31 0 800
80785023 Quicksnipe A May 20, 2020, 3:19 p.m. OK GNU C++17 (64) TESTS 28 15 0 800
80163571 pk10 A May 14, 2020, 5:57 p.m. OK GNU C++17 (64) TESTS 28 15 4300800 800
80567303 smax A May 18, 2020, 4:05 a.m. OK GNU C++17 (64) TESTS 28 15 4300800 800
80154581 6553368 A May 14, 2020, 4:36 p.m. OK GNU C++17 (64) TESTS 28 15 15769600 800
80911368 Egor A May 22, 2020, 7:30 a.m. OK GNU C++17 (64) TESTS 28 30 0 800
81020601 besieger A May 23, 2020, 2:09 p.m. OK GNU C++17 (64) TESTS 28 30 0 800
81682571 Edwivv A May 28, 2020, 7:50 a.m. OK GNU C++17 (64) TESTS 28 30 0 800
80304983 vjudge1 A May 16, 2020, 10:35 a.m. OK GNU C++17 (64) TESTS 28 30 4198400 800
80287923 za_01 A May 16, 2020, 7:05 a.m. OK GNU C++17 (64) TESTS 28 30 4300800 800
80197443 sonianand966 A May 15, 2020, 6:39 a.m. OK GNU C++17 (64) TESTS 28 30 4300800 800
81030724 LuosKrad A May 23, 2020, 4:19 p.m. OK Go TESTS 28 46 0 800
80207467 synapse A May 15, 2020, 9 a.m. OK Go TESTS 28 46 10854400 800
81432344 lamvh2812 A May 26, 2020, 3:20 a.m. OK Go TESTS 28 482 102400 800
80421716 DorMOUSE-None A May 17, 2020, 12:12 a.m. OK Go TESTS 28 482 10649600 800
80547113 serhatgiydiren A May 17, 2020, 6:35 p.m. OK Go TESTS 28 530 10649600 800
80262905 Laurens A May 15, 2020, 8:54 p.m. OK Haskell TESTS 28 46 13824000 800
80185029 MiltonEiji A May 15, 2020, 2:32 a.m. OK Haskell TESTS 28 61 13824000 800
80563501 ramesh.baskaran A May 18, 2020, 2:33 a.m. OK Haskell TESTS 28 93 13824000 800
81147654 p_unit A May 24, 2020, 8:20 a.m. OK Java 11 TESTS 28 171 0 800
80203993 anhpp A May 15, 2020, 8:13 a.m. OK Java 11 TESTS 28 171 23859200 800
80157694 mikit A May 14, 2020, 4:55 p.m. OK Java 11 TESTS 28 171 23859200 800
80238492 TheSawan A May 15, 2020, 3:11 p.m. OK Java 11 TESTS 28 171 23961600 800
80555732 Kimo_Fathy A May 17, 2020, 9:37 p.m. OK Java 11 TESTS 28 171 23961600 800
80172133 bckslsh03 A May 14, 2020, 8:04 p.m. OK Java 11 TESTS 28 171 23961600 800
80166515 Mann_27__ A May 14, 2020, 6:36 p.m. OK Java 11 TESTS 28 171 23961600 800
80251576 sudhanshu_lucky A May 15, 2020, 5:55 p.m. OK Java 11 TESTS 28 186 23859200 800
80539161 devesh08 A May 17, 2020, 4:38 p.m. OK Java 11 TESTS 28 186 24064000 800
80182592 mphillotry A May 15, 2020, 1:13 a.m. OK Java 11 TESTS 28 186 24064000 800
80749075 maomao_ A May 20, 2020, 7:11 a.m. OK Java 8 TESTS 28 93 0 800
81145856 arpan_ A May 24, 2020, 8:04 a.m. OK Java 8 TESTS 28 108 0 800
80157727 Samez A May 14, 2020, 4:56 p.m. OK Java 8 TESTS 28 108 20582400 800
80169764 learner_321 A May 14, 2020, 7:24 p.m. OK Java 8 TESTS 28 108 21196800 800
81610409 labdhi A May 27, 2020, 11:10 a.m. OK Java 8 TESTS 28 109 0 800
81418310 Oopsimbad A May 25, 2020, 7:49 p.m. OK Java 8 TESTS 28 109 0 800
81414930 treacherous_tiwari A May 25, 2020, 7 p.m. OK Java 8 TESTS 28 109 0 800
81381721 vishu03 A May 25, 2020, 12:21 p.m. OK Java 8 TESTS 28 109 0 800
81142224 sanbayev01 A May 24, 2020, 7:34 a.m. OK Java 8 TESTS 28 109 0 800
81053098 AFouad204 A May 24, 2020, 12:08 a.m. OK Java 8 TESTS 28 109 0 800
80201757 Spheniscine A May 15, 2020, 7:41 a.m. OK Kotlin TESTS 28 139 21504000 800
80295556 mt_kuma A May 16, 2020, 8:39 a.m. OK Kotlin TESTS 28 155 21708800 800
81339881 a11eca A May 25, 2020, 1:42 a.m. OK Kotlin TESTS 28 171 0 800
81034928 gevmart A May 23, 2020, 5:15 p.m. OK Kotlin TESTS 28 187 0 800
80523649 IsTinG A May 17, 2020, 1:27 p.m. OK Kotlin TESTS 28 202 21811200 800
81698053 whiter4bbit A May 28, 2020, 11:05 a.m. OK Kotlin TESTS 28 217 0 800
81145344 ia7ck A May 24, 2020, 8 a.m. OK Kotlin TESTS 28 217 0 800
81142297 scnucjh A May 24, 2020, 7:34 a.m. OK Kotlin TESTS 28 217 0 800
80230623 Markuuus A May 15, 2020, 1:39 p.m. OK Kotlin TESTS 28 217 21811200 800
80646069 Tconan A May 19, 2020, 12:38 a.m. OK Kotlin TESTS 28 218 0 800
81646273 fancy_lettuce A May 27, 2020, 6:04 p.m. OK Mono C# TESTS 28 77 2252800 800
80768631 BowieD A May 20, 2020, 11:45 a.m. OK Mono C# TESTS 28 77 2355200 800
80165580 1Tim30n3 A May 14, 2020, 6:22 p.m. OK Mono C# TESTS 28 77 10649600 800
80427977 sakapon A May 17, 2020, 3:22 a.m. OK Mono C# TESTS 28 77 15257600 800
80427900 sakapon A May 17, 2020, 3:21 a.m. OK Mono C# TESTS 28 77 15257600 800
80428043 sakapon A May 17, 2020, 3:24 a.m. OK Mono C# TESTS 28 77 15257600 800
80291738 sakapon A May 16, 2020, 7:52 a.m. OK Mono C# TESTS 28 77 15360000 800
80851002 Khazmadu A May 21, 2020, 12:23 p.m. OK Mono C# TESTS 28 108 2457600 800
80204976 3pac A May 15, 2020, 8:26 a.m. OK Mono C# TESTS 28 108 10649600 800
80209008 TRR A May 15, 2020, 9:19 a.m. OK Mono C# TESTS 28 108 10752000 800
80815199 Hokage. A May 21, 2020, 2:20 a.m. OK MS C++ TESTS 28 31 0 800
80440356 gao_wu_di A May 17, 2020, 6:40 a.m. OK MS C++ TESTS 28 31 3891200 800
80154548 CLamb A May 14, 2020, 4:36 p.m. OK MS C++ TESTS 28 31 3891200 800
80286083 vjudge2 A May 16, 2020, 6:44 a.m. OK MS C++ TESTS 28 31 3891200 800
80292144 BaseFrame A May 16, 2020, 7:57 a.m. OK MS C++ TESTS 28 31 3891200 800
80751313 atharv_de_co-der A May 20, 2020, 7:47 a.m. OK MS C++ TESTS 28 46 0 800
80751231 atharv_de_co-der A May 20, 2020, 7:46 a.m. OK MS C++ TESTS 28 46 0 800
80193727 mostafa_gamal_564 A May 15, 2020, 5:44 a.m. OK MS C++ TESTS 28 61 3891200 800
80232880 Rajatagg21 A May 15, 2020, 2:06 p.m. OK MS C++ TESTS 28 62 3891200 800
80153291 StepanClub A May 14, 2020, 4:33 p.m. OK MS C++ TESTS 28 77 3891200 800
80933807 vjudge4 A May 22, 2020, 12:32 p.m. OK MS C++ 2017 TESTS 28 31 307200 800
80225214 vjudge4 A May 15, 2020, 12:34 p.m. OK MS C++ 2017 TESTS 28 31 3686400 800
80450617 Kirill456Z A May 17, 2020, 8:40 a.m. OK MS C++ 2017 TESTS 28 31 3686400 800
80289915 vjudge5 A May 16, 2020, 7:29 a.m. OK MS C++ 2017 TESTS 28 31 3686400 800
80219960 vjudge1 A May 15, 2020, 11:33 a.m. OK MS C++ 2017 TESTS 28 31 3686400 800
80209849 Hugh_W A May 15, 2020, 9:30 a.m. OK MS C++ 2017 TESTS 28 31 3686400 800
80200007 ASIXER A May 15, 2020, 7:15 a.m. OK MS C++ 2017 TESTS 28 31 3686400 800
80169351 ilya_totl A May 14, 2020, 7:17 p.m. OK MS C++ 2017 TESTS 28 31 3686400 800
80378075 deuslovelt A May 16, 2020, 2:19 p.m. OK MS C++ 2017 TESTS 28 31 4505600 800
81165405 vjudge1 A May 24, 2020, 10:14 a.m. OK MS C++ 2017 TESTS 28 46 0 800
81200196 mamme_hunter A May 24, 2020, 1:01 p.m. OK Node.js TESTS 28 202 5836800 800
80162742 JayOneZ1 A May 14, 2020, 5:47 p.m. OK Node.js TESTS 28 249 16691200 800
80420248 WbxOne A May 16, 2020, 11:12 p.m. OK Node.js TESTS 28 280 17100800 800
80166496 arpit2438735 A May 14, 2020, 6:35 p.m. OK Node.js TESTS 28 280 21811200 800
80297113 pqhuy98 A May 16, 2020, 8:58 a.m. OK Node.js TESTS 28 280 21913600 800
80420166 WbxOne A May 16, 2020, 11:09 p.m. OK Node.js TESTS 28 326 16998400 800
80232196 Arturgo A May 15, 2020, 1:58 p.m. OK Ocaml TESTS 28 31 3993600 800
80165425 Khaled_Mohamed A May 14, 2020, 6:20 p.m. OK PHP TESTS 28 61 6041600 800
80396422 pysheen A May 16, 2020, 4:48 p.m. OK PyPy 2 TESTS 28 139 24064000 800
80163415 realnimish A May 14, 2020, 5:55 p.m. OK PyPy 2 TESTS 28 139 25702400 800
80895304 yumtam A May 22, 2020, 2:04 a.m. OK PyPy 2 TESTS 28 140 1228800 800
80209928 ____ankit_sm____ A May 15, 2020, 9:31 a.m. OK PyPy 2 TESTS 28 155 24064000 800
80164448 Devraj10 A May 14, 2020, 6:08 p.m. OK PyPy 2 TESTS 28 155 26112000 800
80449190 100jek A May 17, 2020, 8:24 a.m. OK PyPy 2 TESTS 28 171 25600000 800
80448396 100jek A May 17, 2020, 8:16 a.m. OK PyPy 2 TESTS 28 171 25600000 800
80162183 flyman3046 A May 14, 2020, 5:40 p.m. OK PyPy 2 TESTS 28 295 24883200 800
81402375 Baroudy A May 25, 2020, 4:29 p.m. OK PyPy 3 TESTS 28 155 3379200 800
80637616 Barrio A May 18, 2020, 8:10 p.m. OK PyPy 3 TESTS 28 155 4096000 800
80198798 TimurABS A May 15, 2020, 6:58 a.m. OK PyPy 3 TESTS 28 155 23449600 800
80175111 UTMoonlight A May 14, 2020, 9:07 p.m. OK PyPy 3 TESTS 28 155 23552000 800
80156969 FlowerOfSorrow A May 14, 2020, 4:50 p.m. OK PyPy 3 TESTS 28 156 24371200 800
80171462 shiv_99 A May 14, 2020, 7:52 p.m. OK PyPy 3 TESTS 28 170 23449600 800
80209785 ____ankit_sm____ A May 15, 2020, 9:30 a.m. OK PyPy 3 TESTS 28 171 22732800 800
80295741 vk48962713 A May 16, 2020, 8:41 a.m. OK PyPy 3 TESTS 28 171 23449600 800
80264250 Blue_Gene A May 15, 2020, 9:29 p.m. OK PyPy 3 TESTS 28 171 24268800 800
81232380 ashrith7891 A May 24, 2020, 1:59 p.m. OK PyPy 3 TESTS 28 186 3891200 800
80152011 coderbd A May 14, 2020, 4:30 p.m. OK Python 2 TESTS 28 171 6451200 800
80195782 ComptineDunAutreEte A May 15, 2020, 6:15 a.m. OK Python 2 TESTS 28 171 6553600 800
80158733 ap1008 A May 14, 2020, 5:04 p.m. OK Python 2 TESTS 28 171 6553600 800
80270862 Mike10 A May 16, 2020, 1:30 a.m. OK Python 2 TESTS 28 187 6553600 800
80171962 elistark A May 14, 2020, 8:01 p.m. OK Python 2 TESTS 28 202 6451200 800
80923790 zuun7 A May 22, 2020, 10:19 a.m. OK Python 3 TESTS 28 109 0 800
80437470 Exploud A May 17, 2020, 6:07 a.m. OK Python 3 TESTS 28 109 6656000 800
80291958 thewarhero_78 A May 16, 2020, 7:55 a.m. OK Python 3 TESTS 28 109 6963200 800
80188714 surakshith A May 15, 2020, 3:54 a.m. OK Python 3 TESTS 28 109 6963200 800
80160799 eugalt A May 14, 2020, 5:24 p.m. OK Python 3 TESTS 28 109 7270400 800
81056390 shkim A May 24, 2020, 2:42 a.m. OK Python 3 TESTS 28 124 307200 800
80906643 elrion018 A May 22, 2020, 6:18 a.m. OK Python 3 TESTS 28 124 307200 800
81009083 Espad0 A May 23, 2020, 11:18 a.m. OK Python 3 TESTS 28 124 921600 800
80612221 adamkei2612 A May 18, 2020, 2:37 p.m. OK Python 3 TESTS 28 124 6963200 800
80248918 Anunay1605 A May 15, 2020, 5:20 p.m. OK Python 3 TESTS 28 124 6963200 800
81674000 BIG_OUNCE69420 A May 28, 2020, 6 a.m. OK Ruby TESTS 28 77 0 800
80212350 eugene.l A May 15, 2020, 10:02 a.m. OK Ruby TESTS 28 77 6451200 800
80182034 sansen A May 15, 2020, 12:55 a.m. OK Rust TESTS 28 31 4300800 800
80237718 TomazGomes A May 15, 2020, 3:02 p.m. OK Rust TESTS 28 77 3788800 800
81588452 springroll A May 27, 2020, 6:34 a.m. OK Rust TESTS 28 92 0 800
81384954 kihen A May 25, 2020, 12:59 p.m. OK Rust TESTS 28 108 0 800
80535406 garciparedes A May 17, 2020, 3:49 p.m. OK Rust TESTS 28 108 3788800 800
80246365 one_feeble_coder A May 15, 2020, 4:48 p.m. OK Rust TESTS 28 109 3788800 800
81045736 pandrei A May 23, 2020, 8:04 p.m. OK Rust TESTS 28 171 0 800

remove filters

Back to search problems