Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.048 s | 14 KBi |
#2 |
Correcto
|
0.049 s | 15 KBi |
#3 |
Correcto
|
0.043 s | 14 KBi |
#4 |
Correcto
|
0.05 s | 13 KBi |
#5 |
Correcto
|
0.045 s | 14 KBi |
#6 |
Correcto
|
0.067 s | 10 KBi |
#7 |
Correcto
|
0.04 s | 14 KBi |
#8 |
Correcto
|
0.076 s | 50 KBi |
#9 |
Correcto
|
0.035 s | 14 KBi |
#10 |
Correcto
|
0.048 s | 14 KBi |
#11 |
Correcto
|
0.047 s | 13 KBi |
#12 |
Incorrecto
|
0.056 s | 15 KBi |
#13 |
Incorrecto
|
0.054 s | 14 KBi |
#14 |
Incorrecto
|
0.219 s | 50 KBi |
#15 |
Correcto
|
0.23 s | 48 KBi |
#16 |
Correcto
|
0.266 s | 50 KBi |
#17 |
Correcto
|
0.239 s | 50 KBi |
#18 |
Correcto
|
0.246 s | 50 KBi |
#19 |
Correcto
|
0.449 s | 36 KBi |
#20 |
Incorrecto
|
0.517 s | 95 KBi |
import java.io.*; import java.util.*; class Main { public static void main(String[] args) throws IOException{ List<Integer> arr = new ArrayList<Integer>(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; st = new StringTokenizer(br.readLine()); st = new StringTokenizer(br.readLine()); int res = 0; int clave = 0; while(st.hasMoreTokens()){ arr.add(Integer.parseInt(st.nextToken())); } for(int i=arr.size()-1;i>=0;i--){ res+=arr.get(i); if(res<0){ clave=i; } } if(clave == 0){ System.out.println("Impossible"); }else{ System.out.println(clave); } } }