Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.08 s | 16 KBi |
#2 |
Incorrecto
|
0.087 s | 16 KBi |
#3 |
Incorrecto
|
0.084 s | 16 KBi |
#4 |
Correcto
|
0.092 s | 17 KBi |
#5 |
Incorrecto
|
0.081 s | 16 KBi |
#6 |
Correcto
|
0.104 s | 17 KBi |
#7 |
Correcto
|
0.083 s | 16 KBi |
#8 |
Correcto
|
0.088 s | 16 KBi |
#9 |
Correcto
|
0.08 s | 16 KBi |
#10 |
Incorrecto
|
0.093 s | 17 KBi |
#11 |
Incorrecto
|
0.086 s | 16 KBi |
#12 |
Incorrecto
|
0.137 s | 19 KBi |
#13 |
Incorrecto
|
0.116 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.548 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.488 s | 125 KBi |
#16 |
Correcto
|
0.813 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.569 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.513 s | 125 KBi |
#19 |
Incorrecto
|
0.947 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.544 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<Long> leftPositive = new ArrayList<>(); //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.add(totalCount); } } } boolean flag = true; for(int i=0; i<leftPositive.size(); i++){ long left = leftPositive.get(i); long right = totalCount - left; if(right < 0){ System.out.println(leftPositive.get(i)+1); flag = false; break; } } if(flag){ System.out.println("Impossible"); } } }