Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 1 KBi |
#2 |
Incorrecto
|
0.006 s | 1 KBi |
#3 |
Correcto
|
0.006 s | 1 KBi |
#4 |
Correcto
|
0.007 s | 1 KBi |
#5 |
Correcto
|
0.005 s | 2 KBi |
#6 |
Correcto
|
0.008 s | 2 KBi |
#7 |
Correcto
|
0.006 s | 1 KBi |
#8 |
Correcto
|
0.006 s | 2 KBi |
#9 |
Incorrecto
|
0.006 s | 1 KBi |
#10 |
Correcto
|
0.006 s | 1 KBi |
#11 |
Incorrecto
|
0.006 s | 2 KBi |
#12 |
Incorrecto
|
0.006 s | 1 KBi |
#13 |
Incorrecto
|
0.006 s | 2 KBi |
#14 |
Correcto
|
0.006 s | 1 KBi |
#15 |
Incorrecto
|
0.018 s | 9 KBi |
#16 |
Incorrecto
|
0.017 s | 9 KBi |
#17 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed ./a.out |
0.17 s | 125 KBi |
#18 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed ./a.out |
0.171 s | 125 KBi |
#19 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed ./a.out |
0.186 s | 125 KBi |
#20 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed ./a.out |
0.218 s | 125 KBi |
#21 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed ./a.out |
0.157 s | 125 KBi |
#22 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed ./a.out |
0.231 s | 125 KBi |
#23 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed ./a.out |
0.162 s | 125 KBi |
#24 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed ./a.out |
0.169 s | 125 KBi |
#include <iostream> #include <vector> #include <algorithm> // std::max #include <limits.h> using namespace std; long dp(vector<long> a, int j){ if(j < 0) return 0; long max1 = max(a[j], a[j]+dp(a, j-1)); return max1; } /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { int n; cin >> n; vector<long> a(n); for(int i=0;i<n;i++){ cin >> a[i] ; } cout << dp(a, n-1) << endl; }