結果
| 問題 | No.1816 MUL-DIV Game |
| コンテスト | |
| ユーザー |
hir355
|
| 提出日時 | 2022-01-21 22:28:03 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 183 ms / 2,000 ms |
| コード長 | 457 bytes |
| 記録 | |
| コンパイル時間 | 255 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 97,152 KB |
| 最終ジャッジ日時 | 2026-05-20 13:39:48 |
| 合計ジャッジ時間 | 4,464 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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