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 |
Error de compilación
Compilation time limit exceeded. |
||
#9 |
Error de compilación
Compilation time limit exceeded. |
||
#10 |
Correcto
|
0.075 s | 20 KBi |
#11 |
Error de compilación
Compilation time limit exceeded. |
||
#12 |
Error de compilación
Compilation time limit exceeded. |
||
#13 |
Error de compilación
Compilation time limit exceeded. |
||
#14 |
Correcto
|
0.318 s | 64 KBi |
#15 |
Error de compilación
Compilation time limit exceeded. |
||
#16 |
Correcto
|
0.344 s | 38 KBi |
#17 |
Error de compilación
Compilation time limit exceeded. |
||
#18 |
Error de compilación
Compilation time limit exceeded. |
||
#19 |
Correcto
|
0.332 s | 46 KBi |
#20 |
Error de compilación
Compilation time limit exceeded. |
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; class Main{ public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int n, l = 0, r = 0, A[]; boolean flag = false; n = Integer.parseInt(br.readLine()); A = new int[n]; st = new StringTokenizer(br.readLine()); for (int i = 0; i < n; i++) { A[i] = Integer.parseInt(st.nextToken()); r += A[i]; } for (int i = 0; i < n; i++) { if (l > 0 && r < 0) { System.out.println(i); flag = true; break; } l += A[i]; r -= A[i]; } if (!flag) { System.out.println("Impossible"); } } }