Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.014 s | 3 KBi |
#2 |
Correcto
|
0.02 s | 3 KBi |
#3 |
Correcto
|
0.025 s | 3 KBi |
#4 |
Tiempo límite excedido
|
1.55 s | 8 KBi |
#5 |
Tiempo límite excedido
|
1.536 s | 10 KBi |
#6 |
Correcto
|
0.299 s | 29 KBi |
#7 |
Correcto
|
1.025 s | 34 KBi |
#8 |
Correcto
|
0.411 s | 29 KBi |
N = input() arr = input().split(' ') times = int(input()) mem = {} for i, elem in enumerate(arr): if elem not in mem: mem[elem] = [] mem[elem].append(i) for i in range(times): case = input().split(' ') l = int(case[0]) r = int(case[1]) q = case[2] count = 0 if q not in mem: print(0) continue indexes = mem[q] for index in indexes: if l <= index and r >= index: count += 1 print(count)