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.
Problems
B'You have an array of integers a of size n . Initially, all elements of the array are equal to 1 . You can perform the following operation: choose two integers i ( 1 <= i <= n ) and x ( x > 0 ), and then increase the value of a_i by <= ft lfloor frac{a_i}{x} right rfloor (i.e. make a_i = a_i + <= ft lfloor frac{a_i}{x} right rfloor ). After performing all operations, you will receive c_i coins for all such i that a_i = b_i . Your task is to determine the maximum number of coins that you can receive by performing no more than k operations. The first line contains a single integer t ( 1 <= t <= 100 ) -- the number of test cases. The first line of each test case contains two integers n and k ( 1 <= n <= 10^3; 0 <= k <= 10^6 ) -- the size of the array and the maximum number of operations, respectively. The second line contains n integers b_1, b_2, ... , b_n ( 1 <= b_i <= 10^3 ). The third line contains n integers c_1, c_2, ... , c_n ( 1 <= c_i <= 10^6 ). The sum of n over all test cases does not exceed 10^3 . For each test case, print one integer -- the maximum number of coins that you can get by performing no more than k operations. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
144761171 |
chro4896 |
D |
Jan. 31, 2022, 5:04 p.m. |
OK |
GNU C11 |
TESTS |
66 |
46 |
102400 |
|
|
144778839 |
wakaranai |
D |
Jan. 31, 2022, 8:03 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
15 |
102400 |
|
|
144773451 |
Teflon004 |
D |
Jan. 31, 2022, 6:47 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
15 |
204800 |
|
|
144790897 |
KazamaHoang |
D |
Feb. 1, 2022, 3:24 a.m. |
OK |
GNU C++14 |
TESTS |
66 |
15 |
3993600 |
|
|
144793036 |
End_the_rew |
D |
Feb. 1, 2022, 4:08 a.m. |
OK |
GNU C++14 |
TESTS |
66 |
30 |
204800 |
|
|
144786404 |
JokerSmile |
D |
Feb. 1, 2022, 12:21 a.m. |
OK |
GNU C++14 |
TESTS |
66 |
30 |
409600 |
|
|
144787234 |
XXX_FIST |
D |
Feb. 1, 2022, 1:13 a.m. |
OK |
GNU C++14 |
TESTS |
66 |
31 |
102400 |
|
|
144759045 |
Saksham_Sahgal |
D |
Jan. 31, 2022, 4:52 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
31 |
102400 |
|
|
144781588 |
chanoey |
D |
Jan. 31, 2022, 8:57 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
31 |
102400 |
|
|
144760298 |
WTR2007 |
D |
Jan. 31, 2022, 4:59 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
31 |
102400 |
|
|
144783670 |
Alok_32 |
D |
Jan. 31, 2022, 9:50 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
31 |
204800 |
|
|
144787148 |
Rockett |
D |
Feb. 1, 2022, 1:08 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
15 |
102400 |
|
|
144799437 |
kingpin119 |
D |
Feb. 1, 2022, 5:59 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
15 |
204800 |
|
|
144790012 |
vedantsingh1 |
D |
Feb. 1, 2022, 3:02 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
15 |
204800 |
|
|
144787054 |
RetsaZC19 |
D |
Feb. 1, 2022, 1:03 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
15 |
204800 |
|
|
144763820 |
_no_mercy |
D |
Jan. 31, 2022, 5:20 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
15 |
204800 |
|
|
144762205 |
Class_ |
D |
Jan. 31, 2022, 5:10 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
15 |
204800 |
|
|
144761290 |
XDEv11 |
D |
Jan. 31, 2022, 5:04 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
15 |
204800 |
|
|
144760408 |
abdulrahman_aj |
D |
Jan. 31, 2022, 4:59 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
15 |
204800 |
|
|
144793659 |
yurusanP |
D |
Feb. 1, 2022, 4:19 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
15 |
204800 |
|
|
144759080 |
Monarchuwu |
D |
Jan. 31, 2022, 4:53 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
15 |
409600 |
|
|
144764445 |
pd_codes |
D |
Jan. 31, 2022, 5:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144798162 |
Skylakes |
D |
Feb. 1, 2022, 5:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144794191 |
Skylakes |
D |
Feb. 1, 2022, 4:28 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144793777 |
ScarletS |
D |
Feb. 1, 2022, 4:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144790795 |
moonlit_night |
D |
Feb. 1, 2022, 3:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144776609 |
adiagr |
D |
Jan. 31, 2022, 7:29 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144775726 |
jainmilind |
D |
Jan. 31, 2022, 7:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144770051 |
pakhandi98 |
D |
Jan. 31, 2022, 6:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144760816 |
mykhail0 |
D |
Jan. 31, 2022, 5:02 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144758172 |
MArioIITG |
D |
Jan. 31, 2022, 4:49 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144791636 |
Crying |
D |
Feb. 1, 2022, 3:41 a.m. |
OK |
GNU C++20 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144786833 |
czhang2718 |
D |
Feb. 1, 2022, 12:49 a.m. |
OK |
GNU C++20 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144782842 |
eklavya_k |
D |
Jan. 31, 2022, 9:26 p.m. |
OK |
GNU C++20 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144782221 |
ansh |
D |
Jan. 31, 2022, 9:11 p.m. |
OK |
GNU C++20 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144775427 |
RP_21 |
D |
Jan. 31, 2022, 7:13 p.m. |
OK |
GNU C++20 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144770806 |
sjc061031 |
D |
Jan. 31, 2022, 6:18 p.m. |
OK |
GNU C++20 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144769676 |
the_hyp0cr1t3 |
D |
Jan. 31, 2022, 6:08 p.m. |
OK |
GNU C++20 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144768443 |
beyond271828 |
D |
Jan. 31, 2022, 5:56 p.m. |
OK |
GNU C++20 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144767115 |
ahmet23 |
D |
Jan. 31, 2022, 5:45 p.m. |
OK |
GNU C++20 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144793726 |
abc3 |
D |
Feb. 1, 2022, 4:20 a.m. |
OK |
GNU C++20 (64) |
TESTS |
66 |
15 |
102400 |
|
|
144784592 |
glebsamsonov |
D |
Jan. 31, 2022, 10:21 p.m. |
OK |
Go |
TESTS |
66 |
545 |
42393600 |
|
|
144794180 |
JigarNainuji |
D |
Feb. 1, 2022, 4:28 a.m. |
OK |
Java 11 |
TESTS |
66 |
202 |
0 |
|
|
144789081 |
Kumaresh |
D |
Feb. 1, 2022, 2:34 a.m. |
OK |
Java 11 |
TESTS |
66 |
202 |
0 |
|
|
144769450 |
sauravmandal |
D |
Jan. 31, 2022, 6:06 p.m. |
OK |
Java 11 |
TESTS |
66 |
217 |
0 |
|
|
144794734 |
JigarNainuji |
D |
Feb. 1, 2022, 4:37 a.m. |
OK |
Java 11 |
TESTS |
66 |
218 |
0 |
|
|
144782094 |
S-A-I-T-A-M-A |
D |
Jan. 31, 2022, 9:08 p.m. |
OK |
Java 11 |
TESTS |
66 |
233 |
76083200 |
|
|
144784874 |
khwrzm |
D |
Jan. 31, 2022, 10:33 p.m. |
OK |
Java 11 |
TESTS |
66 |
234 |
75264000 |
|
|
144793449 |
ArchitSharma |
D |
Feb. 1, 2022, 4:15 a.m. |
OK |
Java 11 |
TESTS |
66 |
248 |
76185600 |
|
|
144775509 |
ujjwalbhan.ub |
D |
Jan. 31, 2022, 7:14 p.m. |
OK |
Java 11 |
TESTS |
66 |
249 |
0 |
|
|
144762801 |
TheOG |
D |
Jan. 31, 2022, 5:13 p.m. |
OK |
Java 11 |
TESTS |
66 |
265 |
0 |
|
|
144792693 |
geetsharma4019 |
D |
Feb. 1, 2022, 4:02 a.m. |
OK |
Java 11 |
TESTS |
66 |
296 |
80076800 |
|
|
144791773 |
ved20 |
D |
Feb. 1, 2022, 3:44 a.m. |
OK |
Java 8 |
TESTS |
66 |
171 |
0 |
|
|
144764621 |
Omar_Mohammad |
D |
Jan. 31, 2022, 5:26 p.m. |
OK |
Java 8 |
TESTS |
66 |
186 |
72806400 |
|
|
144763293 |
chinmaya21 |
D |
Jan. 31, 2022, 5:17 p.m. |
OK |
Java 8 |
TESTS |
66 |
186 |
74137600 |
|
|
144774990 |
adi_7861 |
D |
Jan. 31, 2022, 7:07 p.m. |
OK |
Java 8 |
TESTS |
66 |
202 |
0 |
|
|
144781314 |
pranayrana14 |
D |
Jan. 31, 2022, 8:50 p.m. |
OK |
Java 8 |
TESTS |
66 |
202 |
79564800 |
|
|
144793129 |
gagan_6730 |
D |
Feb. 1, 2022, 4:10 a.m. |
OK |
Java 8 |
TESTS |
66 |
218 |
134451200 |
|
|
144791895 |
ved20 |
D |
Feb. 1, 2022, 3:46 a.m. |
OK |
Java 8 |
TESTS |
66 |
233 |
0 |
|
|
144780419 |
invincible777 |
D |
Jan. 31, 2022, 8:32 p.m. |
OK |
Java 8 |
TESTS |
66 |
233 |
137113600 |
|
|
144770011 |
Swapniltri |
D |
Jan. 31, 2022, 6:11 p.m. |
OK |
Java 8 |
TESTS |
66 |
249 |
143974400 |
|
|
144759589 |
kishan963 |
D |
Jan. 31, 2022, 4:55 p.m. |
OK |
Java 8 |
TESTS |
66 |
264 |
75980800 |
|
|
144768830 |
arvindf232 |
D |
Jan. 31, 2022, 6 p.m. |
OK |
Kotlin 1.4 |
TESTS |
66 |
342 |
152780800 |
|
|
144782165 |
noisegain |
D |
Jan. 31, 2022, 9:10 p.m. |
OK |
Kotlin 1.4 |
TESTS |
66 |
389 |
1433600 |
|
|
144759614 |
BruteForcee |
D |
Jan. 31, 2022, 4:55 p.m. |
OK |
Kotlin 1.5 |
TESTS |
66 |
1045 |
819200 |
|
|
144763311 |
1_2_3_4_5_9 |
D |
Jan. 31, 2022, 5:17 p.m. |
OK |
PyPy 2 |
TESTS |
66 |
451 |
2048000 |
|
|
144757770 |
1_2_3_4_5_9 |
D |
Jan. 31, 2022, 4:47 p.m. |
OK |
PyPy 2 |
TESTS |
66 |
498 |
2048000 |
|
|
144764979 |
OLOGY |
D |
Jan. 31, 2022, 5:28 p.m. |
OK |
PyPy 2 |
TESTS |
66 |
998 |
6860800 |
|
|
144779542 |
nitin4184 |
D |
Jan. 31, 2022, 8:16 p.m. |
OK |
PyPy 3 |
TESTS |
66 |
171 |
2355200 |
|
|
144756768 |
Aksnov |
D |
Jan. 31, 2022, 4:43 p.m. |
OK |
PyPy 3 |
TESTS |
66 |
187 |
2969600 |
|
|
144780747 |
kay_standrews |
D |
Jan. 31, 2022, 8:38 p.m. |
OK |
PyPy 3 |
TESTS |
66 |
234 |
50483200 |
|
|
144796655 |
whatshisbucket |
D |
Feb. 1, 2022, 5:21 a.m. |
OK |
PyPy 3 |
TESTS |
66 |
249 |
10342400 |
|
|
144780854 |
kay_standrews |
D |
Jan. 31, 2022, 8:41 p.m. |
OK |
PyPy 3 |
TESTS |
66 |
264 |
50380800 |
|
|
144762695 |
raideva |
D |
Jan. 31, 2022, 5:13 p.m. |
OK |
PyPy 3 |
TESTS |
66 |
296 |
6348800 |
|
|
144762246 |
raideva |
D |
Jan. 31, 2022, 5:10 p.m. |
OK |
PyPy 3 |
TESTS |
66 |
451 |
15769600 |
|
|
144772902 |
NS3081992 |
D |
Jan. 31, 2022, 6:41 p.m. |
OK |
PyPy 3 |
TESTS |
66 |
452 |
57139200 |
|
|
144781727 |
abhishekk_7 |
D |
Jan. 31, 2022, 9 p.m. |
OK |
PyPy 3 |
TESTS |
66 |
499 |
15872000 |
|
|
144799113 |
tan_delhi |
D |
Feb. 1, 2022, 5:56 a.m. |
OK |
PyPy 3 |
TESTS |
66 |
545 |
57856000 |
|
|
144763186 |
pruthvirg |
D |
Jan. 31, 2022, 5:16 p.m. |
OK |
PyPy 3-64 |
TESTS |
66 |
171 |
3788800 |
|
|
144772584 |
vilhelmthorsson |
D |
Jan. 31, 2022, 6:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
66 |
171 |
4096000 |
|
|
144758485 |
aayush_chhabra |
D |
Jan. 31, 2022, 4:50 p.m. |
OK |
PyPy 3-64 |
TESTS |
66 |
187 |
9625600 |
|
|
144762190 |
aayush_chhabra |
D |
Jan. 31, 2022, 5:09 p.m. |
OK |
PyPy 3-64 |
TESTS |
66 |
187 |
9728000 |
|
|
144773887 |
OmPrakash12 |
D |
Jan. 31, 2022, 6:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
66 |
202 |
11980800 |
|
|
144781190 |
ossau_guildo |
D |
Jan. 31, 2022, 8:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
66 |
249 |
8908800 |
|
|
144757588 |
bjy |
D |
Jan. 31, 2022, 4:46 p.m. |
OK |
PyPy 3-64 |
TESTS |
66 |
296 |
4096000 |
|
|
144756988 |
hash1023 |
D |
Jan. 31, 2022, 4:44 p.m. |
OK |
PyPy 3-64 |
TESTS |
66 |
296 |
100147200 |
|
|
144776127 |
_nathan_drake_ |
D |
Jan. 31, 2022, 7:23 p.m. |
OK |
PyPy 3-64 |
TESTS |
66 |
311 |
103731200 |
|
|
144771590 |
gourav2001k |
D |
Jan. 31, 2022, 6:26 p.m. |
OK |
PyPy 3-64 |
TESTS |
66 |
342 |
112844800 |
|
|
144797667 |
kroyl |
D |
Feb. 1, 2022, 5:40 a.m. |
OK |
Rust 2021 |
TESTS |
66 |
31 |
102400 |
|
|
144757768 |
clause |
D |
Jan. 31, 2022, 4:47 p.m. |
OK |
Rust 2021 |
TESTS |
66 |
77 |
96460800 |
|
|
144763512 |
togatoga |
D |
Jan. 31, 2022, 5:18 p.m. |
OK |
Rust 2021 |
TESTS |
66 |
124 |
96768000 |
|
|
remove filters
Back to search problems