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'The only difference between easy and hard versions is the constraints. Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of n consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the i -th picture has beauty a_i . Vova wants to repost exactly x pictures in such a way that: For example, if k=1 then Vova has to repost all the pictures in the news feed. If k=2 then Vova can skip some pictures, but between every pair of consecutive pictures Vova has to repost at least one of them. Your task is to calculate the maximum possible sum of values of reposted pictures if Vova follows conditions described above, or say that there is no way to satisfy all conditions. The first line of the input contains three integers n, k and x ( 1 <= k, x <= n <= 5000 ) -- the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 ), where a_i is the beauty of the i -th picture. Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer -- the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
48657199 |
ReaLNero1 |
F2 |
Jan. 21, 2019, 3:35 a.m. |
OK |
GNU C++11 |
TESTS |
70 |
31 |
102400 |
|
2300 |
47722337 |
ezsyshx |
F2 |
Dec. 30, 2018, 12:07 p.m. |
OK |
GNU C++11 |
TESTS |
70 |
124 |
204800 |
|
2300 |
50298823 |
tnowakow |
F2 |
Feb. 21, 2019, 11:47 p.m. |
OK |
GNU C++11 |
TESTS |
70 |
140 |
3174400 |
|
2300 |
47489530 |
cheetose |
F2 |
Dec. 25, 2018, 11:14 a.m. |
OK |
GNU C++11 |
TESTS |
70 |
140 |
3276800 |
|
2300 |
46648432 |
TheDa |
F2 |
Dec. 5, 2018, 12:54 p.m. |
OK |
GNU C++11 |
TESTS |
70 |
140 |
200908800 |
|
2300 |
46098373 |
CrazyTeaMajor |
F2 |
Nov. 23, 2018, 3:06 a.m. |
OK |
GNU C++11 |
TESTS |
70 |
140 |
306483200 |
|
2300 |
46230168 |
shoron212 |
F2 |
Nov. 25, 2018, 8:21 p.m. |
OK |
GNU C++11 |
TESTS |
70 |
155 |
200806400 |
|
2300 |
46364585 |
vjudge3 |
F2 |
Nov. 29, 2018, 12:40 p.m. |
OK |
GNU C++11 |
TESTS |
70 |
156 |
102400 |
|
2300 |
47722138 |
ezsyshx |
F2 |
Dec. 30, 2018, noon |
OK |
GNU C++11 |
TESTS |
70 |
171 |
200601600 |
|
2300 |
46096867 |
fwat |
F2 |
Nov. 23, 2018, 1:24 a.m. |
OK |
GNU C++11 |
TESTS |
70 |
186 |
102400 |
|
2300 |
49820125 |
aryanv |
F2 |
Feb. 12, 2019, 8:23 a.m. |
OK |
GNU C++14 |
TESTS |
70 |
139 |
102400 |
|
2300 |
47953740 |
vjudge4 |
F2 |
Jan. 5, 2019, 4:12 a.m. |
OK |
GNU C++14 |
TESTS |
70 |
171 |
102400 |
|
2300 |
47953694 |
toysmars |
F2 |
Jan. 5, 2019, 4:10 a.m. |
OK |
GNU C++14 |
TESTS |
70 |
171 |
102400 |
|
2300 |
51822925 |
RNS_MHB |
F2 |
March 25, 2019, 12:52 p.m. |
OK |
GNU C++14 |
TESTS |
70 |
171 |
204800 |
|
2300 |
46240773 |
Xin-Jie |
F2 |
Nov. 26, 2018, 7:47 a.m. |
OK |
GNU C++14 |
TESTS |
70 |
171 |
409600 |
|
2300 |
47502007 |
TadijaSebez |
F2 |
Dec. 25, 2018, 6:36 p.m. |
OK |
GNU C++14 |
TESTS |
70 |
171 |
3584000 |
|
2300 |
46567805 |
AMnu |
F2 |
Dec. 4, 2018, 2:22 a.m. |
OK |
GNU C++14 |
TESTS |
70 |
187 |
200806400 |
|
2300 |
46011048 |
Bohdanator |
F2 |
Nov. 20, 2018, 8:25 p.m. |
OK |
GNU C++14 |
TESTS |
70 |
202 |
204800 |
|
2300 |
52315828 |
njchung99 |
F2 |
April 4, 2019, 4:58 p.m. |
OK |
GNU C++14 |
TESTS |
70 |
202 |
3379200 |
|
2300 |
47147274 |
TiChuot97 |
F2 |
Dec. 17, 2018, 3:50 a.m. |
OK |
GNU C++14 |
TESTS |
70 |
217 |
307200 |
|
2300 |
54212639 |
vjudge4 |
F2 |
May 15, 2019, 6:05 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
78 |
307200 |
|
2300 |
54212722 |
joaom |
F2 |
May 15, 2019, 6:07 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
93 |
307200 |
|
2300 |
46045200 |
cnjzxy |
F2 |
Nov. 22, 2018, 12:50 a.m. |
OK |
GNU C++17 |
TESTS |
70 |
93 |
3584000 |
|
2300 |
46045147 |
cnjzxy |
F2 |
Nov. 22, 2018, 12:43 a.m. |
OK |
GNU C++17 |
TESTS |
70 |
93 |
204800000 |
|
2300 |
46364421 |
nimphy |
F2 |
Nov. 29, 2018, 12:35 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
140 |
102400 |
|
2300 |
53262701 |
loyolman |
F2 |
April 24, 2019, 9:28 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
140 |
3379200 |
|
2300 |
46024702 |
err0r |
F2 |
Nov. 21, 2018, 10:30 a.m. |
OK |
GNU C++17 |
TESTS |
70 |
155 |
3584000 |
|
2300 |
50063196 |
Pa.Nic |
F2 |
Feb. 17, 2019, 1:36 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
156 |
3379200 |
|
2300 |
46719368 |
xz153531 |
F2 |
Dec. 7, 2018, 12:37 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
156 |
3379200 |
|
2300 |
46718961 |
xz153531 |
F2 |
Dec. 7, 2018, 12:30 p.m. |
OK |
GNU C++17 |
TESTS |
70 |
156 |
3379200 |
|
2300 |
46206915 |
Ahmad |
F2 |
Nov. 25, 2018, 2:53 p.m. |
OK |
Java 8 |
TESTS |
70 |
779 |
261836800 |
|
2300 |
46822040 |
dyhu083 |
F2 |
Dec. 9, 2018, 3:54 p.m. |
OK |
Java 8 |
TESTS |
70 |
1201 |
265830400 |
|
2300 |
46239238 |
Intrincantation |
F2 |
Nov. 26, 2018, 6:32 a.m. |
OK |
Java 8 |
TESTS |
70 |
1216 |
266547200 |
|
2300 |
60370745 |
beginner1010 |
F2 |
Sept. 11, 2019, 1:35 a.m. |
OK |
Java 8 |
TESTS |
70 |
1294 |
0 |
|
2300 |
60370791 |
beginner1010 |
F2 |
Sept. 11, 2019, 1:38 a.m. |
OK |
Java 8 |
TESTS |
70 |
1309 |
0 |
|
2300 |
52762846 |
mikkk |
F2 |
April 14, 2019, 10:46 p.m. |
OK |
Java 8 |
TESTS |
70 |
1372 |
273920000 |
|
2300 |
46453387 |
boltUsain |
F2 |
Dec. 1, 2018, 4:49 p.m. |
OK |
Java 8 |
TESTS |
70 |
1435 |
261222400 |
|
2300 |
46884454 |
javista |
F2 |
Dec. 10, 2018, 9:55 p.m. |
OK |
Java 8 |
TESTS |
70 |
1606 |
0 |
|
2300 |
46882235 |
javista |
F2 |
Dec. 10, 2018, 8:02 p.m. |
OK |
Java 8 |
TESTS |
70 |
1637 |
0 |
|
2300 |
46882275 |
javista |
F2 |
Dec. 10, 2018, 8:03 p.m. |
OK |
Java 8 |
TESTS |
70 |
1700 |
261836800 |
|
2300 |
47215482 |
vjudge1 |
F2 |
Dec. 18, 2018, 3:45 p.m. |
OK |
MS C++ |
TESTS |
70 |
623 |
219852800 |
|
2300 |
56309273 |
vjudge4 |
F2 |
June 30, 2019, 1:50 p.m. |
OK |
MS C++ |
TESTS |
70 |
1122 |
204902400 |
|
2300 |
47808954 |
jernchr11 |
F2 |
Jan. 1, 2019, 9:39 a.m. |
OK |
MS C++ |
TESTS |
70 |
2448 |
482406400 |
|
2300 |
47831768 |
jernchr11 |
F2 |
Jan. 2, 2019, 7:20 a.m. |
OK |
MS C++ |
TESTS |
70 |
2449 |
482406400 |
|
2300 |
47831617 |
jernchr11 |
F2 |
Jan. 2, 2019, 7:13 a.m. |
OK |
MS C++ |
TESTS |
70 |
2449 |
482406400 |
|
2300 |
47832950 |
jernchr11 |
F2 |
Jan. 2, 2019, 8:17 a.m. |
OK |
MS C++ |
TESTS |
70 |
2495 |
482406400 |
|
2300 |
58347448 |
yorky |
F2 |
Aug. 5, 2019, 3:38 p.m. |
OK |
MS C++ 2017 |
TESTS |
70 |
1044 |
297472000 |
|
2300 |
46206909 |
c1729 |
F2 |
Nov. 25, 2018, 2:52 p.m. |
OK |
PyPy 2 |
TESTS |
70 |
264 |
9625600 |
|
2300 |
50885753 |
c1729 |
F2 |
March 6, 2019, 11:14 a.m. |
OK |
PyPy 2 |
TESTS |
70 |
1653 |
9830400 |
|
2300 |
50886234 |
c1729 |
F2 |
March 6, 2019, 11:26 a.m. |
OK |
PyPy 2 |
TESTS |
70 |
1668 |
9830400 |
|
2300 |
46206529 |
meooow |
F2 |
Nov. 25, 2018, 2:38 p.m. |
OK |
PyPy 3 |
TESTS |
70 |
233 |
10035200 |
|
2300 |
46206934 |
c1729 |
F2 |
Nov. 25, 2018, 2:54 p.m. |
OK |
Python 2 |
TESTS |
70 |
343 |
614400 |
|
2300 |
65730050 |
sansen |
F2 |
Nov. 26, 2019, 4:19 a.m. |
OK |
Rust |
TESTS |
70 |
296 |
204800 |
|
2300 |
46252384 |
yakamoto |
F2 |
Nov. 26, 2018, 2:48 p.m. |
OK |
Scala |
TESTS |
70 |
998 |
0 |
|
2300 |
57932417 |
dcordb |
F2 |
July 29, 2019, 9:12 a.m. |
OK |
Scala |
TESTS |
70 |
1013 |
0 |
|
2300 |
57932094 |
dcordb |
F2 |
July 29, 2019, 9:06 a.m. |
OK |
Scala |
TESTS |
70 |
1684 |
204800 |
|
2300 |
57931892 |
dcordb |
F2 |
July 29, 2019, 9:01 a.m. |
OK |
Scala |
TESTS |
70 |
2074 |
204800 |
|
2300 |
46252192 |
yakamoto |
F2 |
Nov. 26, 2018, 2:42 p.m. |
OK |
Scala |
TESTS |
70 |
2386 |
449638400 |
|
2300 |
remove filters
Back to search problems