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'Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job. The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than c liters. Adilbek has already poured c_0 liters of water into the system. He is going to start watering the garden right now and water it for m minutes, and the watering system should contain at least one liter of water at the beginning of the i -th minute (for every i from 0 to m - 1 ). Now Adilbek wonders what he will do if the watering system runs out of water. He called n his friends and asked them if they are going to bring some water. The i -th friend answered that he can bring no more than a_i liters of water; he will arrive at the beginning of the t_i -th minute and pour all the water he has into the system (if the system cannot hold such amount of water, the excess water is poured out); and then he will ask Adilbek to pay b_i dollars for each liter of water he has brought. You may assume that if a friend arrives at the beginning of the t_i -th minute and the system runs out of water at the beginning of the same minute, the friend pours his water fast enough so that the system does not stop working. Of course, Adilbek does not want to pay his friends, but he has to water the garden. So he has to tell his friends how much water should they bring. Formally, Adilbek wants to choose n integers k_1 , k_2 , ..., k_n in such a way that: Help Adilbek to determine the minimum amount he has to pay his friends or determine that Adilbek not able to water the garden for m minutes. You have to answer q independent queries. The first line contains one integer q ( 1 <= q <= 5 cdot 10^5 ) xe2 x80 x93 the number of queries. The first line of each quer'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
62151468 |
rainboy |
G |
Oct. 8, 2019, 4:32 p.m. |
OK |
GNU C11 |
TESTS |
37 |
608 |
22630400 |
|
2700 |
62151715 |
kmjp |
G |
Oct. 8, 2019, 4:34 p.m. |
OK |
GNU C++14 |
TESTS |
37 |
623 |
30003200 |
|
2700 |
62135757 |
NotNight |
G |
Oct. 8, 2019, 3:26 p.m. |
OK |
GNU C++14 |
TESTS |
37 |
639 |
12185600 |
|
2700 |
62147276 |
atoiz |
G |
Oct. 8, 2019, 4:12 p.m. |
OK |
GNU C++14 |
TESTS |
37 |
748 |
6144000 |
|
2700 |
62147923 |
Motarack |
G |
Oct. 8, 2019, 4:15 p.m. |
OK |
GNU C++14 |
TESTS |
37 |
966 |
48537600 |
|
2700 |
62148377 |
HIR180 |
G |
Oct. 8, 2019, 4:18 p.m. |
OK |
GNU C++14 |
TESTS |
37 |
1341 |
56832000 |
|
2700 |
62154025 |
user202729_ |
G |
Oct. 8, 2019, 4:45 p.m. |
OK |
GNU C++17 |
TESTS |
37 |
545 |
6144000 |
|
2700 |
62153961 |
boboniu |
G |
Oct. 8, 2019, 4:45 p.m. |
OK |
GNU C++17 |
TESTS |
37 |
577 |
18534400 |
|
2700 |
62150450 |
Lawali |
G |
Oct. 8, 2019, 4:28 p.m. |
OK |
GNU C++17 |
TESTS |
37 |
623 |
18022400 |
|
2700 |
62146428 |
sigma425 |
G |
Oct. 8, 2019, 4:08 p.m. |
OK |
GNU C++17 |
TESTS |
37 |
654 |
18944000 |
|
2700 |
62148994 |
stasio6 |
G |
Oct. 8, 2019, 4:21 p.m. |
OK |
GNU C++17 |
TESTS |
37 |
670 |
29593600 |
|
2700 |
62152430 |
jiangly |
G |
Oct. 8, 2019, 4:37 p.m. |
OK |
GNU C++17 |
TESTS |
37 |
873 |
33894400 |
|
2700 |
62153399 |
cerberus97 |
G |
Oct. 8, 2019, 4:42 p.m. |
OK |
GNU C++17 |
TESTS |
37 |
951 |
30412800 |
|
2700 |
62150345 |
9623 |
G |
Oct. 8, 2019, 4:27 p.m. |
OK |
GNU C++17 |
TESTS |
37 |
1419 |
18739200 |
|
2700 |
remove filters
Back to search problems