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

Envío 3318

Problema 0x25 - Suma de un subarreglo grande

Caso # Resultado Tiempo Memoria
#1
Correcto
0.025 s 3 KBi
#2
Correcto
0.024 s 3 KBi
#3
Correcto
0.023 s 3 KBi
#4
Correcto
0.023 s 3 KBi
#5
Correcto
0.021 s 3 KBi
#6
Correcto
0.022 s 3 KBi
#7
Correcto
0.023 s 3 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/python-3.8.1/bin/python3 script.py
0.25 s 125 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/python-3.8.1/bin/python3 script.py
0.33 s 125 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/python-3.8.1/bin/python3 script.py
0.309 s 125 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/python-3.8.1/bin/python3 script.py
0.291 s 125 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/python-3.8.1/bin/python3 script.py
0.312 s 125 KBi
#13
Correcto
0.33 s 10 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 137
run: line 1:     3 Killed                  /usr/local/python-3.8.1/bin/python3 script.py
0.248 s 125 KBi
Puntos totales: 58 / 100

Código

def init():
    size = int(input())
    array = [int(value) for value in input().split()]
    queries = int(input())

    query = []
    for _ in range(queries):
        p, q = [int(x) for x in input().split()]

        query.append(array[p:q + 1])
    
    for item in query:
        print(sum(item))

if __name__ == '__main__':
    init()