結果
| 問題 |
No.1816 MUL-DIV Game
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 21:04:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 652 bytes |
| コンパイル時間 | 268 ms |
| コンパイル使用メモリ | 82,044 KB |
| 実行使用メモリ | 97,116 KB |
| 最終ジャッジ日時 | 2025-04-15 21:10:14 |
| 合計ジャッジ時間 | 5,439 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 15 |
ソースコード
import heapq
def main():
import sys
input = sys.stdin.read().split()
N = int(input[0])
A = list(map(int, input[1:N+1]))
if N == 1:
print(A[0])
return
heap = []
for num in A:
heapq.heappush(heap, -num)
for i in range(N-1):
if i % 2 == 0: # Alice's turn
a = -heapq.heappop(heap)
b = -heapq.heappop(heap)
heapq.heappush(heap, -(a * b))
else: # Bob's turn
a = -heapq.heappop(heap)
b = -heapq.heappop(heap)
heapq.heappush(heap, -1)
print(-heap[0])
if __name__ == "__main__":
main()
lam6er