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 are given a multiset of powers of two. More precisely, for each i from 0 to n exclusive you have cnt_i elements equal to 2^i . In one operation, you can choose any one element 2^l > 1 and divide it into two elements 2^{l - 1} . You should perform q queries. Each query has one of two types: Note that all queries of the second type don't change the multiset; that is, you just calculate the minimum number of operations, you don't perform them. The first line contains two integers n and q ( 1 <= n <= 30 ; 1 <= q <= 2 cdot 10^5 ) -- the size of array cnt and the number of queries. The second line contains n integers cnt_0, cnt_1, ... , cnt_{n - 1} ( 0 <= cnt_i <= 10^6 ). Next q lines contain queries: one per line. Each query has one of two types: It's guaranteed that there is at least one query of the second type. For each query of the second type, print the minimum number of operations you need to make at least k elements with a value lower or equal to 2^x or -1 if there is no way to do it. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
98943499 |
rainboy |
F |
Nov. 19, 2020, 4:26 p.m. |
OK |
GNU C11 |
TESTS |
66 |
530 |
0 |
|
|
98991465 |
vinhntndu |
F |
Nov. 20, 2020, 1:05 a.m. |
OK |
GNU C++11 |
TESTS |
66 |
1107 |
0 |
|
|
98949655 |
easeen56 |
F |
Nov. 19, 2020, 4:57 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
171 |
0 |
|
|
98942480 |
dlalswp25 |
F |
Nov. 19, 2020, 4:22 p.m. |
OK |
GNU C++14 |
TESTS |
66 |
202 |
0 |
|
|
98990680 |
HanTroid |
F |
Nov. 20, 2020, 12:23 a.m. |
OK |
GNU C++14 |
TESTS |
66 |
218 |
0 |
|
|
98978504 |
rainboy |
F |
Nov. 19, 2020, 6:06 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
139 |
0 |
|
|
98992245 |
Aphelios |
F |
Nov. 20, 2020, 1:39 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
155 |
24064000 |
|
|
98940434 |
yokozuna57 |
F |
Nov. 19, 2020, 4:15 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
202 |
0 |
|
|
98949688 |
Arti1990 |
F |
Nov. 19, 2020, 4:58 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
202 |
0 |
|
|
98991741 |
BrayanD |
F |
Nov. 20, 2020, 1:18 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
218 |
0 |
|
|
98947753 |
dreamoon_love_AA |
F |
Nov. 19, 2020, 4:44 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
218 |
0 |
|
|
98993302 |
_SW |
F |
Nov. 20, 2020, 2:25 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
218 |
0 |
|
|
99000155 |
vipjml |
F |
Nov. 20, 2020, 5:22 a.m. |
OK |
GNU C++17 |
TESTS |
66 |
233 |
0 |
|
|
98940913 |
Mucosolvan |
F |
Nov. 19, 2020, 4:17 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
234 |
16076800 |
|
|
98977388 |
Soapen |
F |
Nov. 19, 2020, 5:48 p.m. |
OK |
GNU C++17 |
TESTS |
66 |
249 |
0 |
|
|
98991972 |
BrayanD |
F |
Nov. 20, 2020, 1:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
124 |
0 |
|
|
98935697 |
neal |
F |
Nov. 19, 2020, 3:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
124 |
0 |
|
|
98942341 |
natsugiri |
F |
Nov. 19, 2020, 4:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
139 |
0 |
|
|
98939633 |
Be_dos |
F |
Nov. 19, 2020, 4:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
139 |
0 |
|
|
98939437 |
Ormlis |
F |
Nov. 19, 2020, 4:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
140 |
0 |
|
|
98976764 |
noimi |
F |
Nov. 19, 2020, 5:38 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
140 |
0 |
|
|
98983529 |
Egor.Lifar |
F |
Nov. 19, 2020, 7:42 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
155 |
1638400 |
|
|
98975651 |
A_Le_K |
F |
Nov. 19, 2020, 5:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
936 |
0 |
|
|
98975539 |
A_Le_K |
F |
Nov. 19, 2020, 5:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
936 |
0 |
|
|
98945826 |
YangDavid |
F |
Nov. 19, 2020, 4:33 p.m. |
OK |
GNU C++17 (64) |
TESTS |
66 |
951 |
0 |
|
|
98947985 |
Dukkha |
F |
Nov. 19, 2020, 4:46 p.m. |
OK |
Java 11 |
TESTS |
66 |
265 |
0 |
|
|
98987414 |
godxpunk |
F |
Nov. 19, 2020, 9:35 p.m. |
OK |
Java 8 |
TESTS |
66 |
249 |
0 |
|
|
98944803 |
Tlatoani |
F |
Nov. 19, 2020, 4:30 p.m. |
OK |
Kotlin |
TESTS |
66 |
343 |
102400 |
|
|
98941052 |
pajenegod |
F |
Nov. 19, 2020, 4:17 p.m. |
OK |
PyPy 2 |
TESTS |
66 |
733 |
51404800 |
|
|
98981257 |
sh1194 |
F |
Nov. 19, 2020, 6:55 p.m. |
OK |
Python 2 |
TESTS |
66 |
1981 |
22118400 |
|
|
98980887 |
sh1194 |
F |
Nov. 19, 2020, 6:48 p.m. |
OK |
Python 2 |
TESTS |
66 |
1996 |
21708800 |
|
|
98981119 |
sh1194 |
F |
Nov. 19, 2020, 6:52 p.m. |
OK |
Python 2 |
TESTS |
66 |
1996 |
21913600 |
|
|
remove filters
Back to search problems