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'Alice and Bob are playing yet another card game. This time the rules are the following. There are n cards lying in a row in front of them. The i -th card has value a_i . First, Alice chooses a non-empty consecutive segment of cards [l; r] ( l <= r ). After that Bob removes a single card j from that segment (l <= j <= r) . The score of the game is the total value of the remaining cards on the segment (a_l + a_{l + 1} + ... + a_{j - 1} + a_{j + 1} + ... + a_{r - 1} + a_r) . In particular, if Alice chooses a segment with just one element, then the score after Bob removes the only card is 0 . Alice wants to make the score as big as possible. Bob takes such a card that the score is as small as possible. What segment should Alice choose so that the score is maximum possible? Output the maximum score. The first line contains a single integer n ( 1 <= n <= 10^5 ) -- the number of cards. The second line contains n integers a_1, a_2, ... , a_n ( -30 <= a_i <= 30 ) -- the values on the cards. Print a single integer -- the final score of the game. In the first example Alice chooses a segment [1;5] -- the entire row of cards. Bob removes card 3 with the value 10 from the segment. Thus, the final score is 5 + (-2) + (-1) + 4 = 6 . In the second example Alice chooses a segment [1;4] , so that Bob removes either card 1 or 3 with the value 5 , making the answer 5 + 2 + 3 = 10 . In the third example Alice can choose any of the segments of length 1 : [1;1] , [2;2] or [3;3] . Bob removes the only card, so the score is 0 . If Alice chooses some other segment then the answer will be less than 0 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
81898714 |
3014216074 |
D |
May 29, 2020, 2:59 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
94 |
171 |
307200 |
|
2000 |
81839241 |
NaGuT |
D |
May 29, 2020, 1:55 a.m. |
OK |
D |
TESTS |
93 |
62 |
4198400 |
|
2000 |
82020052 |
singerl |
D |
May 31, 2020, 7:39 a.m. |
OK |
GNU C11 |
TESTS |
94 |
61 |
409600 |
|
2000 |
82397593 |
tjg |
D |
June 3, 2020, 12:48 p.m. |
OK |
GNU C11 |
TESTS |
94 |
61 |
248524800 |
|
2000 |
81890128 |
JinChuan |
D |
May 29, 2020, 1:40 p.m. |
OK |
GNU C++11 |
TESTS |
94 |
31 |
1024000 |
|
2000 |
81875159 |
spnooyseed |
D |
May 29, 2020, 10:42 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
31 |
3993600 |
|
2000 |
81862040 |
wannaPP |
D |
May 29, 2020, 7:59 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
31 |
4300800 |
|
2000 |
82201922 |
LOVE_YJZ |
D |
June 1, 2020, 9:49 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
31 |
14233600 |
|
2000 |
82034004 |
Airisa_ |
D |
May 31, 2020, 11:10 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
46 |
204800 |
|
2000 |
82040966 |
yzhid |
D |
May 31, 2020, 12:58 p.m. |
OK |
GNU C++11 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82029226 |
northsky0307 |
D |
May 31, 2020, 10 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82394826 |
Thomasguo666 |
D |
June 3, 2020, 12:15 p.m. |
OK |
GNU C++11 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82480426 |
1437658015 |
D |
June 4, 2020, 12:11 p.m. |
OK |
GNU C++11 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82387348 |
Dreamfarer |
D |
June 3, 2020, 10:44 a.m. |
OK |
GNU C++11 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82457490 |
ver_y007 |
D |
June 4, 2020, 7:17 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82206042 |
Tman |
D |
June 1, 2020, 10:37 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82043145 |
xfrd01 |
D |
May 31, 2020, 1:32 p.m. |
OK |
GNU C++14 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82038667 |
ranjith1604 |
D |
May 31, 2020, 12:22 p.m. |
OK |
GNU C++14 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82020600 |
Sabyasachi |
D |
May 31, 2020, 7:47 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
46 |
409600 |
|
2000 |
81994001 |
pedrosa |
D |
May 30, 2020, 8:03 p.m. |
OK |
GNU C++14 |
TESTS |
94 |
46 |
409600 |
|
2000 |
81972155 |
shanky07 |
D |
May 30, 2020, 1:38 p.m. |
OK |
GNU C++14 |
TESTS |
94 |
46 |
409600 |
|
2000 |
81951639 |
CrazyPop |
D |
May 30, 2020, 9:03 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82388665 |
elowen |
D |
June 3, 2020, 11:01 a.m. |
OK |
GNU C++14 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82432564 |
rohit7s |
D |
June 3, 2020, 8:13 p.m. |
OK |
GNU C++14 |
TESTS |
94 |
46 |
409600 |
|
2000 |
81881567 |
snehan1234567 |
D |
May 29, 2020, 11:59 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
46 |
0 |
|
2000 |
82044289 |
Shoriful_Islam |
D |
May 31, 2020, 1:48 p.m. |
OK |
GNU C++17 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82432486 |
4qqqq |
D |
June 3, 2020, 8:11 p.m. |
OK |
GNU C++17 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82428671 |
frangl |
D |
June 3, 2020, 7:02 p.m. |
OK |
GNU C++17 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82361512 |
Nah1d |
D |
June 3, 2020, 5:10 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82315324 |
ilijaIR1331IR |
D |
June 2, 2020, 2:06 p.m. |
OK |
GNU C++17 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82212335 |
inluminas |
D |
June 1, 2020, 11:46 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82165131 |
fmndantas |
D |
May 31, 2020, 10:51 p.m. |
OK |
GNU C++17 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82023825 |
GMaster |
D |
May 31, 2020, 8:38 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
46 |
409600 |
|
2000 |
82001557 |
Abhi1857 |
D |
May 31, 2020, 12:37 a.m. |
OK |
GNU C++17 |
TESTS |
94 |
46 |
409600 |
|
2000 |
81838939 |
Pechalka |
D |
May 29, 2020, 1:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
93 |
31 |
819200 |
|
2000 |
82034312 |
Bondo |
D |
May 31, 2020, 11:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
94 |
31 |
819200 |
|
2000 |
82217059 |
ValarDohaeris_ |
D |
June 1, 2020, 12:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
94 |
31 |
819200 |
|
2000 |
81990272 |
Manel_Nesquik |
D |
May 30, 2020, 6:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
94 |
31 |
2150400 |
|
2000 |
81876919 |
sheaf |
D |
May 29, 2020, 11:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
94 |
46 |
0 |
|
2000 |
82437876 |
emma |
D |
June 3, 2020, 11:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
94 |
46 |
0 |
|
2000 |
82317587 |
szechuan_sauce |
D |
June 2, 2020, 2:30 p.m. |
OK |
GNU C++17 (64) |
TESTS |
94 |
46 |
409600 |
|
2000 |
82399357 |
Mormo_1703119 |
D |
June 3, 2020, 1:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
94 |
46 |
409600 |
|
2000 |
82321923 |
coreproject.yaking |
D |
June 2, 2020, 3:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
94 |
46 |
409600 |
|
2000 |
82208028 |
TselmegKh |
D |
June 1, 2020, 10:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
94 |
46 |
409600 |
|
2000 |
81818332 |
clyring |
D |
May 28, 2020, 6:07 p.m. |
OK |
Haskell |
TESTS |
93 |
78 |
2252800 |
|
2000 |
81818114 |
clyring |
D |
May 28, 2020, 6:05 p.m. |
OK |
Haskell |
TESTS |
93 |
78 |
2252800 |
|
2000 |
81816560 |
clyring |
D |
May 28, 2020, 5:50 p.m. |
OK |
Haskell |
TESTS |
93 |
124 |
4300800 |
|
2000 |
81815298 |
clyring |
D |
May 28, 2020, 5:38 p.m. |
OK |
Haskell |
TESTS |
93 |
514 |
14848000 |
|
2000 |
82047355 |
saikaushik333 |
D |
May 31, 2020, 2:31 p.m. |
OK |
Java 11 |
TESTS |
94 |
202 |
0 |
|
2000 |
81970246 |
habibulka |
D |
May 30, 2020, 1:12 p.m. |
OK |
Java 11 |
TESTS |
94 |
202 |
0 |
|
2000 |
81868664 |
chaparasagar |
D |
May 29, 2020, 9:23 a.m. |
OK |
Java 11 |
TESTS |
94 |
202 |
0 |
|
2000 |
81853224 |
wanTedGuY |
D |
May 29, 2020, 6:20 a.m. |
OK |
Java 11 |
TESTS |
94 |
202 |
0 |
|
2000 |
81855646 |
gagan_6730 |
D |
May 29, 2020, 6:48 a.m. |
OK |
Java 11 |
TESTS |
94 |
217 |
0 |
|
2000 |
81848765 |
chris_11 |
D |
May 29, 2020, 5:19 a.m. |
OK |
Java 11 |
TESTS |
93 |
217 |
0 |
|
2000 |
81816245 |
mikit |
D |
May 28, 2020, 5:46 p.m. |
OK |
Java 11 |
TESTS |
93 |
217 |
0 |
|
2000 |
82382664 |
anhtaihsgs |
D |
June 3, 2020, 9:46 a.m. |
OK |
Java 11 |
TESTS |
94 |
218 |
0 |
|
2000 |
81940999 |
mphillotry |
D |
May 30, 2020, 6:44 a.m. |
OK |
Java 11 |
TESTS |
94 |
218 |
0 |
|
2000 |
81829068 |
Clowyy |
D |
May 28, 2020, 8:46 p.m. |
OK |
Java 11 |
TESTS |
93 |
218 |
0 |
|
2000 |
81946392 |
jrishabh99 |
D |
May 30, 2020, 7:53 a.m. |
OK |
Java 8 |
TESTS |
94 |
124 |
0 |
|
2000 |
82472949 |
ineffablekenobi |
D |
June 4, 2020, 10:34 a.m. |
OK |
Java 8 |
TESTS |
94 |
124 |
0 |
|
2000 |
81941863 |
Faizan |
D |
May 30, 2020, 6:55 a.m. |
OK |
Java 8 |
TESTS |
94 |
124 |
0 |
|
2000 |
81930773 |
tsumit023 |
D |
May 30, 2020, 3:28 a.m. |
OK |
Java 8 |
TESTS |
94 |
124 |
0 |
|
2000 |
81830086 |
nick_301 |
D |
May 28, 2020, 9:10 p.m. |
OK |
Java 8 |
TESTS |
93 |
124 |
0 |
|
2000 |
82046656 |
masterbios |
D |
May 31, 2020, 2:21 p.m. |
OK |
Java 8 |
TESTS |
94 |
139 |
0 |
|
2000 |
81874901 |
bluesky111 |
D |
May 29, 2020, 10:39 a.m. |
OK |
Java 8 |
TESTS |
94 |
139 |
0 |
|
2000 |
82446909 |
cis_pie |
D |
June 4, 2020, 4:22 a.m. |
OK |
Java 8 |
TESTS |
94 |
140 |
0 |
|
2000 |
82002101 |
buzaubakov.raman |
D |
May 31, 2020, 1:03 a.m. |
OK |
Java 8 |
TESTS |
94 |
140 |
0 |
|
2000 |
81951498 |
glider.g |
D |
May 30, 2020, 9:01 a.m. |
OK |
Java 8 |
TESTS |
94 |
140 |
0 |
|
2000 |
81920526 |
AQZZ |
D |
May 29, 2020, 6:40 p.m. |
OK |
Kotlin |
TESTS |
94 |
155 |
0 |
|
2000 |
81867181 |
Spheniscine |
D |
May 29, 2020, 9:05 a.m. |
OK |
Kotlin |
TESTS |
94 |
202 |
716800 |
|
2000 |
81893240 |
ggdwbg |
D |
May 29, 2020, 2:16 p.m. |
OK |
Kotlin |
TESTS |
94 |
202 |
819200 |
|
2000 |
81817472 |
HanaYukii |
D |
May 28, 2020, 5:59 p.m. |
OK |
Kotlin |
TESTS |
93 |
202 |
2355200 |
|
2000 |
81887127 |
Spheniscine |
D |
May 29, 2020, 1:03 p.m. |
OK |
Kotlin |
TESTS |
94 |
233 |
716800 |
|
2000 |
82196582 |
Ajay_Modi |
D |
June 1, 2020, 8:49 a.m. |
OK |
Kotlin |
TESTS |
94 |
233 |
2355200 |
|
2000 |
81887843 |
dawes |
D |
May 29, 2020, 1:12 p.m. |
OK |
Kotlin |
TESTS |
94 |
233 |
20889600 |
|
2000 |
81822133 |
ibrahim.el.hajj.02 |
D |
May 28, 2020, 6:50 p.m. |
OK |
Kotlin |
TESTS |
93 |
234 |
0 |
|
2000 |
81889416 |
Spheniscine |
D |
May 29, 2020, 1:32 p.m. |
OK |
Kotlin |
TESTS |
94 |
234 |
716800 |
|
2000 |
81832877 |
vinhntndu |
D |
May 28, 2020, 10:32 p.m. |
OK |
Kotlin |
TESTS |
93 |
264 |
2764800 |
|
2000 |
81881891 |
EmK |
D |
May 29, 2020, 12:03 p.m. |
OK |
Mono C# |
TESTS |
94 |
467 |
11264000 |
|
2000 |
81882184 |
EmK |
D |
May 29, 2020, 12:06 p.m. |
OK |
Mono C# |
TESTS |
94 |
514 |
11264000 |
|
2000 |
82009944 |
DarkSun |
D |
May 31, 2020, 4:54 a.m. |
OK |
MS C++ |
TESTS |
94 |
77 |
409600 |
|
2000 |
81997590 |
P___ |
D |
May 30, 2020, 9:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
94 |
62 |
25497600 |
|
2000 |
81976917 |
reikiriyama |
D |
May 30, 2020, 2:44 p.m. |
OK |
MS C++ 2017 |
TESTS |
94 |
78 |
409600 |
|
2000 |
81947956 |
GK_Ebbaka |
D |
May 30, 2020, 8:14 a.m. |
OK |
MS C++ 2017 |
TESTS |
94 |
109 |
409600 |
|
2000 |
81857927 |
little_lion |
D |
May 29, 2020, 7:13 a.m. |
OK |
MS C++ 2017 |
TESTS |
94 |
109 |
1945600 |
|
2000 |
81961137 |
AnnSuperstar |
D |
May 30, 2020, 11:09 a.m. |
OK |
MS C++ 2017 |
TESTS |
94 |
124 |
819200 |
|
2000 |
82039871 |
nik1998 |
D |
May 31, 2020, 12:41 p.m. |
OK |
MS C++ 2017 |
TESTS |
94 |
124 |
8089600 |
|
2000 |
82012331 |
P___ |
D |
May 31, 2020, 5:39 a.m. |
OK |
MS C++ 2017 |
TESTS |
94 |
139 |
8294400 |
|
2000 |
81879654 |
LSD |
D |
May 29, 2020, 11:38 a.m. |
OK |
MS C++ 2017 |
TESTS |
94 |
140 |
52838400 |
|
2000 |
81850689 |
FailBetterNextTime |
D |
May 29, 2020, 5:47 a.m. |
OK |
PyPy 2 |
TESTS |
93 |
170 |
6041600 |
|
2000 |
82165637 |
yumtam |
D |
May 31, 2020, 11:15 p.m. |
OK |
PyPy 2 |
TESTS |
94 |
171 |
4710400 |
|
2000 |
82473609 |
rkstalker |
D |
June 4, 2020, 10:43 a.m. |
OK |
PyPy 2 |
TESTS |
94 |
171 |
6041600 |
|
2000 |
81822810 |
abhirajthedon |
D |
May 28, 2020, 6:59 p.m. |
OK |
PyPy 2 |
TESTS |
93 |
171 |
6041600 |
|
2000 |
81831153 |
amitray1608 |
D |
May 28, 2020, 9:37 p.m. |
OK |
PyPy 2 |
TESTS |
93 |
187 |
5632000 |
|
2000 |
81850802 |
FailBetterNextTime |
D |
May 29, 2020, 5:49 a.m. |
OK |
PyPy 2 |
TESTS |
93 |
187 |
6041600 |
|
2000 |
82002983 |
mir.panov |
D |
May 31, 2020, 1:47 a.m. |
OK |
PyPy 2 |
TESTS |
94 |
187 |
6144000 |
|
2000 |
81830835 |
realnimish |
D |
May 28, 2020, 9:29 p.m. |
OK |
PyPy 2 |
TESTS |
93 |
202 |
5836800 |
|
2000 |
81820832 |
ap1008 |
D |
May 28, 2020, 6:33 p.m. |
OK |
PyPy 2 |
TESTS |
93 |
202 |
6041600 |
|
2000 |
82047493 |
shreyansv1 |
D |
May 31, 2020, 2:33 p.m. |
OK |
PyPy 2 |
TESTS |
94 |
218 |
9728000 |
|
2000 |
81930487 |
vegetablesandwich |
D |
May 30, 2020, 2:55 a.m. |
OK |
PyPy 3 |
TESTS |
94 |
187 |
6553600 |
|
2000 |
81840576 |
marcus.li |
D |
May 29, 2020, 2:32 a.m. |
OK |
PyPy 3 |
TESTS |
93 |
187 |
8396800 |
|
2000 |
81824156 |
UTMoonlight |
D |
May 28, 2020, 7:19 p.m. |
OK |
PyPy 3 |
TESTS |
93 |
187 |
9011200 |
|
2000 |
81933549 |
Arpanjain.g |
D |
May 30, 2020, 4:43 a.m. |
OK |
PyPy 3 |
TESTS |
94 |
202 |
6963200 |
|
2000 |
81877354 |
700atpid |
D |
May 29, 2020, 11:10 a.m. |
OK |
PyPy 3 |
TESTS |
94 |
202 |
7065600 |
|
2000 |
81933342 |
Arpanjain.g |
D |
May 30, 2020, 4:38 a.m. |
OK |
PyPy 3 |
TESTS |
94 |
202 |
7065600 |
|
2000 |
81888901 |
dipta007 |
D |
May 29, 2020, 1:26 p.m. |
OK |
PyPy 3 |
TESTS |
94 |
202 |
7065600 |
|
2000 |
81890336 |
Dewangee |
D |
May 29, 2020, 1:43 p.m. |
OK |
PyPy 3 |
TESTS |
94 |
202 |
7168000 |
|
2000 |
82188798 |
Ajay_Modi |
D |
June 1, 2020, 7:21 a.m. |
OK |
PyPy 3 |
TESTS |
94 |
202 |
8089600 |
|
2000 |
82462646 |
tycyd |
D |
June 4, 2020, 8:24 a.m. |
OK |
PyPy 3 |
TESTS |
94 |
202 |
8089600 |
|
2000 |
81848068 |
1194code |
D |
May 29, 2020, 5:08 a.m. |
OK |
Python 3 |
TESTS |
93 |
701 |
7168000 |
|
2000 |
81846925 |
1194code |
D |
May 29, 2020, 4:42 a.m. |
OK |
Python 3 |
TESTS |
93 |
779 |
6963200 |
|
2000 |
81890701 |
alon276 |
D |
May 29, 2020, 1:47 p.m. |
OK |
Python 3 |
TESTS |
94 |
1372 |
6963200 |
|
2000 |
81923406 |
macho_uno |
D |
May 29, 2020, 7:28 p.m. |
OK |
Rust |
TESTS |
94 |
46 |
2662400 |
|
2000 |
81833858 |
vinhntndu |
D |
May 28, 2020, 11:09 p.m. |
OK |
Rust |
TESTS |
93 |
93 |
4300800 |
|
2000 |
81894951 |
fatemender |
D |
May 29, 2020, 2:35 p.m. |
OK |
Rust |
TESTS |
94 |
1294 |
5017600 |
|
2000 |
81967793 |
.counter |
D |
May 30, 2020, 12:37 p.m. |
OK |
Scala |
TESTS |
94 |
499 |
4300800 |
|
2000 |
82007262 |
gazaan |
D |
May 31, 2020, 3:49 a.m. |
OK |
Scala |
TESTS |
94 |
763 |
21606400 |
|
2000 |
82253972 |
IvanDyachenko |
D |
June 1, 2020, 8:25 p.m. |
OK |
Scala |
TESTS |
94 |
889 |
5120000 |
|
2000 |
remove filters
Back to search problems