Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.037 s | 3 KBi |
#2 |
Correcto
|
0.035 s | 3 KBi |
#3 |
Correcto
|
0.029 s | 3 KBi |
#4 |
Correcto
|
0.031 s | 3 KBi |
#5 |
Correcto
|
0.041 s | 3 KBi |
#6 |
Correcto
|
0.028 s | 3 KBi |
#7 |
Correcto
|
0.025 s | 3 KBi |
#8 |
Correcto
|
0.025 s | 3 KBi |
#9 |
Correcto
|
0.033 s | 3 KBi |
#10 |
Incorrecto
|
0.025 s | 3 KBi |
#11 |
Correcto
|
0.028 s | 3 KBi |
#12 |
Incorrecto
|
0.037 s | 3 KBi |
#13 |
Incorrecto
|
0.032 s | 3 KBi |
#14 |
Incorrecto
|
0.034 s | 3 KBi |
#15 |
Incorrecto
|
0.032 s | 3 KBi |
#16 |
Incorrecto
|
0.025 s | 3 KBi |
#17 |
Correcto
|
0.091 s | 11 KBi |
#18 |
Correcto
|
0.107 s | 12 KBi |
#19 |
Incorrecto
|
0.094 s | 12 KBi |
#20 |
Correcto
|
0.099 s | 12 KBi |
#21 |
Correcto
|
0.078 s | 12 KBi |
#22 |
Incorrecto
|
0.087 s | 11 KBi |
#23 |
Incorrecto
|
0.089 s | 11 KBi |
#24 |
Incorrecto
|
0.085 s | 11 KBi |
"""test of sum max subarray""" def find(a): if len(a) == 1: return a[0] mx = a[0] pref = mx for j in range(1, len(a)): sj = pref + a[j] pref = max(mx, sj) mx = pref pref = sj return mx n = int(input()) a = [int(x) for x in input().split()] print(find(a))