Codeforces Round 916 (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
1914 Codeforces Round 916 (Div. 3) FINISHED False 9000 34183463 Dec. 19, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 25877 ) C Quests PROGRAMMING greedy math

B'Monocarp is playing a computer game. In order to level up his character, he can complete quests. There are n quests in the game, numbered from 1 to n . Monocarp can complete quests according to the following rules: Note that Monocarp can complete the same quest multiple times. For each completion, the character gets some amount of experience points: Monocarp is a very busy person, so he has free time to complete no more than k quests. Your task is to calculate the maximum possible total experience Monocarp can get if he can complete no more than k quests. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains two integers n and k ( 1 <= n <= 2 cdot 10^5 ; 1 <= k <= 2 cdot 10^5 ) -- the number of quests and the maximum number of quests Monocarp can complete, respectively. The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^3 ). The third line contains n integers b_1, b_2, ... , b_n ( 1 <= b_i <= 10^3 ). Additional constraint on the input: the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, print a single integer -- the maximum possible total experience Monocarp can get if he can complete no more than k quests. In the first test case, one of the possible quest completion sequences is as follows: 1, 1, 2, 3, 2, 4, 4 ; its total experience is equal to underline{4} + 1 + underline{3} + underline{1} + 1 + underline{2} + 1 = 13 (the underlined numbers correspond to the instances when we complete a quest for the first time). In the second test case, one of the possible quest completion sequences is as follows: 1, 1 ; its total experience is equal to underline{1} + 3 = 4 . In the third test case, one of the possible quest completion sequences is as follows: 1, 2, 2, 2, 3 ; its '...

Tutorials

