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'You are given an array a consisting of n integers. Indices of the array start from zero (i. xe2 x80 x89e. the first element is a_0 , the second one is a_1 , and so on). You can reverse at most one subarray (continuous subsegment) of this array. Recall that the subarray of a with borders l and r is a[l; r] = a_l, a_{l + 1}, ... , a_{r} . Your task is to reverse such a subarray that the sum of elements on even positions of the resulting array is maximized (i. xe2 x80 x89e. the sum of elements a_0, a_2, ... , a_{2k} for integer k = lfloor frac{n-1}{2} rfloor should be maximum possible). You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 2 cdot 10^4 ) -- the number of test cases. Then t test cases follow. The first line of the test case contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the length of a . The second line of the test case contains n integers a_0, a_1, ... , a_{n-1} ( 1 <= a_i <= 10^9 ), where a_i is the i -th element of a . It is guaranteed that the sum of n does not exceed 2 cdot 10^5 ( sum n <= 2 cdot 10^5 ). For each test case, print the answer on the separate line -- the maximum possible sum of elements on even positions after reversing at most one subarray (continuous subsegment) of a . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
85034786 |
daut-dlang |
D |
June 25, 2020, 3:54 p.m. |
OK |
D |
TESTS |
23 |
77 |
28672000 |
|
|
85030158 |
Gassa |
D |
June 25, 2020, 3:44 p.m. |
OK |
D |
TESTS |
23 |
93 |
28774400 |
|
|
85035876 |
ruban |
D |
June 25, 2020, 3:57 p.m. |
OK |
FPC |
TESTS |
23 |
93 |
116121600 |
|
|
85030260 |
rainboy |
D |
June 25, 2020, 3:44 p.m. |
OK |
GNU C11 |
TESTS |
23 |
78 |
4710400 |
|
|
85055674 |
SaiAryan |
D |
June 25, 2020, 4:50 p.m. |
OK |
GNU C11 |
TESTS |
23 |
93 |
5529600 |
|
|
85015269 |
Golden_Time |
D |
June 25, 2020, 3:17 p.m. |
OK |
GNU C++11 |
TESTS |
23 |
31 |
4710400 |
|
|
85024756 |
wyzwyz |
D |
June 25, 2020, 3:33 p.m. |
OK |
GNU C++11 |
TESTS |
23 |
31 |
5529600 |
|
|
85016234 |
jeffyang |
D |
June 25, 2020, 3:19 p.m. |
OK |
GNU C++11 |
TESTS |
23 |
31 |
5734400 |
|
|
85055964 |
Wall_breaker |
D |
June 25, 2020, 4:52 p.m. |
OK |
GNU C++11 |
TESTS |
23 |
31 |
6553600 |
|
|
85027349 |
s_y_z_r_y |
D |
June 25, 2020, 3:38 p.m. |
OK |
GNU C++11 |
TESTS |
23 |
31 |
7987200 |
|
|
85041088 |
YingLi_SF |
D |
June 25, 2020, 4:09 p.m. |
OK |
GNU C++11 |
TESTS |
23 |
31 |
8908800 |
|
|
85022574 |
lavenderwithbluish |
D |
June 25, 2020, 3:29 p.m. |
OK |
GNU C++11 |
TESTS |
23 |
31 |
12288000 |
|
|
85047725 |
jimmyywang |
D |
June 25, 2020, 4:25 p.m. |
OK |
GNU C++11 |
TESTS |
23 |
31 |
28160000 |
|
|
85085076 |
YHHxBULIATANIA |
D |
June 26, 2020, 3:03 a.m. |
OK |
GNU C++11 |
TESTS |
23 |
31 |
36147200 |
|
|
85022923 |
zqrtxdy |
D |
June 25, 2020, 3:30 p.m. |
OK |
GNU C++11 |
TESTS |
23 |
31 |
52224000 |
|
|
85045058 |
dark_horse07 |
D |
June 25, 2020, 4:19 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
4505600 |
|
|
85022160 |
Taeksssam |
D |
June 25, 2020, 3:29 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
4505600 |
|
|
85053642 |
atman_darji |
D |
June 25, 2020, 4:39 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
4505600 |
|
|
85063924 |
xzh29 |
D |
June 25, 2020, 6:14 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
4505600 |
|
|
85053777 |
mr.ashish |
D |
June 25, 2020, 4:40 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
4812800 |
|
|
85065324 |
nikolapesic2802 |
D |
June 25, 2020, 6:33 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
4812800 |
|
|
85043800 |
harlequen |
D |
June 25, 2020, 4:16 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
5324800 |
|
|
85014924 |
Tathagat_shah |
D |
June 25, 2020, 3:17 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
5324800 |
|
|
85092125 |
sca |
D |
June 26, 2020, 5:34 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
62 |
6963200 |
|
|
85032273 |
Amit_IITB |
D |
June 25, 2020, 3:49 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
77 |
3788800 |
|
|
85046726 |
shaohang |
D |
June 25, 2020, 4:23 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
62 |
4505600 |
|
|
85045852 |
Kaneki-kun |
D |
June 25, 2020, 4:21 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
62 |
4505600 |
|
|
85044635 |
Chait0482 |
D |
June 25, 2020, 4:18 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
62 |
4505600 |
|
|
85089967 |
rainier_1 |
D |
June 26, 2020, 4:49 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
62 |
4505600 |
|
|
85015357 |
chen_zexing |
D |
June 25, 2020, 3:18 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
62 |
4505600 |
|
|
85070162 |
Nowshad |
D |
June 25, 2020, 7:43 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
62 |
4505600 |
|
|
85058302 |
IsaacMoris |
D |
June 25, 2020, 5:10 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
62 |
4812800 |
|
|
85041964 |
CR400BF-5033 |
D |
June 25, 2020, 4:11 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
62 |
5324800 |
|
|
85017659 |
cxzxcys |
D |
June 25, 2020, 3:21 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
62 |
5529600 |
|
|
85074637 |
rj32 |
D |
June 25, 2020, 9:13 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
62 |
6144000 |
|
|
85078658 |
tyler |
D |
June 25, 2020, 11:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
5324800 |
|
|
85016126 |
Georgiy_Ulanov |
D |
June 25, 2020, 3:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
5324800 |
|
|
85028042 |
FelixArg |
D |
June 25, 2020, 3:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
5427200 |
|
|
85034676 |
tanimania |
D |
June 25, 2020, 3:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
6144000 |
|
|
85020205 |
Parsa84 |
D |
June 25, 2020, 3:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
6144000 |
|
|
85054911 |
__ek__tha__tiger__ |
D |
June 25, 2020, 4:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
6144000 |
|
|
85015944 |
MrBrionix |
D |
June 25, 2020, 3:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
6144000 |
|
|
85088942 |
nicknamee12 |
D |
June 26, 2020, 4:30 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
6144000 |
|
|
85016122 |
Macdu |
D |
June 25, 2020, 3:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
6144000 |
|
|
85079570 |
snapes |
D |
June 25, 2020, 11:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
46 |
6963200 |
|
|
85085218 |
maguroguma |
D |
June 26, 2020, 3:06 a.m. |
OK |
Go |
TESTS |
23 |
124 |
20684800 |
|
|
85066856 |
Anonymous |
D |
June 25, 2020, 6:53 p.m. |
OK |
Java 11 |
TESTS |
23 |
187 |
23859200 |
|
|
85049615 |
chandler0702 |
D |
June 25, 2020, 4:30 p.m. |
OK |
Java 11 |
TESTS |
23 |
187 |
23859200 |
|
|
85064918 |
Barnot |
D |
June 25, 2020, 6:28 p.m. |
OK |
Java 11 |
TESTS |
23 |
187 |
24166400 |
|
|
85017695 |
BNL |
D |
June 25, 2020, 3:21 p.m. |
OK |
Java 11 |
TESTS |
23 |
202 |
23859200 |
|
|
85070631 |
saikaushik333 |
D |
June 25, 2020, 7:51 p.m. |
OK |
Java 11 |
TESTS |
23 |
202 |
23859200 |
|
|
85026919 |
sf14t |
D |
June 25, 2020, 3:38 p.m. |
OK |
Java 11 |
TESTS |
23 |
202 |
23961600 |
|
|
85057916 |
atishay127 |
D |
June 25, 2020, 5:06 p.m. |
OK |
Java 11 |
TESTS |
23 |
202 |
24064000 |
|
|
85057734 |
atishay127 |
D |
June 25, 2020, 5:05 p.m. |
OK |
Java 11 |
TESTS |
23 |
202 |
24064000 |
|
|
85027279 |
pk_sinha53 |
D |
June 25, 2020, 3:38 p.m. |
OK |
Java 11 |
TESTS |
23 |
202 |
24064000 |
|
|
85045032 |
frjitourist2 |
D |
June 25, 2020, 4:19 p.m. |
OK |
Java 11 |
TESTS |
23 |
202 |
24473600 |
|
|
85075518 |
Pranay2516 |
D |
June 25, 2020, 9:35 p.m. |
OK |
Java 8 |
TESTS |
23 |
109 |
20377600 |
|
|
85075799 |
MubtasimShahriar |
D |
June 25, 2020, 9:43 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
20480000 |
|
|
85049339 |
sizzula |
D |
June 25, 2020, 4:29 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
20480000 |
|
|
85041393 |
Sadakant |
D |
June 25, 2020, 4:10 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
20480000 |
|
|
85030572 |
ShesMyNerd |
D |
June 25, 2020, 3:45 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
20480000 |
|
|
85026066 |
RitvikMittal |
D |
June 25, 2020, 3:36 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
20480000 |
|
|
85025158 |
elkadymohammed01 |
D |
June 25, 2020, 3:34 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
20480000 |
|
|
85035378 |
shashwat07 |
D |
June 25, 2020, 3:56 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
20582400 |
|
|
85063878 |
ashraybharambe |
D |
June 25, 2020, 6:13 p.m. |
OK |
Java 8 |
TESTS |
23 |
139 |
20377600 |
|
|
85050088 |
te_amo |
D |
June 25, 2020, 4:31 p.m. |
OK |
Java 8 |
TESTS |
23 |
139 |
20480000 |
|
|
85064381 |
Loremon |
D |
June 25, 2020, 6:20 p.m. |
OK |
JavaScript |
TESTS |
23 |
140 |
25395200 |
|
|
85085257 |
Spheniscine |
D |
June 26, 2020, 3:07 a.m. |
OK |
Kotlin |
TESTS |
23 |
155 |
20684800 |
|
|
85015055 |
koboshi |
D |
June 25, 2020, 3:17 p.m. |
OK |
Kotlin |
TESTS |
23 |
280 |
57958400 |
|
|
85072480 |
vrublack |
D |
June 25, 2020, 8:26 p.m. |
OK |
Kotlin |
TESTS |
23 |
342 |
45363200 |
|
|
85016831 |
batkhuyag |
D |
June 25, 2020, 3:20 p.m. |
OK |
Kotlin |
TESTS |
23 |
374 |
38297600 |
|
|
85082003 |
wuchaojie925 |
D |
June 26, 2020, 1:33 a.m. |
OK |
Kotlin |
TESTS |
23 |
374 |
38604800 |
|
|
85031428 |
abdukodir |
D |
June 25, 2020, 3:47 p.m. |
OK |
Kotlin |
TESTS |
23 |
389 |
57856000 |
|
|
85033006 |
MaxPylypovych |
D |
June 25, 2020, 3:50 p.m. |
OK |
Kotlin |
TESTS |
23 |
420 |
39526400 |
|
|
85017558 |
Yupiteru |
D |
June 25, 2020, 3:21 p.m. |
OK |
Mono C# |
TESTS |
23 |
124 |
18636800 |
|
|
85045312 |
riantkb |
D |
June 25, 2020, 4:20 p.m. |
OK |
Mono C# |
TESTS |
23 |
124 |
40243200 |
|
|
85029328 |
_Trung_Nguyen |
D |
June 25, 2020, 3:42 p.m. |
OK |
Mono C# |
TESTS |
23 |
139 |
41574400 |
|
|
85037797 |
Kolyanich |
D |
June 25, 2020, 4:01 p.m. |
OK |
Mono C# |
TESTS |
23 |
155 |
9625600 |
|
|
85018181 |
eSeF_ |
D |
June 25, 2020, 3:22 p.m. |
OK |
Mono C# |
TESTS |
23 |
156 |
110489600 |
|
|
85027460 |
terry_u16 |
D |
June 25, 2020, 3:39 p.m. |
OK |
Mono C# |
TESTS |
23 |
171 |
44134400 |
|
|
85023788 |
kuuso |
D |
June 25, 2020, 3:32 p.m. |
OK |
Mono C# |
TESTS |
23 |
202 |
40140800 |
|
|
85036473 |
Goldexperienrce |
D |
June 25, 2020, 3:58 p.m. |
OK |
MS C++ |
TESTS |
23 |
62 |
27955200 |
|
|
85020877 |
tarattata1 |
D |
June 25, 2020, 3:27 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
78 |
7680000 |
|
|
85039680 |
BingHui |
D |
June 25, 2020, 4:06 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
93 |
5324800 |
|
|
85034463 |
yuanyuan1024 |
D |
June 25, 2020, 3:54 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
93 |
5324800 |
|
|
85030025 |
otarra |
D |
June 25, 2020, 3:44 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
93 |
10137600 |
|
|
85016125 |
xsc |
D |
June 25, 2020, 3:19 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
124 |
12595200 |
|
|
85043402 |
pjh6792 |
D |
June 25, 2020, 4:15 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
202 |
4505600 |
|
|
85018336 |
Gravekper |
D |
June 25, 2020, 3:22 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
202 |
5324800 |
|
|
85035383 |
TimKo |
D |
June 25, 2020, 3:56 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
202 |
5324800 |
|
|
85041599 |
getN1ght |
D |
June 25, 2020, 4:10 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
202 |
7782400 |
|
|
85045825 |
beastie |
D |
June 25, 2020, 4:21 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
202 |
7782400 |
|
|
85061796 |
OmniSliver |
D |
June 25, 2020, 5:48 p.m. |
OK |
Node.js |
TESTS |
23 |
171 |
39219200 |
|
|
85046351 |
chaudhary_19 |
D |
June 25, 2020, 4:22 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
233 |
44134400 |
|
|
85028230 |
realnimish |
D |
June 25, 2020, 3:40 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
233 |
45977600 |
|
|
85027875 |
chris-md |
D |
June 25, 2020, 3:39 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
248 |
37990400 |
|
|
85074243 |
sksshivam007 |
D |
June 25, 2020, 9:03 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
280 |
45977600 |
|
|
85056754 |
starkizard |
D |
June 25, 2020, 4:58 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
311 |
59904000 |
|
|
85033756 |
beethoven97 |
D |
June 25, 2020, 3:52 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
342 |
38809600 |
|
|
85017295 |
your_Daddy___ |
D |
June 25, 2020, 3:21 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
358 |
36044800 |
|
|
85015864 |
pajenegod |
D |
June 25, 2020, 3:18 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
623 |
41779200 |
|
|
85016434 |
shehebe |
D |
June 25, 2020, 3:19 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
655 |
37990400 |
|
|
85040282 |
wolffd |
D |
June 25, 2020, 4:07 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
1232 |
39219200 |
|
|
85027405 |
gintoki_s |
D |
June 25, 2020, 3:38 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
217 |
38912000 |
|
|
85021639 |
juppy |
D |
June 25, 2020, 3:28 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
249 |
36966400 |
|
|
85024288 |
aberent |
D |
June 25, 2020, 3:33 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
249 |
37171200 |
|
|
85019173 |
wattaihei |
D |
June 25, 2020, 3:24 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
249 |
37273600 |
|
|
85030778 |
siyy |
D |
June 25, 2020, 3:45 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
249 |
39526400 |
|
|
85030792 |
a0976531005 |
D |
June 25, 2020, 3:45 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
264 |
37785600 |
|
|
85051367 |
brthyyjp |
D |
June 25, 2020, 4:33 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
265 |
41984000 |
|
|
85026596 |
throwawayatcoder |
D |
June 25, 2020, 3:37 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
280 |
39321600 |
|
|
85029339 |
Vedkribhu |
D |
June 25, 2020, 3:42 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
280 |
44646400 |
|
|
85038543 |
Rajdeep2k |
D |
June 25, 2020, 4:03 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
296 |
43929600 |
|
|
85019698 |
mockingj |
D |
June 25, 2020, 3:25 p.m. |
OK |
Python 2 |
TESTS |
23 |
467 |
18534400 |
|
|
85047928 |
LuLPuLGuLguy |
D |
June 25, 2020, 4:26 p.m. |
OK |
Python 2 |
TESTS |
23 |
483 |
17612800 |
|
|
85037189 |
Cipher76 |
D |
June 25, 2020, 4 p.m. |
OK |
Python 3 |
TESTS |
23 |
326 |
25292800 |
|
|
85043030 |
hemanth_ram |
D |
June 25, 2020, 4:14 p.m. |
OK |
Python 3 |
TESTS |
23 |
327 |
23756800 |
|
|
85058109 |
shadoX |
D |
June 25, 2020, 5:08 p.m. |
OK |
Python 3 |
TESTS |
23 |
327 |
159641600 |
|
|
85038167 |
Hiroshi.K |
D |
June 25, 2020, 4:02 p.m. |
OK |
Python 3 |
TESTS |
23 |
343 |
24883200 |
|
|
85040215 |
BlackBook9406 |
D |
June 25, 2020, 4:07 p.m. |
OK |
Python 3 |
TESTS |
23 |
374 |
24985600 |
|
|
85093197 |
jhasaurav215 |
D |
June 26, 2020, 5:53 a.m. |
OK |
Python 3 |
TESTS |
23 |
389 |
26316800 |
|
|
85029839 |
ramzz |
D |
June 25, 2020, 3:43 p.m. |
OK |
Python 3 |
TESTS |
23 |
405 |
24985600 |
|
|
85081806 |
sudhirMTS |
D |
June 26, 2020, 1:26 a.m. |
OK |
Python 3 |
TESTS |
23 |
420 |
25292800 |
|
|
85028203 |
ralf_ralf |
D |
June 25, 2020, 3:40 p.m. |
OK |
Python 3 |
TESTS |
23 |
421 |
24576000 |
|
|
85019401 |
ikatakos |
D |
June 25, 2020, 3:24 p.m. |
OK |
Python 3 |
TESTS |
23 |
421 |
24678400 |
|
|
85034426 |
rustafarian |
D |
June 25, 2020, 3:53 p.m. |
OK |
Rust |
TESTS |
23 |
77 |
18739200 |
|
|
85021837 |
pandrei |
D |
June 25, 2020, 3:28 p.m. |
OK |
Rust |
TESTS |
23 |
233 |
15052800 |
|
|
85018044 |
fatemender |
D |
June 25, 2020, 3:22 p.m. |
OK |
Rust |
TESTS |
23 |
249 |
16588800 |
|
|
85057760 |
bqn |
D |
June 25, 2020, 5:05 p.m. |
OK |
Rust |
TESTS |
23 |
264 |
14131200 |
|
|
85088277 |
Russell_Emerine |
D |
June 26, 2020, 4:16 a.m. |
OK |
Rust |
TESTS |
23 |
264 |
16588800 |
|
|
85042071 |
rinz13r |
D |
June 25, 2020, 4:12 p.m. |
OK |
Rust |
TESTS |
23 |
295 |
16588800 |
|
|
remove filters
Back to search problems