結果
| 問題 | No.885 アマリクエリ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-11 23:08:54 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 480 ms / 2,000 ms |
| + 348µs | |
| コード長 | 445 bytes |
| 記録 | |
| コンパイル時間 | 113 ms |
| コンパイル使用メモリ | 64,292 KB |
| 実行使用メモリ | 85,256 KB |
| 最終ジャッジ日時 | 2026-11-10 23:25:20 |
| 合計ジャッジ時間 | 5,883 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
import heapq
N = int(input())
h = list(map(int, input().split()))
Q = int(input())
lsX = list(map(int, input().split()))
h = [-i for i in h]
heapq.heapify(h)
allsum = -sum(h)
for i in range(Q):
x = lsX[i]
while True:
p = heapq.heappop(h)
if p <= -x:
n = (-p)%x
allsum -= (-p)-n
heapq.heappush(h, -n)
else:
heapq.heappush(h, p)
break
print(allsum)