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"Vasya wants to buy himself a nice new car. Unfortunately, he lacks some money. Currently he has exactly 0 burles. However, the local bank has n credit offers. Each offer can be described with three numbers a_i , b_i and k_i . Offers are numbered from 1 to n . If Vasya takes the i -th offer, then the bank gives him a_i burles at the beginning of the month and then Vasya pays bank b_i burles at the end of each month for the next k_i months (including the month he activated the offer). Vasya can take the offers any order he wants. Each month Vasya can take no more than one credit offer. Also each credit offer can not be used more than once. Several credits can be active at the same time. It implies that Vasya pays bank the sum of b_i over all the i of active credits at the end of each month. Vasya wants to buy a car in the middle of some month. He just takes all the money he currently has and buys the car of that exact price. Vasya don't really care what he'll have to pay the bank back after he buys a car. He just goes out of the country on his car so that the bank can't find him anymore. What is the maximum price that car can have? The first line contains one integer n ( 1 <= n <= 500 ) -- the number of credit offers. Each of the next n lines contains three integers a_i , b_i and k_i ( 1 <= a_i, b_i, k_i <= 10^9 ). Print one integer -- the maximum price of the car. In the first example, the following sequence of offers taken is optimal: 4 rightarrow 3. The amount of burles Vasya has changes the following way: 5 rightarrow 32 rightarrow -86 rightarrow .... He takes the money he has in the middle of the second month (32 burles) and buys the car. The negative amount of money means that Vasya has to pay the bank that amount of burles. In the second example, the following sequence of offers taken is optimal: 3 rightarrow$$"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
49071708 |
rainboy |
F |
Jan. 27, 2019, 9:28 p.m. |
OK |
GNU C11 |
TESTS |
51 |
31 |
0 |
|
2700 |
49357268 |
zstu_MingSD |
F |
Feb. 2, 2019, 11:46 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
30 |
2457600 |
|
2700 |
57867255 |
lopare |
F |
July 27, 2019, 10:04 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
2700 |
57711014 |
py_ultron |
F |
July 24, 2019, 11:47 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
2700 |
54262094 |
fwl |
F |
May 17, 2019, 2:50 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
2700 |
52526305 |
cschenshuo |
F |
April 9, 2019, 11:37 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
2700 |
52346851 |
yltx |
F |
April 5, 2019, 1:02 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
2700 |
51566163 |
code_struck |
F |
March 20, 2019, 9:48 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
2700 |
50088242 |
hangyesheng |
F |
Feb. 18, 2019, 8:47 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
2700 |
50056055 |
Atlantis592 |
F |
Feb. 17, 2019, 10:23 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
2700 |
63519848 |
luogu_bot2 |
F |
Oct. 27, 2019, 3:12 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
31 |
0 |
|
2700 |
49891724 |
deja-vu |
F |
Feb. 14, 2019, 4:21 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
30 |
0 |
|
2700 |
49062483 |
AndreiCotor |
F |
Jan. 27, 2019, 4:05 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
30 |
0 |
|
2700 |
61349393 |
Jiburiru |
F |
Sept. 27, 2019, 7:15 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
30 |
0 |
|
2700 |
49178150 |
krijgertje |
F |
Jan. 29, 2019, 10:29 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
30 |
2048000 |
|
2700 |
49028626 |
---------- |
F |
Jan. 26, 2019, 8:28 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
30 |
2048000 |
|
2700 |
58899770 |
1970966462 |
F |
Aug. 16, 2019, 8:46 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
30 |
2048000 |
|
2700 |
61349346 |
Jiburiru |
F |
Sept. 27, 2019, 7:13 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
2700 |
61349323 |
Jiburiru |
F |
Sept. 27, 2019, 7:12 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
2700 |
61006701 |
shifanyiakioi |
F |
Sept. 21, 2019, 11:20 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
2700 |
65910779 |
yan-zp |
F |
Nov. 28, 2019, 12:50 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
31 |
0 |
|
2700 |
49366532 |
Minnakhmetov |
F |
Feb. 2, 2019, 3:18 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
15 |
2457600 |
|
2700 |
50097261 |
InFiNiTeemo |
F |
Feb. 18, 2019, 1:17 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
30 |
0 |
|
2700 |
50608722 |
amnesiac_dusk |
F |
Feb. 28, 2019, 3:50 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
30 |
2150400 |
|
2700 |
49485783 |
aurinegro |
F |
Feb. 5, 2019, 5:32 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
30 |
2764800 |
|
2700 |
51483972 |
sheaf |
F |
March 19, 2019, 12:47 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
2700 |
51427768 |
sheaf |
F |
March 17, 2019, 8:31 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
2700 |
50636909 |
clones0306 |
F |
March 1, 2019, 12:13 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
2700 |
50406822 |
lmiskiew |
F |
Feb. 23, 2019, 9:27 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
2700 |
60339970 |
Leonidas |
F |
Sept. 10, 2019, 10:21 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
0 |
|
2700 |
49660070 |
Taam |
F |
Feb. 9, 2019, 11:59 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
31 |
307200 |
|
2700 |
49156111 |
xodiac |
F |
Jan. 29, 2019, 1:48 p.m. |
OK |
Java 8 |
TESTS |
51 |
109 |
0 |
|
2700 |
49183199 |
Ahmad |
F |
Jan. 30, 2019, 3:46 a.m. |
OK |
Java 8 |
TESTS |
51 |
155 |
0 |
|
2700 |
49071707 |
Dukkha |
F |
Jan. 27, 2019, 9:28 p.m. |
OK |
Java 8 |
TESTS |
51 |
171 |
0 |
|
2700 |
66540149 |
dalt |
F |
Dec. 9, 2019, 11:11 a.m. |
OK |
Java 8 |
TESTS |
51 |
171 |
19865600 |
|
2700 |
49136085 |
llamaoo7 |
F |
Jan. 29, 2019, 7:43 a.m. |
OK |
Java 8 |
TESTS |
51 |
686 |
0 |
|
2700 |
49363317 |
selpo |
F |
Feb. 2, 2019, 1:53 p.m. |
OK |
Mono C# |
TESTS |
51 |
967 |
8294400 |
|
2700 |
49042620 |
dyxx |
F |
Jan. 27, 2019, 7:12 a.m. |
OK |
MS C++ |
TESTS |
51 |
31 |
0 |
|
2700 |
59199595 |
1970966462 |
F |
Aug. 21, 2019, 3:50 a.m. |
OK |
MS C++ |
TESTS |
51 |
514 |
2150400 |
|
2700 |
59199573 |
dreamal |
F |
Aug. 21, 2019, 3:49 a.m. |
OK |
MS C++ 2017 |
TESTS |
51 |
529 |
2150400 |
|
2700 |
49116242 |
Bovniova |
F |
Jan. 28, 2019, 5:04 p.m. |
OK |
PyPy 3 |
TESTS |
51 |
311 |
15564800 |
|
2700 |
49193731 |
lunjia |
F |
Jan. 30, 2019, 9:23 a.m. |
OK |
Python 3 |
TESTS |
51 |
405 |
2048000 |
|
2700 |
49112384 |
meooow |
F |
Jan. 28, 2019, 3:29 p.m. |
OK |
Python 3 |
TESTS |
51 |
545 |
7782400 |
|
2700 |
remove filters
Back to search problems