Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.144 s | 16 KBi |
#2 |
Correcto
|
0.146 s | 22 KBi |
#3 |
Correcto
|
0.091 s | 16 KBi |
#4 |
Correcto
|
0.082 s | 16 KBi |
#5 |
Correcto
|
0.141 s | 17 KBi |
#6 |
Correcto
|
0.082 s | 16 KBi |
#7 |
Correcto
|
0.081 s | 16 KBi |
#8 |
Correcto
|
0.08 s | 16 KBi |
#9 |
Correcto
|
0.106 s | 17 KBi |
#10 |
Correcto
|
0.083 s | 16 KBi |
#11 |
Correcto
|
0.082 s | 16 KBi |
#12 |
Correcto
|
0.113 s | 19 KBi |
#13 |
Correcto
|
0.109 s | 18 KBi |
#14 |
Correcto
|
0.771 s | 125 KBi |
#15 |
Tiempo límite excedido
|
1.112 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.414 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.464 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.539 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.542 s | 125 KBi |
#20 |
Tiempo límite excedido
|
1.119 s | 94 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; //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(leftPositiveIndexes.get(i)+1); flag = false; break; } } if(flag){ System.out.println("Impossible"); } } }