Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.073 s | 13 KBi |
#2 |
Correcto
|
0.087 s | 10 KBi |
#3 |
Correcto
|
0.071 s | 13 KBi |
#4 |
Correcto
|
0.078 s | 13 KBi |
#5 |
Correcto
|
0.073 s | 13 KBi |
#6 |
Correcto
|
0.093 s | 13 KBi |
#7 |
Correcto
|
0.084 s | 13 KBi |
#8 |
Correcto
|
0.069 s | 13 KBi |
#9 |
Correcto
|
0.077 s | 13 KBi |
#10 |
Correcto
|
0.074 s | 13 KBi |
#11 |
Correcto
|
0.08 s | 13 KBi |
#12 |
Correcto
|
0.081 s | 14 KBi |
#13 |
Correcto
|
0.096 s | 13 KBi |
#14 |
Correcto
|
0.425 s | 35 KBi |
#15 |
Correcto
|
0.382 s | 45 KBi |
#16 |
Correcto
|
0.417 s | 46 KBi |
#17 |
Correcto
|
0.423 s | 47 KBi |
#18 |
Correcto
|
0.518 s | 32 KBi |
#19 |
Correcto
|
0.491 s | 34 KBi |
#20 |
Correcto
|
0.508 s | 51 KBi |
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; for(String ln; (ln=in.readLine())!=null;) { int N = Integer.parseInt(ln); st = new StringTokenizer(in.readLine()); int[] values = new int[N]; int left =0, total =0, right = 0; for(int i=0;i<N;i++) { right+= values[i] = Integer.parseInt(st.nextToken()); } for( int p=0; p<N; p++){ if(left>0 && right<0){ System.out.println(p); return; } right -=values[p]; left+=values[p]; } System.out.println("Impossible"); } } }