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"Limak is an old brown bear. He often goes bowling with his friends. Today he feels really good and tries to beat his own record! For rolling a ball one gets a score -- an integer (maybe negative) number of points. Score for i-th roll is multiplied by i and scores are summed up. So, for k rolls with scores s1, xe2 x80 x89s2, xe2 x80 x89..., xe2 x80 x89sk, total score is . Total score is 0 if there were no rolls. Limak made n rolls and got score ai for i-th of them. He wants to maximize his total score and he came up with an interesting idea. He will cancel some rolls, saying that something distracted him or there was a strong wind. Limak is able to cancel any number of rolls, maybe even all or none of them. Total score is calculated as if there were only non-canceled rolls. Look at the sample tests for clarification. What maximum total score can Limak get? The first line contains single integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105). The second line contains n space-separated integers a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an (|ai| xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89107) - scores for Limak's rolls. Print the maximum possible total score after choosing rolls to cancel. In first sample Limak should cancel rolls with scores xe2 x80 x89- xe2 x80 x898 and xe2 x80 x89- xe2 x80 x893. Then he is left with three rolls with scores xe2 x80 x89- xe2 x80 x892, xe2 x80 x890, xe2 x80 x895. Total score is 1 xc2 xb7( xe2 x80 x89- xe2 x80 x892) xe2 x80 x89+ xe2 x80 x892 xc2 xb70 xe2 x80 x89+ xe2 x80 x893 xc2 xb75 xe2 x80 x89= xe2 x80 x8913. In second sample Limak should cancel roll with score xe2 x80 x89- xe2 x80 x8950. Total score is 1 xc2 xb7( xe2 x80 x89- xe2 x80 x8910) xe2 x80 x89+ xe2 x80 x892 xc2 xb720 xe2 x80 x89+ xe2 x80 x893 xc2 xb7( xe2 x80 x89- xe2 x80 x8930) xe2 x80 x89+ xe2 x80 x894 xc2 xb740 xe2 x80 x89+ xe2 x80 x895 xc2 xb760 xe2 x80 x89= xe2 x80 x89400."... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
12868414 |
Bobocan |
E |
Sept. 6, 2015, 11:10 a.m. |
OK |
GNU C |
TESTS |
42 |
31 |
1331200 |
|
3100 |
27837319 |
xzyxzy |
E |
June 17, 2017, 4 a.m. |
OK |
GNU C++ |
TESTS |
42 |
15 |
1331200 |
|
3100 |
28638945 |
jiyutian |
E |
July 17, 2017, 12:14 p.m. |
OK |
GNU C++ |
TESTS |
42 |
15 |
3481600 |
|
3100 |
34265424 |
Scut82 |
E |
Jan. 18, 2018, 3:18 a.m. |
OK |
GNU C++ |
TESTS |
42 |
30 |
3686400 |
|
3100 |
17179326 |
jasonvictoryan |
E |
April 6, 2016, 1:56 a.m. |
OK |
GNU C++ |
TESTS |
42 |
30 |
3788800 |
|
3100 |
27838928 |
MemS |
E |
June 17, 2017, 6:14 a.m. |
OK |
GNU C++ |
TESTS |
42 |
31 |
1331200 |
|
3100 |
16034930 |
Blue_Sky. |
E |
Feb. 15, 2016, 2:51 p.m. |
OK |
GNU C++ |
TESTS |
42 |
31 |
1331200 |
|
3100 |
15142270 |
HappyNewYearMike |
E |
Dec. 31, 2015, 10:14 p.m. |
OK |
GNU C++ |
TESTS |
42 |
31 |
1638400 |
|
3100 |
14127396 |
chalishmaonly |
E |
Nov. 7, 2015, 4:33 p.m. |
OK |
GNU C++ |
TESTS |
42 |
31 |
1638400 |
|
3100 |
16065815 |
-skyline- |
E |
Feb. 17, 2016, 5:07 a.m. |
OK |
GNU C++ |
TESTS |
42 |
31 |
1740800 |
|
3100 |
16065745 |
dreammoon |
E |
Feb. 17, 2016, 5 a.m. |
OK |
GNU C++ |
TESTS |
42 |
31 |
1740800 |
|
3100 |
13715631 |
Mr.Awesome |
E |
Oct. 18, 2015, 3:45 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
31 |
921600 |
|
3100 |
12765804 |
RNS_CUS |
E |
Aug. 29, 2015, 7:27 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
31 |
921600 |
|
3100 |
12829131 |
Murtazo.Ali |
E |
Sept. 3, 2015, 1:42 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
31 |
1740800 |
|
3100 |
44525170 |
yukuai26 |
E |
Oct. 19, 2018, 1:27 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
31 |
12083200 |
|
3100 |
44525044 |
luogu_bot5 |
E |
Oct. 19, 2018, 1:18 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
31 |
12083200 |
|
3100 |
12766257 |
RNS_CUS |
E |
Aug. 29, 2015, 7:44 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
921600 |
|
3100 |
12765962 |
RNS_CUS |
E |
Aug. 29, 2015, 7:32 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
921600 |
|
3100 |
12765854 |
RNS_CUS |
E |
Aug. 29, 2015, 7:29 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
921600 |
|
3100 |
12759251 |
Marcin_smu |
E |
Aug. 29, 2015, 6:01 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
921600 |
|
3100 |
12816232 |
JasonHsiao |
E |
Sept. 2, 2015, 2:05 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
1331200 |
|
3100 |
20924159 |
Steven_Wu |
E |
Sept. 26, 2016, 11:45 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
31 |
1331200 |
|
3100 |
51127843 |
bestFy |
E |
March 10, 2019, 12:29 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
46 |
1638400 |
|
3100 |
58788397 |
Scut82 |
E |
Aug. 14, 2019, 12:55 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
62 |
1638400 |
|
3100 |
67269805 |
nealchen |
E |
Dec. 20, 2019, 7:42 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
93 |
3993600 |
|
3100 |
63720271 |
jijiang |
E |
Oct. 29, 2019, 11:10 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
108 |
4710400 |
|
3100 |
69081014 |
rushcheyo |
E |
Jan. 19, 2020, 6:23 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
124 |
3174400 |
|
3100 |
67943799 |
251 |
E |
Dec. 30, 2019, 3:45 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
156 |
3174400 |
|
3100 |
61765006 |
gtrhetr |
E |
Oct. 3, 2019, 8:20 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
156 |
16793600 |
|
3100 |
51997665 |
hychyc |
E |
March 30, 2019, 3:48 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
187 |
2764800 |
|
3100 |
62849369 |
cz_xuyixuan |
E |
Oct. 18, 2019, 6:42 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
187 |
9625600 |
|
3100 |
53178973 |
gubeiqg |
E |
April 23, 2019, 6:23 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
16076800 |
|
3100 |
37371733 |
DennisPraet |
E |
April 16, 2018, 12:16 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
62 |
12902400 |
|
3100 |
66788522 |
CN_zwang2002 |
E |
Dec. 13, 2019, 2:28 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
155 |
6348800 |
|
3100 |
66290543 |
DomiKo |
E |
Dec. 4, 2019, 10:08 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
186 |
7372800 |
|
3100 |
59974799 |
Isonan |
E |
Sept. 4, 2019, 5:07 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
187 |
4812800 |
|
3100 |
45160518 |
lqs2015 |
E |
Nov. 1, 2018, 8:49 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
217 |
8396800 |
|
3100 |
68101378 |
Elegia |
E |
Jan. 3, 2020, 3:24 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
358 |
14848000 |
|
3100 |
62452591 |
chenqiuyuan233 |
E |
Oct. 13, 2019, 4:59 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
389 |
1843200 |
|
3100 |
64301556 |
vjudge2 |
E |
Nov. 5, 2019, 10:14 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
436 |
4608000 |
|
3100 |
64301445 |
LJZ_C |
E |
Nov. 5, 2019, 10:12 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
436 |
4608000 |
|
3100 |
12766844 |
qwerty787788 |
E |
Aug. 29, 2015, 8:24 p.m. |
OK |
Java 8 |
TESTS |
42 |
5131 |
0 |
|
3100 |
12860585 |
qwertyashraf20 |
E |
Sept. 6, 2015, 5:42 a.m. |
OK |
MS C++ |
TESTS |
42 |
46 |
1740800 |
|
3100 |
12775754 |
cs2000 |
E |
Aug. 30, 2015, 11:54 a.m. |
OK |
MS C++ |
TESTS |
42 |
1216 |
1740800 |
|
3100 |
57199095 |
vjudge5 |
E |
July 17, 2019, 1:09 p.m. |
OK |
MS C++ |
TESTS |
42 |
2106 |
6246400 |
|
3100 |
46374687 |
frogcatcher |
E |
Nov. 29, 2018, 5:59 p.m. |
OK |
MS C++ |
TESTS |
42 |
2449 |
2048000 |
|
3100 |
12766685 |
anta |
E |
Aug. 29, 2015, 8:09 p.m. |
OK |
MS C++ |
TESTS |
42 |
2714 |
1228800 |
|
3100 |
19541953 |
Umqra |
E |
July 31, 2016, 4:33 p.m. |
OK |
MS C++ |
TESTS |
42 |
3057 |
1638400 |
|
3100 |
19298488 |
Umqra |
E |
July 21, 2016, 9:14 a.m. |
OK |
MS C++ |
TESTS |
42 |
3276 |
2048000 |
|
3100 |
12796711 |
Jael |
E |
Sept. 1, 2015, 3:49 a.m. |
OK |
MS C++ |
TESTS |
42 |
3307 |
2048000 |
|
3100 |
22368353 |
Mr.Awesome |
E |
Nov. 20, 2016, 4:07 p.m. |
OK |
MS C++ |
TESTS |
42 |
3696 |
2048000 |
|
3100 |
12760770 |
logicmachine |
E |
Aug. 29, 2015, 6:12 p.m. |
OK |
MS C++ |
TESTS |
42 |
4009 |
2048000 |
|
3100 |
remove filters
Back to search problems