Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 1 KBi |
#2 |
Correcto
|
0.005 s | 2 KBi |
#3 |
Correcto
|
0.005 s | 7 KBi |
#4 |
Correcto
|
0.005 s | 1 KBi |
#5 |
Correcto
|
0.005 s | 8 KBi |
#6 |
Correcto
|
0.005 s | 2 KBi |
#7 |
Correcto
|
0.005 s | 1 KBi |
#8 |
Correcto
|
0.005 s | 1 KBi |
#9 |
Correcto
|
0.005 s | 1 KBi |
#10 |
Correcto
|
0.005 s | 1 KBi |
#11 |
Correcto
|
0.005 s | 5 KBi |
#12 |
Incorrecto
|
0.005 s | 1 KBi |
#13 |
Incorrecto
|
0.005 s | 1 KBi |
#14 |
Incorrecto
|
0.085 s | 8 KBi |
#15 |
Correcto
|
0.077 s | 10 KBi |
#16 |
Correcto
|
0.085 s | 11 KBi |
#17 |
Correcto
|
0.085 s | 8 KBi |
#18 |
Correcto
|
0.09 s | 8 KBi |
#19 |
Correcto
|
0.088 s | 9 KBi |
#20 |
Incorrecto
|
0.109 s | 9 KBi |
#include <iostream> using namespace std; #define endl '\n' #define ll long long const int maxi = 500010; ll a[maxi]; ll prefix[maxi]; int main(){ int n; cin>>n; for(int i=0;i<n; i++){ cin>>a[i]; } for(int i=n; i>=0; i--){ prefix[i]=(prefix[i+1]+a[i]); } if(prefix[0]<0){ cout<<"Impossible"<<endl; return 0; } for(int i=0;i<=n; i++){ if(prefix[i]<0){ cout<<i<<endl; return 0; } } cout<<"Impossible"<<endl; return 0; }