Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error de compilación
Compilation time limit exceeded. |
||
#2 |
Error de compilación
Compilation time limit exceeded. |
||
#3 |
Error de compilación
Compilation time limit exceeded. |
||
#4 |
Error de compilación
Compilation time limit exceeded. |
||
#5 |
Error de compilación
Compilation time limit exceeded. |
||
#6 |
Error de compilación
Compilation time limit exceeded. |
||
#7 |
Error de compilación
Compilation time limit exceeded. |
||
#8 |
Correcto
|
0.005 s | 14 KBi |
#9 |
Correcto
|
0.005 s | 7 KBi |
#10 |
Error de compilación
Compilation time limit exceeded. |
||
#11 |
Error de compilación
Compilation time limit exceeded. |
||
#12 |
Error de compilación
Compilation time limit exceeded. |
||
#13 |
Incorrecto
|
0.005 s | 6 KBi |
#14 |
Incorrecto
|
0.05 s | 11 KBi |
#15 |
Correcto
|
0.044 s | 10 KBi |
#16 |
Correcto
|
0.045 s | 10 KBi |
#17 |
Correcto
|
0.043 s | 10 KBi |
#18 |
Correcto
|
0.041 s | 10 KBi |
#19 |
Correcto
|
0.044 s | 10 KBi |
#20 |
Incorrecto
|
0.056 s | 34 KBi |
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long const int maxi = 500001; ll a[maxi]; ll prefix[maxi]; int main(){ ios::sync_with_stdio(0); cin.tie(0); 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; }