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'Polycarp found under the Christmas tree an array a of n elements and instructions for playing with it: For example, if n = 5 and a = [7, 3, 1, 2, 3] , then the following game options are possible: Help Polycarp to find out the maximum score he can get if he chooses the starting index in an optimal way. The first line contains one integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. Then t test cases follow. The first line of each test case contains one integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the length of the array a . The next line contains n integers a_1, a_2, ... , a_n ( 1 <= q a_i <= q 10^9 ) -- elements of the array a . It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output on a separate line one number -- the maximum score that Polycarp can get by playing the game on the corresponding array according to the instruction from the statement. Note that Polycarp chooses any starting position from 1 to n in such a way as to maximize his result. The first test case is explained in the statement. In the second test case, the maximum score can be achieved by choosing i = 1 . In the third test case, the maximum score can be achieved by choosing i = 2 . In the fourth test case, the maximum score can be achieved by choosing i = 1 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
103336134 |
icysky |
C |
Jan. 5, 2021, 2:14 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
12 |
93 |
4198400 |
|
|
103343960 |
run_with_sunshine |
C |
Jan. 5, 2021, 5:31 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
31 |
1638400 |
|
|
103341934 |
run_with_sunshine |
C |
Jan. 5, 2021, 4:42 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
31 |
1638400 |
|
|
103308957 |
anubhav_k |
C |
Jan. 4, 2021, 5:09 p.m. |
OK |
GNU C++11 |
TESTS |
12 |
31 |
1638400 |
|
|
103305339 |
Iknowinoob |
C |
Jan. 4, 2021, 4:47 p.m. |
OK |
GNU C++11 |
TESTS |
12 |
46 |
1024000 |
|
|
103312891 |
georgerapeanu |
C |
Jan. 4, 2021, 5:41 p.m. |
OK |
GNU C++11 |
TESTS |
12 |
46 |
1638400 |
|
|
103336320 |
20050901 |
C |
Jan. 5, 2021, 2:19 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
46 |
1638400 |
|
|
103345604 |
shyyhsac |
C |
Jan. 5, 2021, 5:58 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
46 |
2457600 |
|
|
103341100 |
Rainer1116 |
C |
Jan. 5, 2021, 4:24 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
46 |
3174400 |
|
|
103336546 |
ce_amtic |
C |
Jan. 5, 2021, 2:26 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
46 |
3174400 |
|
|
103338337 |
iyua |
C |
Jan. 5, 2021, 3:21 a.m. |
OK |
GNU C++11 |
TESTS |
12 |
46 |
5529600 |
|
|
103320296 |
ansergeyg |
C |
Jan. 4, 2021, 7:08 p.m. |
OK |
.NET Core C# |
TESTS |
12 |
420 |
27443200 |
|
|
remove filters
Back to search problems