Codeforces Round 665 (Div. 2)

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
1401 Codeforces Round 665 (Div. 2) FINISHED False 7200 139245863 Aug. 21, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 21230 ) B Ternary Sequence PROGRAMMING constructive algorithms greedy math

B"You are given two sequences a_1, a_2, ... , a_n and b_1, b_2, ... , b_n . Each element of both sequences is either 0 , 1 or 2 . The number of elements 0 , 1 , 2 in the sequence a is x_1 , y_1 , z_1 respectively, and the number of elements 0 , 1 , 2 in the sequence b is x_2 , y_2 , z_2 respectively. You can rearrange the elements in both sequences a and b however you like. After that, let's define a sequence c as follows: c_i = begin{cases} a_i b_i & mbox{if }a_i > b_i 0 & mbox{if }a_i = b_i -a_i b_i & mbox{if }a_i < b_i end{cases} You'd like to make sum_{i=1}^n c_i (the sum of all elements of the sequence c ) as large as possible. What is the maximum possible sum? The first line contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers x_1 , y_1 , z_1 ( 0 <= x_1, y_1, z_1 <= 10^8 ) -- the number of 0 -s, 1 -s and 2 -s in the sequence a . The second line of each test case also contains three integers x_2 , y_2 , z_2 ( 0 <= x_2, y_2, z_2 <= 10^8 ; x_1 + y_1 + z_1 = x_2 + y_2 + z_2 > 0 ) -- the number of 0 -s, 1 -s and 2 -s in the sequence b . For each test case, print the maximum possible sum of the sequence c . In the first sample, one of the optimal solutions is: a = {2, 0, 1, 1, 0, 2, 1 } b = {1, 0, 1, 0, 2, 1, 0 } c = {2, 0, 0, 0, 0, 2, 0 } In the second sample, one of the optimal solutions is: a = {0, 2, 0, 0, 0 } b = {1, 1, 0, 1, 0 } c = {0, 2, 0, 0, 0 } In the third sample, the only possible solution is: a = {2 } b = {2 } c = {0 } "...

Tutorials

