Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.089 s | 17 KBi |
#2 |
Correcto
|
0.136 s | 14 KBi |
#3 |
Correcto
|
0.087 s | 16 KBi |
#4 |
Correcto
|
0.081 s | 16 KBi |
#5 |
Correcto
|
0.159 s | 16 KBi |
#6 |
Correcto
|
0.08 s | 16 KBi |
#7 |
Correcto
|
0.084 s | 16 KBi |
#8 |
Correcto
|
0.164 s | 14 KBi |
#9 |
Correcto
|
0.089 s | 16 KBi |
#10 |
Correcto
|
0.153 s | 14 KBi |
#11 |
Correcto
|
0.086 s | 16 KBi |
#12 |
Correcto
|
0.123 s | 18 KBi |
#13 |
Correcto
|
0.115 s | 19 KBi |
#14 |
Correcto
|
0.984 s | 125 KBi |
#15 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/openjdk13/bin/java Main |
0.498 s | 125 KBi |
#16 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/openjdk13/bin/java Main |
0.469 s | 125 KBi |
#17 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/openjdk13/bin/java Main |
0.571 s | 125 KBi |
#18 |
Tiempo límite excedido
|
1.005 s | 125 KBi |
#19 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/openjdk13/bin/java Main |
0.488 s | 125 KBi |
#20 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/openjdk13/bin/java Main |
0.563 s | 125 KBi |
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); long totalCount = 0; ArrayList<Long> leftPositive = new ArrayList<>(); ArrayList<Integer> leftPositiveIndexes = new ArrayList<>(); for(int i=0; i<n; i++){ int x = scanner.nextInt(); totalCount+=x; if(totalCount > 0){ leftPositiveIndexes.add(i); leftPositive.add(totalCount); } } boolean flag = true; for(int i=0; i<leftPositiveIndexes.size(); i++){ long left = leftPositive.get(i); long right = totalCount - left; if(right < 0){ System.out.println(leftPositiveIndexes.get(i)+1); flag = false; break; } } if(flag){ System.out.println("Impossible"); } } }