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"There are n cities along the road, which can be represented as a straight line. The i -th city is situated at the distance of a_i kilometers from the origin. All cities are situated in the same direction from the origin. There are m trucks travelling from one city to another. Each truck can be described by 4 integers: starting city s_i , finishing city f_i , fuel consumption c_i and number of possible refuelings r_i . The i -th truck will spend c_i litres of fuel per one kilometer. When a truck arrives in some city, it can be refueled (but refueling is impossible in the middle of nowhere). The i -th truck can be refueled at most r_i times. Each refueling makes truck's gas-tank full. All trucks start with full gas-tank. All trucks will have gas-tanks of the same size V litres. You should find minimum possible V such that all trucks can reach their destinations without refueling more times than allowed. First line contains two integers n and m ( 2 <= n <= 400 , 1 <= m <= 250000 ) -- the number of cities and trucks. The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 , a_i < a_{i+1} ) -- positions of cities in the ascending order. Next m lines contains 4 integers each. The i -th line contains integers s_i , f_i , c_i , r_i ( 1 <= s_i < f_i <= n , 1 <= c_i <= 10^9 , 0 <= r_i <= n ) -- the description of the i -th truck. Print the only integer -- minimum possible size of gas-tanks V such that all trucks can reach their destinations. Let's look at queries in details: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
48308854 |
rainboy |
F |
Jan. 12, 2019, 10:21 p.m. |
OK |
GNU C11 |
TESTS |
47 |
233 |
6348800 |
|
2500 |
48436838 |
Shimatsukaze |
F |
Jan. 15, 2019, 9:17 p.m. |
OK |
GNU C11 |
TESTS |
47 |
358 |
264294400 |
|
2500 |
68871198 |
tyler178 |
F |
Jan. 15, 2020, 3:16 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
93 |
7065600 |
|
2500 |
53218457 |
Scut82 |
F |
April 24, 2019, 10:29 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
109 |
263475200 |
|
2500 |
48654278 |
ReaLNero1 |
F |
Jan. 21, 2019, 1:26 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
124 |
4198400 |
|
2500 |
48304247 |
Riqirez |
F |
Jan. 12, 2019, 6:42 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
124 |
4198400 |
|
2500 |
48272872 |
mmmod_lqs |
F |
Jan. 12, 2019, 3:44 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
124 |
26931200 |
|
2500 |
53218456 |
Scut82 |
F |
April 24, 2019, 10:29 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
124 |
263475200 |
|
2500 |
65576892 |
SuperFF |
F |
Nov. 23, 2019, 9:40 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
140 |
12595200 |
|
2500 |
49484521 |
lkmcfj |
F |
Feb. 5, 2019, 4:07 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
186 |
6144000 |
|
2500 |
49984118 |
cnyalilk |
F |
Feb. 16, 2019, 9:42 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
187 |
18534400 |
|
2500 |
55224461 |
DQS |
F |
June 6, 2019, 11:14 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
187 |
24678400 |
|
2500 |
48366617 |
neal |
F |
Jan. 13, 2019, 10:58 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
124 |
9523200 |
|
2500 |
48318574 |
neal |
F |
Jan. 13, 2019, 8 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
202 |
4096000 |
|
2500 |
48318696 |
neal |
F |
Jan. 13, 2019, 8:03 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
202 |
4096000 |
|
2500 |
48295348 |
antguz |
F |
Jan. 12, 2019, 2:21 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
234 |
7372800 |
|
2500 |
53273950 |
Samaritan123 |
F |
April 25, 2019, 8:15 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
234 |
7884800 |
|
2500 |
51324685 |
NotNight |
F |
March 15, 2019, 9:07 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
249 |
7168000 |
|
2500 |
48312326 |
n_dao107 |
F |
Jan. 13, 2019, 3:32 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
249 |
7884800 |
|
2500 |
48318920 |
neal |
F |
Jan. 13, 2019, 8:09 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
264 |
4096000 |
|
2500 |
54576817 |
Jubair_2147483647 |
F |
May 25, 2019, 12:05 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
265 |
7884800 |
|
2500 |
48911925 |
wcl95716 |
F |
Jan. 25, 2019, 2:51 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
280 |
7884800 |
|
2500 |
61963732 |
disposrestfuIly |
F |
Oct. 6, 2019, 8:15 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
171 |
14540800 |
|
2500 |
50083134 |
Ray_ |
F |
Feb. 18, 2019, 5:49 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
218 |
7884800 |
|
2500 |
50084277 |
Ray_ |
F |
Feb. 18, 2019, 6:32 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
233 |
7884800 |
|
2500 |
48299603 |
3multid |
F |
Jan. 12, 2019, 4:14 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
249 |
4300800 |
|
2500 |
58264341 |
wvuvw |
F |
Aug. 4, 2019, 1:49 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
265 |
5632000 |
|
2500 |
49911487 |
Silly_Bee |
F |
Feb. 14, 2019, 2:23 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
265 |
6041600 |
|
2500 |
50525486 |
aakk |
F |
Feb. 26, 2019, 11:36 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
265 |
7884800 |
|
2500 |
50525459 |
aakk |
F |
Feb. 26, 2019, 11:35 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
265 |
7884800 |
|
2500 |
50525446 |
aakk |
F |
Feb. 26, 2019, 11:34 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
280 |
7884800 |
|
2500 |
49237729 |
Stiff_Subset |
F |
Jan. 31, 2019, 8:51 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
295 |
136294400 |
|
2500 |
66627188 |
dalt |
F |
Dec. 11, 2019, 9:35 a.m. |
OK |
Java 8 |
TESTS |
47 |
623 |
47411200 |
|
2500 |
48308866 |
Dukkha |
F |
Jan. 12, 2019, 10:22 p.m. |
OK |
Java 8 |
TESTS |
47 |
670 |
4403200 |
|
2500 |
48276219 |
wery0 |
F |
Jan. 12, 2019, 5:50 a.m. |
OK |
Java 8 |
TESTS |
47 |
717 |
11161600 |
|
2500 |
48470158 |
Psylocke |
F |
Jan. 16, 2019, 7:39 p.m. |
OK |
Java 8 |
TESTS |
47 |
763 |
3788800 |
|
2500 |
48463278 |
serezqa |
F |
Jan. 16, 2019, 3:51 p.m. |
OK |
Java 8 |
TESTS |
47 |
826 |
13926400 |
|
2500 |
48374808 |
xodiac |
F |
Jan. 14, 2019, 7 a.m. |
OK |
Java 8 |
TESTS |
47 |
920 |
2867200 |
|
2500 |
48377628 |
niteshgowda |
F |
Jan. 14, 2019, 8:32 a.m. |
OK |
Java 8 |
TESTS |
47 |
951 |
819200 |
|
2500 |
48784598 |
just_soso |
F |
Jan. 23, 2019, 8:22 a.m. |
OK |
Java 8 |
TESTS |
47 |
1653 |
259379200 |
|
2500 |
48361521 |
mikkk |
F |
Jan. 13, 2019, 6:51 p.m. |
OK |
Java 8 |
TESTS |
47 |
1996 |
258867200 |
|
2500 |
64501400 |
Spheniscine |
F |
Nov. 8, 2019, 4:26 a.m. |
OK |
Kotlin |
TESTS |
47 |
717 |
6041600 |
|
2500 |
remove filters
Back to search problems