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 located along the one-way road. Cities are numbered from 1 to n in the direction of the road. The i-th city had produced pi units of goods. No more than si units of goods can be sold in the i-th city. For each pair of cities i and j such that 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89i xe2 x80 x89< xe2 x80 x89j xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n you can no more than once transport no more than c units of goods from the city i to the city j. Note that goods can only be transported from a city with a lesser index to the city with a larger index. You can transport goods between cities in any order. Determine the maximum number of produced goods that can be sold in total in all the cities after a sequence of transportations. The first line of the input contains two integers n and c (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x8910 xe2 x80 x89000, 0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89c xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- the number of cities and the maximum amount of goods for a single transportation. The second line contains n integers pi (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89pi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- the number of units of goods that were produced in each city. The third line of input contains n integers si (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89si xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- the number of units of goods that can be sold in each city. Print the maximum total number of produced goods that can be sold in all cities after a sequence of transportations. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
21315944 |
aspi |
E |
Oct. 9, 2016, 10:49 a.m. |
OK |
FPC |
TESTS |
106 |
873 |
1945600 |
|
2900 |
21315728 |
llgyc |
E |
Oct. 9, 2016, 10:39 a.m. |
OK |
FPC |
TESTS |
106 |
873 |
1945600 |
|
2900 |
21315767 |
llgyc |
E |
Oct. 9, 2016, 10:40 a.m. |
OK |
FPC |
TESTS |
106 |
1014 |
1843200 |
|
2900 |
21384312 |
chirs241097 |
E |
Oct. 12, 2016, 2:35 p.m. |
OK |
GNU C |
TESTS |
106 |
655 |
5120000 |
|
2900 |
25235060 |
sduhuhao |
E |
March 5, 2017, 7:08 a.m. |
OK |
GNU C++ |
TESTS |
106 |
15 |
2764800 |
|
2900 |
25234782 |
sduhuhao |
E |
March 5, 2017, 6:56 a.m. |
OK |
GNU C++ |
TESTS |
106 |
15 |
3686400 |
|
2900 |
23693112 |
vjudge3 |
E |
Jan. 11, 2017, 7:30 a.m. |
OK |
GNU C++ |
TESTS |
106 |
187 |
2355200 |
|
2900 |
21632302 |
2020.01.09_Restart |
E |
Oct. 21, 2016, 3:51 a.m. |
OK |
GNU C++ |
TESTS |
106 |
202 |
204800 |
|
2900 |
33497112 |
vjudge2 |
E |
Dec. 22, 2017, 7:23 a.m. |
OK |
GNU C++ |
TESTS |
106 |
202 |
2048000 |
|
2900 |
29158337 |
vjudge1 |
E |
Aug. 3, 2017, 2:53 p.m. |
OK |
GNU C++ |
TESTS |
106 |
202 |
2048000 |
|
2900 |
25702594 |
vjudge2 |
E |
March 22, 2017, 2:33 a.m. |
OK |
GNU C++ |
TESTS |
106 |
202 |
2048000 |
|
2900 |
34072667 |
vjudge5 |
E |
Jan. 10, 2018, 4:01 p.m. |
OK |
GNU C++ |
TESTS |
106 |
202 |
2252800 |
|
2900 |
25702588 |
cccccxyxy13f |
E |
March 22, 2017, 2:33 a.m. |
OK |
GNU C++ |
TESTS |
106 |
202 |
2252800 |
|
2900 |
28430506 |
vjudge3 |
E |
July 11, 2017, 4:12 p.m. |
OK |
GNU C++ |
TESTS |
106 |
202 |
3481600 |
|
2900 |
22029110 |
waterfalls |
E |
Nov. 4, 2016, 7:39 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
15 |
307200 |
|
2900 |
23935134 |
darry140 |
E |
Jan. 19, 2017, 3:46 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
15 |
2355200 |
|
2900 |
25309849 |
SGZW |
E |
March 7, 2017, 8 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
15 |
3686400 |
|
2900 |
27615163 |
Light_Kiss |
E |
June 6, 2017, 1:40 p.m. |
OK |
GNU C++11 |
TESTS |
106 |
30 |
102400 |
|
2900 |
22366677 |
lzw4896s |
E |
Nov. 20, 2016, 2:50 p.m. |
OK |
GNU C++11 |
TESTS |
106 |
31 |
409600 |
|
2900 |
22279513 |
light_y |
E |
Nov. 17, 2016, 2:39 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
31 |
819200 |
|
2900 |
23912177 |
Charles_Han |
E |
Jan. 18, 2017, 12:31 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
31 |
2252800 |
|
2900 |
45162236 |
AutumnKite |
E |
Nov. 1, 2018, 9:40 a.m. |
OK |
GNU C++11 |
TESTS |
106 |
31 |
7782400 |
|
2900 |
45056119 |
yukuai26 |
E |
Oct. 29, 2018, 12:47 p.m. |
OK |
GNU C++11 |
TESTS |
106 |
31 |
12083200 |
|
2900 |
44495197 |
yasugongshang |
E |
Oct. 18, 2018, 4:27 p.m. |
OK |
GNU C++11 |
TESTS |
106 |
46 |
102400 |
|
2900 |
27938430 |
Not_A_SingleDogQrz |
E |
June 21, 2017, 6:23 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
15 |
2252800 |
|
2900 |
23608572 |
Shik |
E |
Jan. 6, 2017, 5:33 p.m. |
OK |
GNU C++14 |
TESTS |
106 |
30 |
2150400 |
|
2900 |
23373635 |
Ali.Pi |
E |
Dec. 28, 2016, 8:36 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
30 |
2252800 |
|
2900 |
21622504 |
HackerTina |
E |
Oct. 20, 2016, 4:08 p.m. |
OK |
GNU C++14 |
TESTS |
106 |
31 |
1228800 |
|
2900 |
25286666 |
Fluctuation |
E |
March 6, 2017, 8:52 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
31 |
3481600 |
|
2900 |
42050290 |
fcgyk |
E |
Aug. 24, 2018, 4:08 p.m. |
OK |
GNU C++14 |
TESTS |
106 |
61 |
102400 |
|
2900 |
68848035 |
MakeSPGreatAgain |
E |
Jan. 15, 2020, 8:02 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
186 |
409600 |
|
2900 |
47887538 |
KhaledKEE |
E |
Jan. 4, 2019, 2:02 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
187 |
307200 |
|
2900 |
61896531 |
melancholic_fat_otaku |
E |
Oct. 5, 2019, 7:24 a.m. |
OK |
GNU C++14 |
TESTS |
106 |
202 |
204800 |
|
2900 |
41729012 |
laderlappen |
E |
Aug. 17, 2018, 8:31 p.m. |
OK |
GNU C++14 |
TESTS |
106 |
202 |
307200 |
|
2900 |
53659588 |
Kmcode |
E |
May 2, 2019, 6:57 a.m. |
OK |
GNU C++17 |
TESTS |
106 |
31 |
614400 |
|
2900 |
53959447 |
_Javohir_ |
E |
May 10, 2019, 1:24 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
46 |
204800 |
|
2900 |
62775903 |
vjudge1 |
E |
Oct. 17, 2019, 11:41 a.m. |
OK |
GNU C++17 |
TESTS |
106 |
187 |
204800 |
|
2900 |
53283576 |
gubeiqg |
E |
April 25, 2019, 1 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
217 |
307200 |
|
2900 |
69842336 |
krazy ZXyang HeRaNO |
E |
Jan. 30, 2020, 1:29 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
233 |
204800 |
|
2900 |
55106900 |
maxnguyen |
E |
June 5, 2019, 3:32 a.m. |
OK |
GNU C++17 |
TESTS |
106 |
233 |
307200 |
|
2900 |
38625957 |
vjudge4 |
E |
May 26, 2018, 6:51 a.m. |
OK |
GNU C++17 |
TESTS |
106 |
234 |
204800 |
|
2900 |
61510591 |
-is-this-fft- |
E |
Sept. 29, 2019, 3:57 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
249 |
307200 |
|
2900 |
49846895 |
darkkcyan |
E |
Feb. 12, 2019, 10:38 p.m. |
OK |
GNU C++17 |
TESTS |
106 |
249 |
3276800 |
|
2900 |
69604936 |
hjk1030 |
E |
Jan. 27, 2020, 9:22 a.m. |
OK |
GNU C++17 |
TESTS |
106 |
265 |
204800 |
|
2900 |
23523727 |
muravjov |
E |
Jan. 3, 2017, 8:03 p.m. |
OK |
Go |
TESTS |
106 |
529 |
24166400 |
|
2900 |
23522959 |
muravjov |
E |
Jan. 3, 2017, 7:06 p.m. |
OK |
Go |
TESTS |
106 |
608 |
24166400 |
|
2900 |
32003091 |
Scut82 |
E |
Nov. 3, 2017, 9:29 a.m. |
OK |
Java 8 |
TESTS |
106 |
514 |
0 |
|
2900 |
22703287 |
hama-du |
E |
Dec. 5, 2016, 12:53 a.m. |
OK |
Java 8 |
TESTS |
106 |
826 |
0 |
|
2900 |
22716988 |
uwi |
E |
Dec. 5, 2016, 5:55 p.m. |
OK |
Java 8 |
TESTS |
106 |
873 |
0 |
|
2900 |
21384075 |
gopikrishna_p |
E |
Oct. 12, 2016, 2:26 p.m. |
OK |
Java 8 |
TESTS |
106 |
920 |
21094400 |
|
2900 |
21293366 |
eatmore |
E |
Oct. 8, 2016, 2:22 p.m. |
OK |
Java 8 |
TESTS |
106 |
951 |
20377600 |
|
2900 |
21315666 |
Sumeet.Varma |
E |
Oct. 9, 2016, 10:36 a.m. |
OK |
Java 8 |
TESTS |
106 |
966 |
20480000 |
|
2900 |
36062416 |
wrrnzkieee |
E |
March 8, 2018, 6:25 a.m. |
OK |
Java 8 |
TESTS |
106 |
1153 |
20787200 |
|
2900 |
21325865 |
Augustynn |
E |
Oct. 9, 2016, 7:35 p.m. |
OK |
Java 8 |
TESTS |
106 |
1216 |
20582400 |
|
2900 |
21507001 |
totsamyzed |
E |
Oct. 16, 2016, 8:57 p.m. |
OK |
Java 8 |
TESTS |
106 |
1231 |
20480000 |
|
2900 |
53287055 |
xpray |
E |
April 25, 2019, 2:16 p.m. |
OK |
Java 8 |
TESTS |
106 |
1341 |
0 |
|
2900 |
22732362 |
eitaho |
E |
Dec. 6, 2016, 2:24 p.m. |
OK |
Mono C# |
TESTS |
106 |
77 |
4915200 |
|
2900 |
21435828 |
chirs241097 |
E |
Oct. 15, 2016, 2:56 a.m. |
OK |
Mono C# |
TESTS |
106 |
436 |
11468800 |
|
2900 |
22730725 |
eitaho |
E |
Dec. 6, 2016, 1:02 p.m. |
OK |
Mono C# |
TESTS |
106 |
545 |
4915200 |
|
2900 |
21435815 |
chirs241097 |
E |
Oct. 15, 2016, 2:54 a.m. |
OK |
MS C# |
TESTS |
106 |
436 |
11468800 |
|
2900 |
48057314 |
vjudge3 |
E |
Jan. 7, 2019, 1:03 p.m. |
OK |
MS C++ |
TESTS |
106 |
280 |
204800 |
|
2900 |
57620151 |
vjudge3 |
E |
July 24, 2019, 4:07 a.m. |
OK |
MS C++ |
TESTS |
106 |
280 |
307200 |
|
2900 |
21310682 |
noxwell |
E |
Oct. 9, 2016, 6:22 a.m. |
OK |
MS C++ |
TESTS |
106 |
327 |
2355200 |
|
2900 |
21349473 |
Carups |
E |
Oct. 11, 2016, 2:20 a.m. |
OK |
MS C++ |
TESTS |
106 |
358 |
2252800 |
|
2900 |
21400048 |
guoshiyuan484 |
E |
Oct. 13, 2016, 9:54 a.m. |
OK |
MS C++ |
TESTS |
106 |
436 |
2355200 |
|
2900 |
21355260 |
katan |
E |
Oct. 11, 2016, 9:58 a.m. |
OK |
MS C++ |
TESTS |
106 |
483 |
2355200 |
|
2900 |
21292912 |
Michael |
E |
Oct. 8, 2016, 2:16 p.m. |
OK |
MS C++ |
TESTS |
106 |
608 |
2252800 |
|
2900 |
remove filters
Back to search problems