Codeforces Round #665 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
91175668 unihernandez22 B Aug. 28, 2020, 2:58 a.m. OK D TESTS 5 31 1945600
90822236 HQT2003 B Aug. 24, 2020, 11:50 a.m. OK FPC TESTS 5 61 3481600
91014600 luogu_bot4 B Aug. 26, 2020, 3:53 a.m. OK FPC TESTS 5 62 102400
91014615 luogu_bot2 B Aug. 26, 2020, 3:53 a.m. OK FPC TESTS 5 62 102400
90892083 BeKind B Aug. 25, 2020, 10:52 a.m. OK GNU C11 TESTS 5 46 0
91235140 Lvl999Noob B Aug. 28, 2020, 6:04 p.m. OK GNU C11 TESTS 5 61 0
91159119 simran145 B Aug. 27, 2020, 6:03 p.m. OK GNU C11 TESTS 5 61 0
90865322 aes_the_tic B Aug. 25, 2020, 3:44 a.m. OK GNU C11 TESTS 5 62 0
91037477 softslayer B Aug. 26, 2020, 9:37 a.m. OK GNU C11 TESTS 5 62 0
91057987 6945174027DungLT B Aug. 26, 2020, 1:45 p.m. OK GNU C11 TESTS 5 62 0
91276200 ERRSSELL B Aug. 29, 2020, 10:25 a.m. OK GNU C11 TESTS 5 62 0
91303186 star_force B Aug. 29, 2020, 5:38 p.m. OK GNU C11 TESTS 5 62 0
91321055 _shiv_ B Aug. 30, 2020, 4:06 a.m. OK GNU C11 TESTS 5 62 0
91121387 satvik76 B Aug. 27, 2020, 9:46 a.m. OK GNU C11 TESTS 5 77 0
91276404 ShineEternal B Aug. 29, 2020, 10:28 a.m. OK GNU C++11 TESTS 5 15 0
91603291 hjh B Sept. 1, 2020, 11:53 p.m. OK GNU C++11 TESTS 5 15 0
91532689 Shekh_Ashraful B Sept. 1, 2020, 3:08 a.m. OK GNU C++11 TESTS 5 15 0
91495572 Payphone--X B Aug. 31, 2020, 1:38 p.m. OK GNU C++11 TESTS 5 15 0
91264819 Sor4ii B Aug. 29, 2020, 7:30 a.m. OK GNU C++11 TESTS 5 15 0
91200972 coldiceh B Aug. 28, 2020, 10:54 a.m. OK GNU C++11 TESTS 5 15 0
91069690 cwb_sb B Aug. 26, 2020, 3:36 p.m. OK GNU C++11 TESTS 5 15 0
91065032 Islav03 B Aug. 26, 2020, 2:52 p.m. OK GNU C++11 TESTS 5 15 0
91033032 yussgrw B Aug. 26, 2020, 8:39 a.m. OK GNU C++11 TESTS 5 15 0
91468714 Rayment B Aug. 31, 2020, 7:34 a.m. OK GNU C++11 TESTS 5 15 3686400
90988204 coolss B Aug. 25, 2020, 5:02 p.m. OK GNU C++14 TESTS 5 30 0
91176255 NamuTree B Aug. 28, 2020, 3:16 a.m. OK GNU C++14 TESTS 5 30 0
91573548 guestIT B Sept. 1, 2020, 2:23 p.m. OK GNU C++14 TESTS 5 30 0
91631116 dummy04 B Sept. 2, 2020, 10:19 a.m. OK GNU C++14 TESTS 5 30 0
90903608 nguyen1212 B Aug. 25, 2020, 1:35 p.m. OK GNU C++14 TESTS 5 30 0
90851162 Kir_P B Aug. 24, 2020, 6:06 p.m. OK GNU C++14 TESTS 5 30 0
90857313 nikolapintaric B Aug. 24, 2020, 8:14 p.m. OK GNU C++14 TESTS 5 30 0
90899773 harshitmuhal B Aug. 25, 2020, 12:41 p.m. OK GNU C++14 TESTS 5 30 0
90836236 _aman_kothari B Aug. 24, 2020, 2:51 p.m. OK GNU C++14 TESTS 5 30 3686400
91454716 boxnos B Aug. 31, 2020, 4:27 a.m. OK GNU C++14 TESTS 5 30 3686400
90907125 201831990439 B Aug. 25, 2020, 2:22 p.m. OK GNU C++17 TESTS 5 15 512000
91041511 pan__da B Aug. 26, 2020, 10:36 a.m. OK GNU C++17 TESTS 5 30 0
90878685 tytanium B Aug. 25, 2020, 7:39 a.m. OK GNU C++17 TESTS 5 30 0
91249183 Szki B Aug. 29, 2020, 12:44 a.m. OK GNU C++17 TESTS 5 30 0
91173211 vjudge3 B Aug. 28, 2020, 1:24 a.m. OK GNU C++17 TESTS 5 30 0
91166026 dicfore B Aug. 27, 2020, 8:17 p.m. OK GNU C++17 TESTS 5 30 0
90892341 raushan303 B Aug. 25, 2020, 10:55 a.m. OK GNU C++17 TESTS 5 30 0
91543508 chunmeng2211 B Sept. 1, 2020, 7:11 a.m. OK GNU C++17 TESTS 5 30 0
91504654 vjudge3 B Aug. 31, 2020, 3:27 p.m. OK GNU C++17 TESTS 5 30 0
91304793 anuban12240 B Aug. 29, 2020, 6:08 p.m. OK GNU C++17 TESTS 5 30 0
91154362 Alan_Mgine B Aug. 27, 2020, 5:01 p.m. OK GNU C++17 (64) TESTS 5 15 0
91585385 ArtemGucci B Sept. 1, 2020, 4:42 p.m. OK GNU C++17 (64) TESTS 5 15 0
91709010 dhiraj-01 B Sept. 3, 2020, 10:42 a.m. OK GNU C++17 (64) TESTS 5 15 0
91520564 hixvii69 B Aug. 31, 2020, 7:33 p.m. OK GNU C++17 (64) TESTS 5 15 4096000
91131332 antguz B Aug. 27, 2020, 12:12 p.m. OK GNU C++17 (64) TESTS 5 30 0
91273448 BeAsTmAsTeR B Aug. 29, 2020, 9:45 a.m. OK GNU C++17 (64) TESTS 5 30 0
91271583 WiwiHo B Aug. 29, 2020, 9:15 a.m. OK GNU C++17 (64) TESTS 5 30 0
91219091 Phortox B Aug. 28, 2020, 2:54 p.m. OK GNU C++17 (64) TESTS 5 30 0
91045184 Catalyst259 B Aug. 26, 2020, 11:23 a.m. OK GNU C++17 (64) TESTS 5 30 0
90902321 ksun48 B Aug. 25, 2020, 1:17 p.m. OK GNU C++17 (64) TESTS 5 30 0
91038116 pema4 B Aug. 26, 2020, 9:47 a.m. OK Haskell TESTS 5 93 102400
91038091 B_w_c B Aug. 26, 2020, 9:47 a.m. OK Haskell TESTS 5 139 102400
91522360 aquarius_gaurav B Aug. 31, 2020, 8:12 p.m. OK Java 11 TESTS 5 171 0
91083826 HastaLaVistaLa B Aug. 26, 2020, 6:26 p.m. OK Java 11 TESTS 5 171 0
90812045 ssd17 B Aug. 24, 2020, 9:21 a.m. OK Java 11 TESTS 5 171 24064000
91595180 Ste B Sept. 1, 2020, 7:14 p.m. OK Java 11 TESTS 5 187 0
91545417 O-infinity B Sept. 1, 2020, 7:37 a.m. OK Java 11 TESTS 5 202 0
91624856 Oort. B Sept. 2, 2020, 8:36 a.m. OK Java 11 TESTS 5 202 0
91288240 sg55 B Aug. 29, 2020, 1:35 p.m. OK Java 11 TESTS 5 202 0
91507117 JigarNainuji B Aug. 31, 2020, 3:58 p.m. OK Java 11 TESTS 5 249 0
90905213 Vatsal53 B Aug. 25, 2020, 1:57 p.m. OK Java 11 TESTS 5 249 0
90833973 HUNTERNIKHIL B Aug. 24, 2020, 2:24 p.m. OK Java 11 TESTS 5 249 23756800
91091368 Nirav412000 B Aug. 26, 2020, 9:15 p.m. OK Java 8 TESTS 5 108 0
90825219 tushar24 B Aug. 24, 2020, 12:30 p.m. OK Java 8 TESTS 5 108 20480000
91662525 noobspotted B Sept. 2, 2020, 5:15 p.m. OK Java 8 TESTS 5 109 0
90888573 __goku__ B Aug. 25, 2020, 10 a.m. OK Java 8 TESTS 5 109 0
90871353 Homie_smk B Aug. 25, 2020, 5:51 a.m. OK Java 8 TESTS 5 109 0
91545772 O-infinity B Sept. 1, 2020, 7:42 a.m. OK Java 8 TESTS 5 124 0
91183183 Sjoa B Aug. 28, 2020, 6:07 a.m. OK Java 8 TESTS 5 124 0
90907187 AWahba B Aug. 25, 2020, 2:23 p.m. OK Java 8 TESTS 5 124 0
90860736 abhi456tm B Aug. 25, 2020, 12:59 a.m. OK Java 8 TESTS 5 124 0
91373862 aearly B Aug. 30, 2020, 3:08 p.m. OK Java 8 TESTS 5 124 20480000
90887391 Dimon2305 B Aug. 25, 2020, 9:42 a.m. OK JavaScript TESTS 5 62 2560000
90824986 dkozak94 B Aug. 24, 2020, 12:27 p.m. OK Kotlin TESTS 5 202 20582400
91003243 sikr_ B Aug. 25, 2020, 9:07 p.m. OK Kotlin TESTS 5 249 0
91083006 gaurs86 B Aug. 26, 2020, 6:12 p.m. OK Kotlin TESTS 5 265 0
90845726 Mirimax B Aug. 24, 2020, 4:46 p.m. OK Kotlin TESTS 5 295 0
91578800 ivyhack B Sept. 1, 2020, 3:21 p.m. OK Kotlin TESTS 5 296 0
91138348 MiuraMiuMiu B Aug. 27, 2020, 1:51 p.m. OK Mono C# TESTS 5 77 3072000
91274356 hhsaffar B Aug. 29, 2020, 9:57 a.m. OK Mono C# TESTS 5 124 6860800
91580630 shebao B Sept. 1, 2020, 3:43 p.m. OK MS C++ 2017 TESTS 5 31 0
91524278 Altaire13 B Aug. 31, 2020, 9:07 p.m. OK MS C++ 2017 TESTS 5 62 0
91131763 HouraiNingyou B Aug. 27, 2020, 12:18 p.m. OK MS C++ 2017 TESTS 5 77 0
90862103 letshavesomefun B Aug. 25, 2020, 2:03 a.m. OK MS C++ 2017 TESTS 5 93 0
91350437 ustaritz B Aug. 30, 2020, 2:32 p.m. OK MS C++ 2017 TESTS 5 93 3686400
90975682 bhanu2001 B Aug. 25, 2020, 4:22 p.m. OK MS C++ 2017 TESTS 5 108 0
90836951 masterwater B Aug. 24, 2020, 2:59 p.m. OK MS C++ 2017 TESTS 5 108 3686400
91255721 rider123 B Aug. 29, 2020, 4:43 a.m. OK MS C++ 2017 TESTS 5 109 0
91025200 Phil0 B Aug. 26, 2020, 6:47 a.m. OK MS C++ 2017 TESTS 5 109 0
91212843 AnnieLe B Aug. 28, 2020, 1:41 p.m. OK MS C++ 2017 TESTS 5 124 0
91141745 mishagam B Aug. 27, 2020, 2:34 p.m. OK Ocaml TESTS 5 31 204800
90826849 Chirrut_Imwe B Aug. 24, 2020, 12:53 p.m. OK PyPy 3 TESTS 5 217 26624000
91286425 chirag_j_rana B Aug. 29, 2020, 1:09 p.m. OK PyPy 3 TESTS 5 218 5734400
91448109 mycologyresearch2019 B Aug. 31, 2020, 2:10 a.m. OK PyPy 3 TESTS 5 248 28467200
91122870 cpicard443 B Aug. 27, 2020, 10:08 a.m. OK PyPy 3 TESTS 5 249 7987200
90840902 shubham_lohan B Aug. 24, 2020, 3:45 p.m. OK PyPy 3 TESTS 5 264 9625600
90832428 ibalram B Aug. 24, 2020, 2:05 p.m. OK PyPy 3 TESTS 5 343 30003200
91059774 Shankhadeep B Aug. 26, 2020, 2:02 p.m. OK PyPy 3 TESTS 5 373 12083200
91538043 shika16 B Sept. 1, 2020, 5:32 a.m. OK PyPy 3 TESTS 5 389 8192000
91069646 IMUK23 B Aug. 26, 2020, 3:36 p.m. OK PyPy 3 TESTS 5 405 9011200
90838933 Husam_ B Aug. 24, 2020, 3:21 p.m. OK PyPy 3 TESTS 5 421 30412800
90876238 ComptineDunAutreEte B Aug. 25, 2020, 7:06 a.m. OK Python 2 TESTS 5 202 102400
91553909 qeatzy B Sept. 1, 2020, 9:49 a.m. OK Python 3 TESTS 5 109 716800
91601426 ByMykel B Sept. 1, 2020, 10:19 p.m. OK Python 3 TESTS 5 140 1126400
91553645 qeatzy B Sept. 1, 2020, 9:45 a.m. OK Python 3 TESTS 5 155 307200
91064087 srishti99 B Aug. 26, 2020, 2:43 p.m. OK Python 3 TESTS 5 171 614400
91601360 ByMykel B Sept. 1, 2020, 10:16 p.m. OK Python 3 TESTS 5 171 1126400
90879788 chandureddyn5 B Aug. 25, 2020, 7:55 a.m. OK Python 3 TESTS 5 171 1536000
91521546 lichacuq B Aug. 31, 2020, 7:54 p.m. OK Python 3 TESTS 5 171 2048000
91105109 Mr.Krishna B Aug. 27, 2020, 5:32 a.m. OK Python 3 TESTS 5 171 2560000
91333470 Hoangnam145 B Aug. 30, 2020, 10:21 a.m. OK Python 3 TESTS 5 171 7168000
91060264 Shankhadeep B Aug. 26, 2020, 2:07 p.m. OK Python 3 TESTS 5 186 921600
91259698 Rara. B Aug. 29, 2020, 6:04 a.m. OK Ruby TESTS 5 592 307200
91259667 TheStrange B Aug. 29, 2020, 6:03 a.m. OK Ruby TESTS 5 592 307200
91221099 lordpawel B Aug. 28, 2020, 3:14 p.m. OK Ruby TESTS 5 592 819200
91222134 lordpawel B Aug. 28, 2020, 3:24 p.m. OK Ruby TESTS 5 608 1228800
91239601 pandrei B Aug. 28, 2020, 7:18 p.m. OK Rust TESTS 5 124 0
91174693 Vicfred B Aug. 28, 2020, 2:25 a.m. OK Rust TESTS 5 139 0
91098843 Strorkis B Aug. 27, 2020, 2:52 a.m. OK Rust TESTS 5 155 0

remove filters

Back to search problems