Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.08 s | 16 KBi |
#2 |
Correcto
|
0.076 s | 16 KBi |
#3 |
Incorrecto
|
0.079 s | 16 KBi |
#4 |
Incorrecto
|
0.159 s | 14 KBi |
#5 |
Correcto
|
0.078 s | 16 KBi |
#6 |
Incorrecto
|
0.081 s | 16 KBi |
#7 |
Incorrecto
|
0.149 s | 14 KBi |
#8 |
Incorrecto
|
0.076 s | 16 KBi |
#9 |
Incorrecto
|
0.083 s | 16 KBi |
#10 |
Correcto
|
0.081 s | 16 KBi |
#11 |
Correcto
|
0.082 s | 16 KBi |
#12 |
Incorrecto
|
0.235 s | 16 KBi |
#13 |
Incorrecto
|
0.122 s | 18 KBi |
#14 |
Tiempo límite excedido
|
1.033 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.536 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.465 s | 125 KBi |
#17 |
Tiempo límite excedido
|
1.073 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.474 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.532 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.564 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); } } 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); } } } }