Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.034 s | 3 KBi |
#2 |
Incorrecto
|
0.041 s | 3 KBi |
#3 |
Incorrecto
|
0.028 s | 3 KBi |
#4 |
Incorrecto
|
0.025 s | 3 KBi |
#5 |
Incorrecto
|
0.038 s | 3 KBi |
#6 |
Incorrecto
|
0.021 s | 3 KBi |
#7 |
Incorrecto
|
0.032 s | 3 KBi |
#8 |
Incorrecto
|
0.023 s | 3 KBi |
def idfk(): from collections import defaultdict from bisect import bisect_right, bisect_left _ = input() nums = list(map(int, input().split(" "))) snums = sorted(set(nums)) # try lists instead of maps, maybe it'll go faster m = [[] for _ in range(len(snums))] for i, n in enumerate(nums): bisect_left m[bisect_left(snums, n)].append(i) Q = int(input()) for _ in range(Q): L, R, X = map(int, input().split(" ")) i = bisect_left(snums, X) if i < len(snums) and snums[i] == X: l = m[i] print(bisect_right(l, R) - bisect_right(l, L - 1)) else: print(0)