結果
| 問題 |
No.1816 MUL-DIV Game
|
| コンテスト | |
| ユーザー |
hir355
|
| 提出日時 | 2022-01-21 22:28:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 270 ms / 2,000 ms |
| コード長 | 457 bytes |
| コンパイル時間 | 203 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 92,416 KB |
| 最終ジャッジ日時 | 2024-11-26 01:09:08 |
| 合計ジャッジ時間 | 5,677 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
import heapq
n = int(input())
a = list(map(int, input().split()))
hq = a[:]
hq2 = [-x for x in a]
heapq.heapify(hq)
heapq.heapify(hq2)
for i in range(n - 1):
if i % 2 == 0:
x = heapq.heappop(hq)
y = heapq.heappop(hq)
heapq.heappush(hq, x * y)
heapq.heappush(hq2, -x * y)
else:
heapq.heappop(hq2)
heapq.heappop(hq2)
heapq.heappush(hq, 1)
heapq.heappush(hq2, -1)
print(heapq.heappop(hq))
hir355