結果

問題 No.3502 GCD Knapsack
コンテスト
ユーザー kitatai
提出日時 2026-04-18 12:07:46
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 375 ms / 2,000 ms
+ 825µs
コード長 399 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 131 ms
コンパイル使用メモリ 83,216 KB
実行使用メモリ 122,048 KB
最終ジャッジ日時 2026-09-08 12:59:36
合計ジャッジ時間 11,680 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, W = map(int, input().split())

X = list(map(int, input().split()))
Y = list(map(int, input().split()))

l = [0] * (2 * 10**5 + 1)

for x, y in zip(X, Y):
    i = 1
    # print(x)
    while i * i <= x:
        if x % i == 0:
            l[i] += y
            l[x // i] += y
        i += 1
max_l = -1
for i in range(W + 1, len(l)):
    if max_l < l[i]:
        max_l = l[i]
print(max_l)
# print(l)
0