結果

問題 No.885 アマリクエリ
ユーザー norioc
提出日時 2025-03-10 00:00:00
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 393 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 82,220 KB
実行使用メモリ 269,412 KB
最終ジャッジ日時 2025-03-10 00:00:05
合計ジャッジ時間 4,810 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 1 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 1 << 60
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
X = list(map(int, input().split()))

min_mod = INF
prev_tot = 0
a = A
for x in X:
    if min_mod < x:
        print(prev_tot)
        continue

    tot = 0
    b = []
    for y in a:
        m = y % x
        if m > 0:
            b.append(m)
            tot += m

    a = b
    prev_tot = tot
    print(tot)
0