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

Envío 5258

Problema 0xca - Contar cuantas veces aparece X en un subarreglo

  • Autor: Andres Ariza
  • Fecha: 2021-10-30 03:29:58 UTC (Hace alrededor de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    cached[(l, r)] = Counter(arr[int(l):int(r)+1])
NameError: name 'Counter' is not defined
0.026 s 3 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    cached[(l, r)] = Counter(arr[int(l):int(r)+1])
NameError: name 'Counter' is not defined
0.025 s 3 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    cached[(l, r)] = Counter(arr[int(l):int(r)+1])
NameError: name 'Counter' is not defined
0.017 s 3 KBi
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    cached[(l, r)] = Counter(arr[int(l):int(r)+1])
NameError: name 'Counter' is not defined
0.054 s 5 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    cached[(l, r)] = Counter(arr[int(l):int(r)+1])
NameError: name 'Counter' is not defined
0.057 s 7 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    cached[(l, r)] = Counter(arr[int(l):int(r)+1])
NameError: name 'Counter' is not defined
0.071 s 14 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    cached[(l, r)] = Counter(arr[int(l):int(r)+1])
NameError: name 'Counter' is not defined
0.057 s 14 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    cached[(l, r)] = Counter(arr[int(l):int(r)+1])
NameError: name 'Counter' is not defined
0.054 s 14 KBi
Puntos totales: 0 / 100

Código

n = int(input())
arr = [int(num) for num in input().split()]
cached = {}

for _ in range(int(input())):
    l, r, x = input().split()
    if (l, r) in cached:
        print(cached.get((l, r)).get(int(x), 0))
    else:
        cached[(l, r)] = Counter(arr[int(l):int(r)+1])
        print(cached.get((l, r)).get(int(x), 0))