Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.025 s | 3 KBi |
#2 |
Incorrecto
|
0.04 s | 4 KBi |
#3 |
Incorrecto
|
0.025 s | 3 KBi |
#4 |
Incorrecto
|
0.028 s | 3 KBi |
#5 |
Incorrecto
|
0.025 s | 3 KBi |
#6 |
Incorrecto
|
0.022 s | 3 KBi |
#7 |
Incorrecto
|
0.021 s | 3 KBi |
#8 |
Incorrecto
|
0.084 s | 5 KBi |
#9 |
Incorrecto
|
0.362 s | 13 KBi |
#10 |
Esperando resultado...
|
||
#11 |
Esperando resultado...
|
||
#12 |
Esperando resultado...
|
||
#13 |
Correcto
|
0.423 s | 16 KBi |
#14 |
Correcto
|
0.387 s | 16 KBi |
n = int(input()) # Number of elements in array a = [int(x) for x in input().split()] # Array c = int(input()) # Number of queries indexes = {tuple([int(x) for x in input().split()]): 1 for _ in range(c)} # Query indexes left = 0 right = 0 suma = 0 for key in sorted(indexes): if key[0] != key[1]: while key[0] > left: suma -= a[left] left += 1 while key[1] >= right: suma += a[right] right += 1 indexes[key] = suma for value in indexes.values(): print(value)