結果

問題 No.2758 RDQ
ユーザー ゼットゼット
提出日時 2024-05-17 21:27:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 660 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 82,692 KB
実行使用メモリ 204,356 KB
最終ジャッジ日時 2024-12-20 15:38:04
合計ジャッジ時間 11,775 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q=map(int,input().split())
A=list(map(int,input().split()))
G=[[] for i in range(10**5+1)]
from math import sqrt
for i in range(N):
  x=A[i]
  B=set()
  k=int(sqrt(x))
  for y in range(1,k+1):
    if x%y==0:
      B.add(x//y)
      B.add(y)
  for y in B:
    G[y].append(i)
from bisect import bisect_right
for i in range(Q):
  l,r,K=map(int,input().split())
  result=bisect_right(G[K],r-1)-bisect_right(G[K],l-2)
  print(result)
0