結果

問題 No.1816 MUL-DIV Game
ユーザー SidewaysOwl
提出日時 2022-01-21 22:13:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 91,008 KB
最終ジャッジ日時 2024-11-26 00:38:33
合計ジャッジ時間 3,264 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))
a.sort()
if n == 1:
    print(a[0])
elif n == 2:
    print(a[0]*a[1])
elif n & 1:
    print(1)
else:
    import heapq
    x,y = heapq.heappop(a),heapq.heappop(a)
    heapq.heappush(a,x*y)
    for i in range(n//2-1):
        x = heapq.heappop(a)
        heapq.heappush(a,x)
    print(x)
0