Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.006 s | 12 KBi |
#2 |
Incorrecto
|
0.006 s | 1 KBi |
#3 |
Incorrecto
|
0.006 s | 5 KBi |
#4 |
Incorrecto
|
0.005 s | 7 KBi |
#5 |
Incorrecto
|
0.005 s | 1 KBi |
#6 |
Incorrecto
|
0.006 s | 3 KBi |
#7 |
Incorrecto
|
0.004 s | 1 KBi |
#8 |
Incorrecto
|
0.004 s | 2 KBi |
#9 |
Incorrecto
|
0.005 s | 2 KBi |
#10 |
Incorrecto
|
0.005 s | 17 KBi |
#11 |
Incorrecto
|
0.006 s | 3 KBi |
#12 |
Incorrecto
|
0.006 s | 1 KBi |
#13 |
Incorrecto
|
0.008 s | 4 KBi |
#14 |
Incorrecto
|
0.007 s | 10 KBi |
#15 |
Incorrecto
|
0.006 s | 7 KBi |
#16 |
Incorrecto
|
0.005 s | 2 KBi |
#17 |
Incorrecto
|
0.048 s | 3 KBi |
#18 |
Incorrecto
|
0.054 s | 10 KBi |
#19 |
Incorrecto
|
0.08 s | 2 KBi |
#20 |
Incorrecto
|
0.068 s | 2 KBi |
#21 |
Incorrecto
|
0.034 s | 3 KBi |
#22 |
Incorrecto
|
0.061 s | 6 KBi |
#23 |
Incorrecto
|
0.045 s | 30 KBi |
#24 |
Incorrecto
|
0.025 s | 5 KBi |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int n; cin >> n; vector<ll> arr(n); for(int i = 0; i < n; ++i) cin >> arr[i]; ll best = -10e10, curr = -10e10; for(ll i: arr){ curr = max(curr, curr + i); best = max(best, curr); } cout << best; return 0; }