Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.078 s | 16 KBi |
#2 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:30) |
0.082 s | 16 KBi |
#3 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:30) |
0.091 s | 16 KBi |
#4 |
Correcto
|
0.09 s | 16 KBi |
#5 |
Correcto
|
0.079 s | 16 KBi |
#6 |
Correcto
|
0.081 s | 16 KBi |
#7 |
Correcto
|
0.082 s | 16 KBi |
#8 |
Correcto
|
0.082 s | 16 KBi |
#9 |
Correcto
|
0.084 s | 16 KBi |
#10 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:30) |
0.089 s | 16 KBi |
#11 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:30) |
0.125 s | 17 KBi |
#12 |
Correcto
|
0.111 s | 18 KBi |
#13 |
Error en tiempo de ejecución (NZEC)
Exited with error status 1 Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:30) |
0.135 s | 19 KBi |
#14 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/openjdk13/bin/java Main |
0.467 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.476 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.413 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.483 s | 125 KBi |
#18 |
Error en tiempo de ejecución (NZEC)
Exited with error status 137 run: line 1: 3 Killed /usr/local/openjdk13/bin/java Main |
0.505 s | 125 KBi |
#19 |
Tiempo límite excedido
|
1.072 s | 94 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.559 s | 125 KBi |
import java.util.ArrayList; import java.util.HashMap; 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; HashMap<Integer, Long> leftPositive = new HashMap<>(); ArrayList<Integer> leftPositiveIndexes = new ArrayList<>(); long oldTotalCount=0; for(int i=0; i<n; i++){ int x = scanner.nextInt(); totalCount+=x; if(totalCount > 0){ if(oldTotalCount<totalCount){ oldTotalCount = totalCount; leftPositiveIndexes.add(i); leftPositive.put(i, 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"); } } }