結果

問題 No.3101 Range Eratosthenes Query
コンテスト
ユーザー sasa8uyauya
提出日時 2025-04-12 00:20:34
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 506 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 219 ms
コンパイル使用メモリ 95,984 KB
実行使用メモリ 509,932 KB
最終ジャッジ日時 2026-07-08 20:10:55
合計ジャッジ時間 62,079 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

class FenwickTree:
  def __init__(self, size):
    self.n = size
    self.tree = [0] * (self.n + 1)
  
  def add(self, index, delta):
    index += 1
    while index <= self.n:
      self.tree[index] += delta
      index += index & -index
  
  def sum(self, index):
    index += 1
    res = 0
    while index > 0:
      res += self.tree[index]
      index -= index & -index
    return res


L=10**6
f=[[] for i in range(L+1)]
for i in range(1,L+1):
  for j in range(i,L+1,i):
    f[j]+=[i]
  f[i]=f[i][-2:]
0