Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 2 KBi |
#2 |
Correcto
|
0.005 s | 1 KBi |
#3 |
Correcto
|
0.006 s | 1 KBi |
#4 |
Correcto
|
0.006 s | 2 KBi |
#5 |
Correcto
|
0.006 s | 1 KBi |
#6 |
Correcto
|
0.006 s | 1 KBi |
#7 |
Correcto
|
0.005 s | 1 KBi |
#8 |
Correcto
|
0.005 s | 2 KBi |
#9 |
Correcto
|
0.006 s | 11 KBi |
#10 |
Correcto
|
0.005 s | 1 KBi |
#11 |
Correcto
|
0.005 s | 1 KBi |
#12 |
Correcto
|
0.005 s | 1 KBi |
#13 |
Correcto
|
0.005 s | 2 KBi |
#14 |
Correcto
|
0.095 s | 5 KBi |
#15 |
Correcto
|
0.088 s | 5 KBi |
#16 |
Correcto
|
0.107 s | 5 KBi |
#17 |
Correcto
|
0.1 s | 5 KBi |
#18 |
Correcto
|
0.1 s | 5 KBi |
#19 |
Correcto
|
0.096 s | 5 KBi |
#20 |
Correcto
|
0.14 s | 7 KBi |
#include <iostream> #include <vector> using namespace std; int main(void) { long size, lp = 0, rp = 0; cin >> size; vector<int> toRight(size); vector<int> toLeft(size); for (long i = 0; i < size; i++) { cin >> toRight[i]; toLeft[i] = toRight[i]; } for (long i = size - 2; i >= 0; i--) toLeft[i] += toLeft[i + 1]; for (long i = 1; i < size; i++) toRight[i] += toRight[i - 1]; for (long i = 0; i < size - 1; i++) { if (toRight[i] > 0 && toLeft[i + 1] < 0) { cout << i + 1 << endl; return (0); } } cout << "Impossible" << endl; return (0); }