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 of n integers. You are allowed to perform the following operation on it as many times as you want (0 or more times): Print the maximum sum of all the elements of the final array that you can obtain in such a way. The first line contains a single integer t ( 1 <= t <= 10^5 ) -- the number of test cases. The first line of each test case contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the length of the array a . The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 10^9 ) -- the elements of array a . It's guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, print the sum of the final array. In the first test case, it is not possible to achieve a sum > 3 by using these operations, therefore the maximum sum is 3 . In the second test case, it can be shown that the maximum sum achievable is 16 . By using operation (1,2) we transform the array from [9,1] into [8,8] , thus the sum of the final array is 16 . In the third test case, it can be shown that it is not possible to achieve a sum > 18 by using these operations, therefore the maximum sum is 18 . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
186019040 |
rainboy |
C |
Dec. 19, 2022, 5:20 p.m. |
OK |
GNU C11 |
TESTS |
40 |
483 |
1638400 |
|
|
186011400 |
tokitsukaze |
C |
Dec. 19, 2022, 4:33 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
46 |
1740800 |
|
|
186060050 |
2024fuqingran |
C |
Dec. 20, 2022, 4:28 a.m. |
OK |
GNU C++14 |
TESTS |
40 |
46 |
3379200 |
|
|
186018601 |
Mari000 |
C |
Dec. 19, 2022, 5:18 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
77 |
819200 |
|
|
186047782 |
conexposys |
C |
Dec. 19, 2022, 11:12 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
77 |
1638400 |
|
|
186042873 |
DarshilThakkar |
C |
Dec. 19, 2022, 9:01 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
77 |
3174400 |
|
|
186005579 |
Naseem17 |
C |
Dec. 19, 2022, 4:18 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
78 |
819200 |
|
|
186052494 |
Yuki991 |
C |
Dec. 20, 2022, 1:52 a.m. |
OK |
GNU C++14 |
TESTS |
40 |
93 |
819200 |
|
|
186005190 |
__chtholly__ |
C |
Dec. 19, 2022, 4:17 p.m. |
OK |
GNU C++14 |
TESTS |
40 |
93 |
1536000 |
|
|
186058961 |
DGME |
C |
Dec. 20, 2022, 4:09 a.m. |
OK |
GNU C++14 |
TESTS |
40 |
93 |
1638400 |
|
|
186062147 |
ami_noob61 |
C |
Dec. 20, 2022, 5:02 a.m. |
OK |
GNU C++14 |
TESTS |
40 |
93 |
1638400 |
|
|
186060308 |
kimmoqt |
C |
Dec. 20, 2022, 4:32 a.m. |
OK |
GNU C++17 |
TESTS |
40 |
77 |
819200 |
|
|
186017188 |
0DouDou0 |
C |
Dec. 19, 2022, 5:11 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
78 |
819200 |
|
|
186018090 |
SWE_WanKu |
C |
Dec. 19, 2022, 5:15 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
78 |
819200 |
|
|
186051188 |
gjlccc |
C |
Dec. 20, 2022, 1:15 a.m. |
OK |
GNU C++17 |
TESTS |
40 |
78 |
1536000 |
|
|
186012039 |
Monarchuwu |
C |
Dec. 19, 2022, 4:34 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
78 |
1638400 |
|
|
186009932 |
zlc1114 |
C |
Dec. 19, 2022, 4:30 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
78 |
2457600 |
|
|
186036947 |
Dominater069 |
C |
Dec. 19, 2022, 7:37 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
78 |
3174400 |
|
|
186019026 |
longcheng_x |
C |
Dec. 19, 2022, 5:20 p.m. |
OK |
GNU C++17 |
TESTS |
40 |
78 |
4812800 |
|
|
186052495 |
bnu20DT |
C |
Dec. 20, 2022, 1:52 a.m. |
OK |
GNU C++17 |
TESTS |
40 |
92 |
819200 |
|
|
186059715 |
nanoblob |
C |
Dec. 20, 2022, 4:22 a.m. |
OK |
GNU C++17 |
TESTS |
40 |
92 |
1638400 |
|
|
186043075 |
enslaved |
C |
Dec. 19, 2022, 9:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
46 |
819200 |
|
|
186032985 |
Edu175 |
C |
Dec. 19, 2022, 6:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
46 |
1638400 |
|
|
186017934 |
Yra |
C |
Dec. 19, 2022, 5:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
61 |
819200 |
|
|
186039301 |
Prabhat0602 |
C |
Dec. 19, 2022, 8:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
61 |
1638400 |
|
|
186018847 |
emthrm |
C |
Dec. 19, 2022, 5:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
61 |
1638400 |
|
|
186018221 |
CurryWOE |
C |
Dec. 19, 2022, 5:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
61 |
1638400 |
|
|
186016119 |
zhangshaojia |
C |
Dec. 19, 2022, 5:06 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
61 |
1638400 |
|
|
186047758 |
stan23456 |
C |
Dec. 19, 2022, 11:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
61 |
1638400 |
|
|
186045838 |
lucasxia01 |
C |
Dec. 19, 2022, 10:09 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
61 |
1638400 |
|
|
186021945 |
illume2021 |
C |
Dec. 19, 2022, 5:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
61 |
48128000 |
|
|
186064565 |
Rish106 |
C |
Dec. 20, 2022, 5:38 a.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
31 |
24064000 |
|
|
186018854 |
Pravin2022 |
C |
Dec. 19, 2022, 5:19 p.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
46 |
0 |
|
|
186039613 |
AbdalrhmanEssam |
C |
Dec. 19, 2022, 8:05 p.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
46 |
819200 |
|
|
186051089 |
acceed |
C |
Dec. 20, 2022, 1:13 a.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
46 |
819200 |
|
|
186039248 |
GrigoriySol1902 |
C |
Dec. 19, 2022, 8 p.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
46 |
819200 |
|
|
186039167 |
achvanov |
C |
Dec. 19, 2022, 7:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
46 |
819200 |
|
|
186030593 |
NO__OB |
C |
Dec. 19, 2022, 6:38 p.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
46 |
819200 |
|
|
186025887 |
Gamal74 |
C |
Dec. 19, 2022, 6:03 p.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
46 |
819200 |
|
|
186019122 |
AnnKinoko |
C |
Dec. 19, 2022, 5:20 p.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
46 |
819200 |
|
|
186019022 |
Boboge |
C |
Dec. 19, 2022, 5:20 p.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
46 |
819200 |
|
|
186003546 |
akshatj07 |
C |
Dec. 19, 2022, 4:13 p.m. |
OK |
Java 11 |
TESTS |
40 |
295 |
4198400 |
|
|
186011313 |
Yuki_B |
C |
Dec. 19, 2022, 4:33 p.m. |
OK |
Java 11 |
TESTS |
40 |
467 |
0 |
|
|
186015365 |
HeXecutor |
C |
Dec. 19, 2022, 5:03 p.m. |
OK |
Java 11 |
TESTS |
40 |
545 |
0 |
|
|
186032689 |
profchi |
C |
Dec. 19, 2022, 6:55 p.m. |
OK |
Java 11 |
TESTS |
40 |
858 |
3072000 |
|
|
186022705 |
tushar_104 |
C |
Dec. 19, 2022, 5:42 p.m. |
OK |
Java 11 |
TESTS |
40 |
873 |
13824000 |
|
|
186045472 |
merlin_ |
C |
Dec. 19, 2022, 9:59 p.m. |
OK |
Java 17 |
TESTS |
40 |
343 |
23142400 |
|
|
186041359 |
megaspazz |
C |
Dec. 19, 2022, 8:34 p.m. |
OK |
Java 8 |
TESTS |
40 |
124 |
0 |
|
|
186061310 |
ikillmyself |
C |
Dec. 20, 2022, 4:49 a.m. |
OK |
Java 8 |
TESTS |
40 |
155 |
0 |
|
|
186048769 |
zakhar.iakov.lev |
C |
Dec. 19, 2022, 11:49 p.m. |
OK |
Java 8 |
TESTS |
40 |
170 |
11571200 |
|
|
186038302 |
NerfThis |
C |
Dec. 19, 2022, 7:51 p.m. |
OK |
Java 8 |
TESTS |
40 |
171 |
11571200 |
|
|
186036185 |
gagan_6730 |
C |
Dec. 19, 2022, 7:29 p.m. |
OK |
Java 8 |
TESTS |
40 |
186 |
11468800 |
|
|
186054859 |
cc4414 |
C |
Dec. 20, 2022, 2:55 a.m. |
OK |
Java 8 |
TESTS |
40 |
187 |
12800000 |
|
|
186015481 |
nikhil97agra |
C |
Dec. 19, 2022, 5:04 p.m. |
OK |
Java 8 |
TESTS |
40 |
187 |
14745600 |
|
|
186015156 |
vaibhav_1710 |
C |
Dec. 19, 2022, 5:02 p.m. |
OK |
Java 8 |
TESTS |
40 |
202 |
15564800 |
|
|
186062418 |
Sanat04 |
C |
Dec. 20, 2022, 5:06 a.m. |
OK |
Java 8 |
TESTS |
40 |
452 |
0 |
|
|
186003988 |
harshsingla06 |
C |
Dec. 19, 2022, 4:14 p.m. |
OK |
Java 8 |
TESTS |
40 |
795 |
11264000 |
|
|
186023645 |
reversir |
C |
Dec. 19, 2022, 5:47 p.m. |
OK |
MS C++ 2017 |
TESTS |
40 |
577 |
0 |
|
|
186019694 |
kgykdy |
C |
Dec. 19, 2022, 5:24 p.m. |
OK |
MS C++ 2017 |
TESTS |
40 |
592 |
1740800 |
|
|
186038061 |
fatant |
C |
Dec. 19, 2022, 7:48 p.m. |
OK |
MS C++ 2017 |
TESTS |
40 |
607 |
1638400 |
|
|
186019832 |
kgykdy |
C |
Dec. 19, 2022, 5:24 p.m. |
OK |
MS C++ 2017 |
TESTS |
40 |
608 |
1740800 |
|
|
186004766 |
xxh1999 |
C |
Dec. 19, 2022, 4:16 p.m. |
OK |
PyPy 3 |
TESTS |
40 |
482 |
19558400 |
|
|
186061833 |
Raindrops1117 |
C |
Dec. 20, 2022, 4:57 a.m. |
OK |
PyPy 3 |
TESTS |
40 |
623 |
19148800 |
|
|
186019492 |
fireSlayer57 |
C |
Dec. 19, 2022, 5:22 p.m. |
OK |
PyPy 3 |
TESTS |
40 |
1591 |
19148800 |
|
|
186016606 |
wuh |
C |
Dec. 19, 2022, 5:08 p.m. |
OK |
PyPy 3-64 |
TESTS |
40 |
139 |
29900800 |
|
|
186048644 |
beethoven97 |
C |
Dec. 19, 2022, 11:44 p.m. |
OK |
PyPy 3-64 |
TESTS |
40 |
155 |
20992000 |
|
|
186054378 |
Zaurez |
C |
Dec. 20, 2022, 2:44 a.m. |
OK |
PyPy 3-64 |
TESTS |
40 |
187 |
20992000 |
|
|
186048596 |
beethoven97 |
C |
Dec. 19, 2022, 11:42 p.m. |
OK |
PyPy 3-64 |
TESTS |
40 |
187 |
20992000 |
|
|
186048479 |
beethoven97 |
C |
Dec. 19, 2022, 11:38 p.m. |
OK |
PyPy 3-64 |
TESTS |
40 |
187 |
20992000 |
|
|
186005805 |
Alex239 |
C |
Dec. 19, 2022, 4:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
40 |
202 |
20582400 |
|
|
186047695 |
beethoven97 |
C |
Dec. 19, 2022, 11:09 p.m. |
OK |
PyPy 3-64 |
TESTS |
40 |
202 |
20992000 |
|
|
186053579 |
mikeac |
C |
Dec. 20, 2022, 2:23 a.m. |
OK |
PyPy 3-64 |
TESTS |
40 |
202 |
29696000 |
|
|
186030079 |
pratyush155 |
C |
Dec. 19, 2022, 6:34 p.m. |
OK |
PyPy 3-64 |
TESTS |
40 |
202 |
30003200 |
|
|
186036140 |
denilb |
C |
Dec. 19, 2022, 7:28 p.m. |
OK |
PyPy 3-64 |
TESTS |
40 |
202 |
31539200 |
|
|
186019342 |
meohenbk |
C |
Dec. 19, 2022, 5:22 p.m. |
OK |
Python 3 |
TESTS |
40 |
1045 |
18636800 |
|
|
186018485 |
fake_fan |
C |
Dec. 19, 2022, 5:17 p.m. |
OK |
Python 3 |
TESTS |
40 |
1060 |
16486400 |
|
|
186062854 |
kulwantraj1997 |
C |
Dec. 20, 2022, 5:13 a.m. |
OK |
Python 3 |
TESTS |
40 |
1060 |
17612800 |
|
|
186018974 |
Musab1Blaser |
C |
Dec. 19, 2022, 5:19 p.m. |
OK |
Python 3 |
TESTS |
40 |
1060 |
18022400 |
|
|
186016928 |
mariemmohamed200713 |
C |
Dec. 19, 2022, 5:09 p.m. |
OK |
Python 3 |
TESTS |
40 |
1060 |
18022400 |
|
|
186010681 |
lfss_zxj |
C |
Dec. 19, 2022, 4:32 p.m. |
OK |
Python 3 |
TESTS |
40 |
1060 |
18022400 |
|
|
186017942 |
big_coder |
C |
Dec. 19, 2022, 5:14 p.m. |
OK |
Python 3 |
TESTS |
40 |
1106 |
17612800 |
|
|
186022163 |
VictorS |
C |
Dec. 19, 2022, 5:38 p.m. |
OK |
Python 3 |
TESTS |
40 |
1107 |
17612800 |
|
|
186033904 |
tanmayjagtap |
C |
Dec. 19, 2022, 7:06 p.m. |
OK |
Python 3 |
TESTS |
40 |
1170 |
16486400 |
|
|
186056926 |
bqn |
C |
Dec. 20, 2022, 3:34 a.m. |
OK |
Rust 2021 |
TESTS |
40 |
77 |
13107200 |
|
|
186044783 |
Olympia |
C |
Dec. 19, 2022, 9:41 p.m. |
OK |
Rust 2021 |
TESTS |
40 |
686 |
16998400 |
|
|
186044796 |
Olympia |
C |
Dec. 19, 2022, 9:42 p.m. |
OK |
Rust 2021 |
TESTS |
40 |
748 |
16896000 |
|
|
186044817 |
Olympia |
C |
Dec. 19, 2022, 9:42 p.m. |
OK |
Rust 2021 |
TESTS |
40 |
826 |
16896000 |
|
|
remove filters
Back to search problems