Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.008 s | 2 KBi |
#2 |
Correcto
|
0.007 s | 2 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.006 s | 1 KBi |
#5 |
Incorrecto
|
0.007 s | 1 KBi |
#6 |
Correcto
|
0.007 s | 2 KBi |
#7 |
Correcto
|
0.007 s | 2 KBi |
#8 |
Correcto
|
0.005 s | 2 KBi |
#9 |
Correcto
|
0.007 s | 1 KBi |
#10 |
Incorrecto
|
0.005 s | 2 KBi |
#11 |
Incorrecto
|
0.006 s | 1 KBi |
#12 |
Incorrecto
|
0.01 s | 2 KBi |
#13 |
Incorrecto
|
0.006 s | 2 KBi |
#14 |
Incorrecto
|
0.168 s | 3 KBi |
#15 |
Incorrecto
|
0.1 s | 3 KBi |
#16 |
Correcto
|
0.158 s | 3 KBi |
#17 |
Incorrecto
|
0.155 s | 3 KBi |
#18 |
Incorrecto
|
0.111 s | 3 KBi |
#19 |
Incorrecto
|
0.119 s | 3 KBi |
#20 |
Incorrecto
|
0.201 s | 3 KBi |
#include <iostream> #include <vector> using namespace std; int main(){ int n; cin >> n; vector<int> a(n); for(int i= 0;i <n;++i){ cin >> a[i]; } bool continuar = true; int pos = 0; int sumaizq =a[0]; while(continuar && pos<n){ int sumader = 0; if(sumaizq>0){ for(int k= pos ;k<n;++k){ sumader += a[k]; } } if(sumaizq>0 && sumader <0){ cout << pos << endl; continuar = false; return 0; } pos++; sumaizq += a[pos]; } if(pos == n){ cout << "Impossible"<< endl; return 0; } // 5 // -1 2 3 4 -5 }