結果

問題 No.885 アマリクエリ
ユーザー torikuminotorikumino
提出日時 2019-09-19 23:25:25
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,058 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 108,968 KB
最終ジャッジ日時 2023-09-28 21:27:34
合計ジャッジ時間 8,550 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,058 ms
105,708 KB
testcase_01 AC 490 ms
107,984 KB
testcase_02 AC 258 ms
108,020 KB
testcase_03 AC 232 ms
108,240 KB
testcase_04 AC 235 ms
108,600 KB
testcase_05 AC 179 ms
108,968 KB
testcase_06 AC 169 ms
106,292 KB
testcase_07 AC 153 ms
93,036 KB
testcase_08 AC 141 ms
92,696 KB
testcase_09 AC 511 ms
108,008 KB
testcase_10 AC 97 ms
71,580 KB
testcase_11 AC 96 ms
71,508 KB
testcase_12 AC 96 ms
71,508 KB
testcase_13 AC 140 ms
78,712 KB
testcase_14 AC 137 ms
78,628 KB
testcase_15 AC 135 ms
78,332 KB
testcase_16 AC 123 ms
77,856 KB
testcase_17 AC 109 ms
77,100 KB
testcase_18 AC 117 ms
77,416 KB
testcase_19 AC 102 ms
76,492 KB
testcase_20 AC 104 ms
76,476 KB
testcase_21 AC 121 ms
76,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from heapq import *
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
X = list(map(int, input().split()))
h = [-e for e in A]
heapify(h)
r = sum(A)
for x in X:
    while -h[0] >= x:
        v = -heappop(h)
        r -= v
        v %= x
        heappush(h, -v)
        r += v
    print(r)
0