結果

問題 No.885 アマリクエリ
ユーザー convexineqconvexineq
提出日時 2021-04-07 22:31:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,097 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 2,077 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 98,020 KB
最終ジャッジ日時 2023-09-05 06:21:03
合計ジャッジ時間 9,882 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,097 ms
95,612 KB
testcase_01 AC 520 ms
97,116 KB
testcase_02 AC 269 ms
97,108 KB
testcase_03 AC 236 ms
94,328 KB
testcase_04 AC 230 ms
94,688 KB
testcase_05 AC 181 ms
98,020 KB
testcase_06 AC 176 ms
93,692 KB
testcase_07 AC 144 ms
94,096 KB
testcase_08 AC 143 ms
93,208 KB
testcase_09 AC 526 ms
96,672 KB
testcase_10 AC 84 ms
71,364 KB
testcase_11 AC 85 ms
71,400 KB
testcase_12 AC 86 ms
71,320 KB
testcase_13 AC 128 ms
77,956 KB
testcase_14 AC 125 ms
77,524 KB
testcase_15 AC 130 ms
77,804 KB
testcase_16 AC 111 ms
75,928 KB
testcase_17 AC 103 ms
75,736 KB
testcase_18 AC 106 ms
76,336 KB
testcase_19 AC 98 ms
75,536 KB
testcase_20 AC 93 ms
75,092 KB
testcase_21 AC 100 ms
75,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *
n = int(input())
*a, = map(int,input().split())
for i in range(n):
    a[i] *= -1
heapify(a)
ans = -sum(a)
Q = int(input())
*x, = map(int,input().split())
for xi in x:
    while xi <= -a[0]:
        v = -heappop(a)
        ans -= v
        v %= xi
        ans += v
        heappush(a,-v)
    print(ans)
0