█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 993

Problema 0xf2 - Partir un arreglo grande en 2

  • Autor: aebernalmunoz
  • Fecha: 2020-10-06 06:12:41 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Compilation time limit exceeded.
                    
#2
Error de compilación
                      Compilation time limit exceeded.
                    
#3
Error de compilación
                      Compilation time limit exceeded.
                    
#4
Error de compilación
                      Compilation time limit exceeded.
                    
#5
Error de compilación
                      Compilation time limit exceeded.
                    
#6
Error de compilación
                      Compilation time limit exceeded.
                    
#7
Correcto
0.085 s 10 KBi
#8
Error de compilación
                      Compilation time limit exceeded.
                    
#9
Error de compilación
                      Compilation time limit exceeded.
                    
#10
Error de compilación
                      Compilation time limit exceeded.
                    
#11
Error de compilación
                      Compilation time limit exceeded.
                    
#12
Error de compilación
                      Compilation time limit exceeded.
                    
#13
Error de compilación
                      Compilation time limit exceeded.
                    
#14
Error de compilación
                      Compilation time limit exceeded.
                    
#15
Error de compilación
                      Compilation time limit exceeded.
                    
#16
Correcto
0.429 s 38 KBi
#17
Correcto
0.41 s 38 KBi
#18
Correcto
0.39 s 38 KBi
#19
Error de compilación
                      Compilation time limit exceeded.
                    
#20
Tiempo límite excedido
0.467 s 44 KBi
Puntos totales: 20 / 100

Código

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Main{
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		FastReader s = new FastReader();
		int n, l = 0, r = 0, A[];
		boolean flag = false;
		n = s.nextInt();
		A = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = s.nextInt();
			r += A[i];
		}

		for (int i = 0; i < n; i++) {
			if (l > 0 && r < 0) {
				System.out.println(i);
				flag = true;
				break;
			}
			l += A[i];
			r -= A[i];
		}
		if (!flag) {
			System.out.println("Impossible");
		}

	}

}