Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.005 s | 1 KBi |
#2 |
Incorrecto
|
0.005 s | 1 KBi |
#3 |
Incorrecto
|
0.004 s | 1 KBi |
#4 |
Incorrecto
|
0.004 s | 1 KBi |
#5 |
Incorrecto
|
0.004 s | 1 KBi |
#6 |
Incorrecto
|
0.005 s | 1 KBi |
#7 |
Incorrecto
|
0.005 s | 1 KBi |
#8 |
Incorrecto
|
0.005 s | 1 KBi |
#9 |
Incorrecto
|
0.005 s | 1 KBi |
#10 |
Incorrecto
|
0.004 s | 1 KBi |
#11 |
Incorrecto
|
0.004 s | 1 KBi |
#12 |
Incorrecto
|
0.004 s | 1 KBi |
#13 |
Incorrecto
|
0.005 s | 2 KBi |
#14 |
Incorrecto
|
0.004 s | 1 KBi |
#15 |
Incorrecto
|
0.004 s | 1 KBi |
#16 |
Incorrecto
|
0.004 s | 1 KBi |
#17 |
Incorrecto
|
0.004 s | 1 KBi |
#18 |
Incorrecto
|
0.003 s | 1 KBi |
#19 |
Incorrecto
|
0.003 s | 1 KBi |
#20 |
Incorrecto
|
0.005 s | 1 KBi |
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> using namespace std; int main() { int n; cout<<n; long sumsl[n]; long sumsr[n]; int i=0; long sum=0; int nums[n]; for(;i<n;i++ ) { cin >> nums[i]; sum += nums[i]; sumsl[i] =sum; } sum=0; for(i=n-1;i>=0;i-- ) { sum += nums[i]; sumsr[i] =sum; } bool possible; for(i=0;i<n-1;i++ ) { long left = sumsl[i]; long right = sumsr[i+1]; if(left > 0 && right < 0) { possible = true; break; } } if(possible) cout << (i+1); else cout << "Impossible"; return 0; }