結果

問題 No.2758 RDQ
ユーザー ゼット
提出日時 2024-05-17 21:27:34
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 560 ms / 2,000 ms
+ 852µs
コード長 430 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 81 ms
コンパイル使用メモリ 64,856 KB
実行使用メモリ 194,012 KB
最終ジャッジ日時 2026-10-17 08:32:35
合計ジャッジ時間 9,671 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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