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"Monocarp would like to open a bakery in his local area. But, at first, he should figure out whether he can compete with other shops. Monocarp plans that the bakery will work for n days. On the i -th day, a_i loaves of bread will be baked in the morning before the opening. At the end of the n -th day, Monocarp will sell all the remaining bread that wasn't sold earlier with a huge discount. Because of how bread is stored, the bakery seller sells the bread in the following order: firstly, he sells the loaves that were baked that morning; secondly, he sells the loaves that were baked the day before and weren't sold yet; then the loaves that were baked two days before and weren't sold yet, and so on. That's why some customers may buy a rather stale bread and will definitely spread negative rumors. Let's define loaf spoilage as the difference between the day it was baked and the day it was sold. Then the unattractiveness of the bakery will be equal to the maximum spoilage among all loaves of bread baked at the bakery. Suppose Monocarp's local area has consumer demand equal to k , it means that each day k customers will come to the bakery and each of them will ask for one loaf of bread (the loaves are sold according to the aforementioned order). If there is no bread left, then the person just doesn't buy anything. During the last day sale, all the remaining loaves will be sold (and they will still count in the calculation of the unattractiveness). Monocarp analyzed his competitors' data and came up with m possible consumer demand values k_1, k_2, ... , k_m , and now he'd like to calculate the unattractiveness of the bakery for each value of demand. Can you help him? The first line contains two integers n and m ( 1 <= n <= 2 cdot 10^5 ; 1 <= m <= 2 cdot 10^5 ) -- the number of days the bakery is open and the number of possible values of consumer demand. The second line contains n integ"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
102315439 |
251 jiangly MiFaFaOvO |
B |
Dec. 25, 2020, 1:16 p.m. |
OK |
GNU C++11 |
TESTS |
56 |
202 |
10342400 |
|
|
102360358 |
Grice |
B |
Dec. 26, 2020, 1:55 a.m. |
OK |
GNU C++11 |
TESTS |
56 |
390 |
64204800 |
|
|
102316192 |
Isonan LJC00118 mocania |
B |
Dec. 25, 2020, 1:22 p.m. |
OK |
GNU C++11 |
TESTS |
56 |
483 |
69017600 |
|
|
102331347 |
C20191629 TiwAirOAO |
B |
Dec. 25, 2020, 3:27 p.m. |
OK |
GNU C++11 |
TESTS |
56 |
498 |
38502400 |
|
|
102335637 |
dengyipeng jz_597 gmh77 |
B |
Dec. 25, 2020, 4:08 p.m. |
OK |
GNU C++11 |
TESTS |
56 |
701 |
101478400 |
|
|
102350372 |
gisp_zjz |
B |
Dec. 25, 2020, 7:59 p.m. |
OK |
GNU C++17 |
TESTS |
56 |
296 |
21094400 |
|
|
102349946 |
sh1194 |
B |
Dec. 25, 2020, 7:52 p.m. |
OK |
GNU C++17 |
TESTS |
56 |
436 |
32256000 |
|
|
102335499 |
Atreus Shayan.P |
B |
Dec. 25, 2020, 4:06 p.m. |
OK |
GNU C++17 |
TESTS |
56 |
482 |
32256000 |
|
|
102348215 |
thanhan |
B |
Dec. 25, 2020, 7:22 p.m. |
OK |
GNU C++17 |
TESTS |
56 |
811 |
10444800 |
|
|
102342082 |
Sk_kr |
B |
Dec. 25, 2020, 5:54 p.m. |
OK |
GNU C++17 |
TESTS |
56 |
1606 |
122880000 |
|
|
102337802 |
Rubikun kort0n risujiroh |
B |
Dec. 25, 2020, 4:34 p.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
140 |
17920000 |
|
|
102342634 |
.I. |
B |
Dec. 25, 2020, 6:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
265 |
24166400 |
|
|
102318334 |
ainta |
B |
Dec. 25, 2020, 1:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
311 |
42803200 |
|
|
102321498 |
QAQAutoMaton PinkRabbit |
B |
Dec. 25, 2020, 2:06 p.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
343 |
31539200 |
|
|
102329437 |
tempura0224 yamunaku heno239 |
B |
Dec. 25, 2020, 3:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
576 |
28160000 |
|
|
102335958 |
kotatsugame |
B |
Dec. 25, 2020, 4:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
592 |
39628800 |
|
|
102333135 |
kefaa2 Fedosik |
B |
Dec. 25, 2020, 3:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
717 |
33689600 |
|
|
102326567 |
tourist |
B |
Dec. 25, 2020, 2:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
1138 |
141619200 |
|
|
102293596 |
|
B |
Dec. 25, 2020, 9:38 a.m. |
OK |
Unknown |
TESTS |
0 |
0 |
0 |
|
|
remove filters
Back to search problems