結果
| 問題 | No.885 アマリクエリ |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-03-18 01:59:27 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 474 ms / 2,000 ms |
| + 84µs | |
| コード長 | 410 bytes |
| 記録 | |
| コンパイル時間 | 129 ms |
| コンパイル使用メモリ | 64,224 KB |
| 実行使用メモリ | 85,912 KB |
| 最終ジャッジ日時 | 2026-11-11 04:31:49 |
| 合計ジャッジ時間 | 5,870 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
X=list(map(int,input().split()))
H=[]
for a in A:
heappush(H,-a)
SUM=sum(A)
for x in X:
while True:
if -H[0]>=x:
k=-heappop(H)
u=k%x
SUM-=k-u
heappush(H,-u)
else:
break
print(SUM)
titia