結果

問題 No.885 アマリクエリ
ユーザー NoneNone
提出日時 2021-04-04 21:03:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 995 ms / 2,000 ms
コード長 293 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 101,332 KB
最終ジャッジ日時 2023-08-27 22:46:47
合計ジャッジ時間 8,188 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 995 ms
100,508 KB
testcase_01 AC 429 ms
94,620 KB
testcase_02 AC 205 ms
101,260 KB
testcase_03 AC 194 ms
99,960 KB
testcase_04 AC 197 ms
100,344 KB
testcase_05 AC 136 ms
101,332 KB
testcase_06 AC 130 ms
98,328 KB
testcase_07 AC 106 ms
91,888 KB
testcase_08 AC 116 ms
91,940 KB
testcase_09 AC 420 ms
94,452 KB
testcase_10 AC 76 ms
71,404 KB
testcase_11 AC 76 ms
71,388 KB
testcase_12 AC 76 ms
71,292 KB
testcase_13 AC 116 ms
77,772 KB
testcase_14 AC 116 ms
78,028 KB
testcase_15 AC 115 ms
77,856 KB
testcase_16 AC 96 ms
76,320 KB
testcase_17 AC 89 ms
75,928 KB
testcase_18 AC 97 ms
76,388 KB
testcase_19 AC 76 ms
71,124 KB
testcase_20 AC 83 ms
75,428 KB
testcase_21 AC 90 ms
76,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *
N=int(input())
A=list(map(int, input().split()))
Q=int(input())
X=list(map(int, input().split()))

S=sum(A)
H=[]
for a in A:
    heappush(H,-a)

for x in X:
    while -H[0]>=x:
        a=-heappop(H)
        S-=a
        a%=x
        S+=a
        heappush(H,-a)
    print(S)
0