Codeforces Round 916 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
238082292 bluemegane C Dec. 20, 2023, 12:33 a.m. OK C# 8 TESTS 7 156 24678400
238047289 s227r1a67c4 C Dec. 19, 2023, 4:56 p.m. OK GNU C11 TESTS 7 93 1638400
238077319 Sanchit27 C Dec. 19, 2023, 9:47 p.m. OK GNU C11 TESTS 7 93 3174400
238049781 dvssjayaprakash C Dec. 19, 2023, 5:01 p.m. OK GNU C11 TESTS 7 109 1638400
238049433 Keerthana.pitta C Dec. 19, 2023, 5 p.m. OK GNU C11 TESTS 7 124 1638400
238050201 rikshitha08 C Dec. 19, 2023, 5:02 p.m. OK GNU C11 TESTS 7 124 1638400
238097829 luogu_bot4 C Dec. 20, 2023, 5:26 a.m. OK GNU C++14 TESTS 7 62 1638400
238079791 Parallel_Retrogression C Dec. 19, 2023, 11:01 p.m. OK GNU C++14 TESTS 7 77 3174400
238090750 yuyc C Dec. 20, 2023, 3:46 a.m. OK GNU C++14 TESTS 7 78 1638400
238086932 thhhhh C Dec. 20, 2023, 2:33 a.m. OK GNU C++14 TESTS 7 78 1638400
238093668 heziqian C Dec. 20, 2023, 4:30 a.m. OK GNU C++14 TESTS 7 78 2457600
238082845 Yukikaze1940 C Dec. 20, 2023, 12:51 a.m. OK GNU C++14 TESTS 7 78 3174400
238081387 jr_inf C Dec. 19, 2023, 11:57 p.m. OK GNU C++14 TESTS 7 78 6451200
238081629 QDJenny C Dec. 20, 2023, 12:07 a.m. OK GNU C++14 TESTS 7 93 1638400
238084800 18612631378 C Dec. 20, 2023, 1:43 a.m. OK GNU C++14 TESTS 7 93 1638400
238097011 tahoangquan2 C Dec. 20, 2023, 5:16 a.m. OK GNU C++14 TESTS 7 93 1638400
238057739 dipra5565 C Dec. 19, 2023, 5:37 p.m. OK GNU C++17 TESTS 7 61 1536000
238050999 dustytwig C Dec. 19, 2023, 5:03 p.m. OK GNU C++17 TESTS 7 78 1638400
238086630 EzuRohit C Dec. 20, 2023, 2:26 a.m. OK GNU C++17 TESTS 7 78 1638400
238077849 rajnish0808 C Dec. 19, 2023, 10:01 p.m. OK GNU C++17 TESTS 7 78 1638400
238074532 Abdohefny C Dec. 19, 2023, 8:49 p.m. OK GNU C++17 TESTS 7 78 1638400
238060687 7k9plusone0 C Dec. 19, 2023, 6 p.m. OK GNU C++17 TESTS 7 78 1638400
238067598 stegatxins0 C Dec. 19, 2023, 7:09 p.m. OK GNU C++17 TESTS 7 78 2662400
238084506 Roberth_G C Dec. 20, 2023, 1:36 a.m. OK GNU C++17 TESTS 7 78 2662400
238087319 _Phoenix_7 C Dec. 20, 2023, 2:41 a.m. OK GNU C++17 TESTS 7 78 2662400
238064484 anonymous_poonia C Dec. 19, 2023, 6:35 p.m. OK GNU C++17 TESTS 7 78 3174400
238089747 fs20091003 C Dec. 20, 2023, 3:28 a.m. OK GNU C++17 (64) TESTS 7 46 1638400
238088013 uy__uy C Dec. 20, 2023, 2:57 a.m. OK GNU C++17 (64) TESTS 7 46 1638400
238066383 _Rahim_17 C Dec. 19, 2023, 6:56 p.m. OK GNU C++17 (64) TESTS 7 46 1638400
238055796 watcherrr C Dec. 19, 2023, 5:24 p.m. OK GNU C++17 (64) TESTS 7 46 1638400
238096872 jie_god C Dec. 20, 2023, 5:15 a.m. OK GNU C++17 (64) TESTS 7 46 1638400
238090713 yuyc C Dec. 20, 2023, 3:45 a.m. OK GNU C++17 (64) TESTS 7 46 2150400
238054760 Vasu_ C Dec. 19, 2023, 5:19 p.m. OK GNU C++17 (64) TESTS 7 46 3174400
238087314 Safarzoda_Imron C Dec. 20, 2023, 2:41 a.m. OK GNU C++17 (64) TESTS 7 46 4812800
238087472 2088244836 C Dec. 20, 2023, 2:45 a.m. OK GNU C++17 (64) TESTS 7 46 4812800
238085568 LUXINTONG C Dec. 20, 2023, 2:02 a.m. OK GNU C++17 (64) TESTS 7 46 4812800
238099648 Slamaa C Dec. 20, 2023, 5:48 a.m. OK GNU C++20 (64) TESTS 7 15 3276800
238046740 _Hazem_ C Dec. 19, 2023, 4:54 p.m. OK GNU C++20 (64) TESTS 7 31 3174400
238056240 ashu_2004 C Dec. 19, 2023, 5:27 p.m. OK GNU C++20 (64) TESTS 7 46 819200
238093632 Udit_Mehra C Dec. 20, 2023, 4:29 a.m. OK GNU C++20 (64) TESTS 7 46 1638400
238093062 uditmehra3224 C Dec. 20, 2023, 4:21 a.m. OK GNU C++20 (64) TESTS 7 46 1638400
238094970 Kidding__Ma C Dec. 20, 2023, 4:50 a.m. OK GNU C++20 (64) TESTS 7 46 1638400
238095703 __abdallah__ C Dec. 20, 2023, 5 a.m. OK GNU C++20 (64) TESTS 7 46 1638400
238096714 Nobita275 C Dec. 20, 2023, 5:13 a.m. OK GNU C++20 (64) TESTS 7 46 1638400
238099305 Palavra C Dec. 20, 2023, 5:45 a.m. OK GNU C++20 (64) TESTS 7 46 1638400
238093829 knightzzz1 C Dec. 20, 2023, 4:32 a.m. OK GNU C++20 (64) TESTS 7 46 1638400
238077842 CruellaDeVil C Dec. 19, 2023, 10:01 p.m. OK Go TESTS 7 140 4300800
238097240 ajayg3059 C Dec. 20, 2023, 5:20 a.m. OK Go TESTS 7 140 7987200
238056201 Bipul70701 C Dec. 19, 2023, 5:27 p.m. OK Java 11 TESTS 7 202 11673600
238063541 kevbamboo C Dec. 19, 2023, 6:26 p.m. OK Java 11 TESTS 7 233 0
238096898 achal5623 C Dec. 20, 2023, 5:15 a.m. OK Java 11 TESTS 7 234 0
238060484 Siddharth_Singh_here C Dec. 19, 2023, 5:59 p.m. OK Java 11 TESTS 7 295 0
238063753 habib_48 C Dec. 19, 2023, 6:27 p.m. OK Java 11 TESTS 7 311 9830400
238061887 saksham_goel05 C Dec. 19, 2023, 6:10 p.m. OK Java 11 TESTS 7 343 614400
238075955 Mysterious-_-joker C Dec. 19, 2023, 9:17 p.m. OK Java 11 TESTS 7 608 0
238094313 Byte_maze C Dec. 20, 2023, 4:39 a.m. OK Java 11 TESTS 7 623 0
238091534 vijayluxmimaddheshiya02 C Dec. 20, 2023, 3:58 a.m. OK Java 11 TESTS 7 623 0
238052713 hitesh21392 C Dec. 19, 2023, 5:08 p.m. OK Java 11 TESTS 7 639 0
238097811 abhishekP01 C Dec. 20, 2023, 5:26 a.m. OK Java 17 TESTS 7 249 1638400
238096463 NatsuDragoneel C Dec. 20, 2023, 5:10 a.m. OK Java 17 TESTS 7 264 512000
238056544 snowyrsb C Dec. 19, 2023, 5:29 p.m. OK Java 17 TESTS 7 264 819200
238052632 arwa_khattab C Dec. 19, 2023, 5:08 p.m. OK Java 17 TESTS 7 280 204800
238047656 Sage_Saga C Dec. 19, 2023, 4:56 p.m. OK Java 17 TESTS 7 296 19456000
238048310 AbhirajBurla C Dec. 19, 2023, 4:58 p.m. OK Java 17 TESTS 7 327 6553600
238076027 prathamesh_204 C Dec. 19, 2023, 9:19 p.m. OK Java 17 TESTS 7 639 819200
238083899 klu_2100030559 C Dec. 20, 2023, 1:19 a.m. OK Java 17 TESTS 7 654 819200
238056988 AyushVardhan C Dec. 19, 2023, 5:32 p.m. OK Java 17 TESTS 7 655 614400
238089847 me22btech11050 C Dec. 20, 2023, 3:30 a.m. OK Java 17 TESTS 7 670 614400
238047375 Monarch321 C Dec. 19, 2023, 4:56 p.m. OK Java 21 TESTS 7 296 307200
238073620 darshanjan-entrepreneur C Dec. 19, 2023, 8:33 p.m. OK Java 21 TESTS 7 327 2150400
238066352 wintersoldier2004 C Dec. 19, 2023, 6:56 p.m. OK Java 21 TESTS 7 358 409600
238088787 chess_nf3 C Dec. 20, 2023, 3:12 a.m. OK Java 21 TESTS 7 358 614400
238060070 newborn_23 C Dec. 19, 2023, 5:55 p.m. OK Java 21 TESTS 7 374 0
238097756 AC_or_suicide C Dec. 20, 2023, 5:26 a.m. OK Java 21 TESTS 7 748 409600
238078362 goalboy C Dec. 19, 2023, 10:17 p.m. OK Java 21 TESTS 7 795 716800
238048671 s227r1a6749 C Dec. 19, 2023, 4:59 p.m. OK Java 21 TESTS 7 810 819200
238059141 arihant.18 C Dec. 19, 2023, 5:47 p.m. OK Java 21 TESTS 7 841 102400
238058406 Enemy_of_Syntax C Dec. 19, 2023, 5:41 p.m. OK Java 21 TESTS 7 841 409600
238094452 prakhar_30 C Dec. 20, 2023, 4:42 a.m. OK Java 8 TESTS 7 124 512000
238066281 zhassulan018 C Dec. 19, 2023, 6:55 p.m. OK Java 8 TESTS 7 155 512000
238074939 arpita010 C Dec. 19, 2023, 8:56 p.m. OK Java 8 TESTS 7 156 512000
238086368 Bill35 C Dec. 20, 2023, 2:21 a.m. OK Java 8 TESTS 7 171 2662400
238070659 Sumitsingh7 C Dec. 19, 2023, 7:49 p.m. OK Java 8 TESTS 7 187 7475200
238059178 American_Eagle C Dec. 19, 2023, 5:48 p.m. OK Java 8 TESTS 7 202 1843200
238056004 21241A05W2 C Dec. 19, 2023, 5:26 p.m. OK Java 8 TESTS 7 529 0
238089416 Akmaljon.08 C Dec. 20, 2023, 3:23 a.m. OK Java 8 TESTS 7 530 0
238069182 abbasslb C Dec. 19, 2023, 7:28 p.m. OK Java 8 TESTS 7 530 0
238082497 rahulsunny988 C Dec. 20, 2023, 12:40 a.m. OK Java 8 TESTS 7 545 0
238048339 sabbirahmeds877 C Dec. 19, 2023, 4:58 p.m. OK Kotlin 1.7 TESTS 7 1075 169881600
238065643 utikeev C Dec. 19, 2023, 6:48 p.m. OK Kotlin 1.9 TESTS 7 811 103833600
238047348 HiddenMoon C Dec. 19, 2023, 4:56 p.m. OK MS C++ 2017 TESTS 7 280 3993600
238049904 HiddenMoon C Dec. 19, 2023, 5:01 p.m. OK MS C++ 2017 TESTS 7 295 3174400
238087084 Jwalit C Dec. 20, 2023, 2:36 a.m. OK MS C++ 2017 TESTS 7 327 3993600
238098836 raj.priyam857885 C Dec. 20, 2023, 5:39 a.m. OK MS C++ 2017 TESTS 7 343 1638400
238087181 ShadowDrunk C Dec. 20, 2023, 2:38 a.m. OK MS C++ 2017 TESTS 7 343 1638400
238088132 Jasharaj C Dec. 20, 2023, 2:59 a.m. OK MS C++ 2017 TESTS 7 374 11776000
238092752 FONGLI C Dec. 20, 2023, 4:16 a.m. OK MS C++ 2017 TESTS 7 1793 3174400
238090135 Vaishnavi_054 C Dec. 20, 2023, 3:35 a.m. OK PyPy 3 TESTS 7 514 15257600
238093845 lisashi C Dec. 20, 2023, 4:33 a.m. OK PyPy 3 TESTS 7 514 18636800
238050471 Mohit_Karthikeya C Dec. 19, 2023, 5:02 p.m. OK PyPy 3 TESTS 7 545 15769600
238057337 newbievn C Dec. 19, 2023, 5:34 p.m. OK PyPy 3 TESTS 7 560 15872000
238048136 CMRIT25_21R01A0508 C Dec. 19, 2023, 4:58 p.m. OK PyPy 3 TESTS 7 561 15155200
238059163 zhdanovich C Dec. 19, 2023, 5:48 p.m. OK PyPy 3 TESTS 7 561 15769600
238094277 lisashi C Dec. 20, 2023, 4:39 a.m. OK PyPy 3 TESTS 7 561 18636800
238048634 CMRIT25_21R01A6622 C Dec. 19, 2023, 4:59 p.m. OK PyPy 3 TESTS 7 576 15257600
238061254 porker2008 C Dec. 19, 2023, 6:05 p.m. OK PyPy 3 TESTS 7 576 15667200
238067420 akshat11 C Dec. 19, 2023, 7:07 p.m. OK PyPy 3 TESTS 7 576 15872000
238076212 Jayg000e C Dec. 19, 2023, 9:23 p.m. OK PyPy 3-64 TESTS 7 124 27750400
238093595 OmarMoBadr C Dec. 20, 2023, 4:29 a.m. OK PyPy 3-64 TESTS 7 139 30412800
238085549 gardengnome C Dec. 20, 2023, 2:02 a.m. OK PyPy 3-64 TESTS 7 139 30412800
238067987 Mohamed_Yousef_2024 C Dec. 19, 2023, 7:13 p.m. OK PyPy 3-64 TESTS 7 139 95027200
238064648 AndreiZherder C Dec. 19, 2023, 6:37 p.m. OK PyPy 3-64 TESTS 7 155 22835200
238065243 jabalpureishan C Dec. 19, 2023, 6:44 p.m. OK PyPy 3-64 TESTS 7 155 30003200
238077266 daniil.gerchik C Dec. 19, 2023, 9:46 p.m. OK PyPy 3-64 TESTS 7 155 30208000
238061344 Mustela_Erminea C Dec. 19, 2023, 6:05 p.m. OK PyPy 3-64 TESTS 7 155 30412800
238059881 jvatsal0709 C Dec. 19, 2023, 5:53 p.m. OK PyPy 3-64 TESTS 7 155 30412800
238056186 2020A7PS0273H_Sriram_S C Dec. 19, 2023, 5:27 p.m. OK PyPy 3-64 TESTS 7 156 30515200
238084189 MihajloMilojevic C Dec. 20, 2023, 1:27 a.m. OK Python 3 TESTS 7 233 30105600
238079260 Ganxel C Dec. 19, 2023, 10:42 p.m. OK Python 3 TESTS 7 249 32051200
238060791 Ratery C Dec. 19, 2023, 6:01 p.m. OK Python 3 TESTS 7 264 30617600
238059056 Kaushal655 C Dec. 19, 2023, 5:47 p.m. OK Python 3 TESTS 7 264 30720000
238055103 lapras100 C Dec. 19, 2023, 5:21 p.m. OK Python 3 TESTS 7 264 32768000
238048817 monkey_d_viper C Dec. 19, 2023, 4:59 p.m. OK Python 3 TESTS 7 265 30105600
238093943 WarsNitin C Dec. 20, 2023, 4:34 a.m. OK Python 3 TESTS 7 265 30617600
238046939 sm_10 C Dec. 19, 2023, 4:55 p.m. OK Python 3 TESTS 7 265 31539200
238096975 ___a_s_1_2___ C Dec. 20, 2023, 5:16 a.m. OK Python 3 TESTS 7 280 30617600
238057848 learnerdaily5 C Dec. 19, 2023, 5:37 p.m. OK Python 3 TESTS 7 280 30617600
238048960 s2110676154 C Dec. 19, 2023, 4:59 p.m. OK Ruby 3 TESTS 7 608 45670400
238095279 0x81 C Dec. 20, 2023, 4:54 a.m. OK Ruby 3 TESTS 7 670 35737600
238065613 liut C Dec. 19, 2023, 6:48 p.m. OK Rust 2021 TESTS 7 46 1638400
238050573 Rajveer_100 C Dec. 19, 2023, 5:03 p.m. OK Rust 2021 TESTS 7 46 21708800

remove filters

Back to search problems