結果
| 問題 | No.1816 MUL-DIV Game | 
| コンテスト | |
| ユーザー |  gew1fw | 
| 提出日時 | 2025-06-12 14:41:07 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 729 bytes | 
| コンパイル時間 | 396 ms | 
| コンパイル使用メモリ | 82,744 KB | 
| 実行使用メモリ | 267,792 KB | 
| 最終ジャッジ日時 | 2025-06-12 14:41:22 | 
| 合計ジャッジ時間 | 9,962 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 6 WA * 3 TLE * 2 -- * 16 | 
ソースコード
import sys
def main():
    import sys
    input = sys.stdin.read
    data = input().split()
    N = int(data[0])
    A = list(map(int, data[1:N+1]))
    
    if N == 1:
        print(A[0])
        return
    
    m = (N - 1) // 2  # Bob的次数
    
    A.sort()
    
    product = 1
    for num in A:
        product *= num
    
    if m == 0:
        print(product)
        return
    
    x = []
    y = []
    for i in range(m):
        idx = N - 2 - i
        if idx < 0:
            break
        x.append(A[idx])
        y.append(A[N - 1 - i])
    
    denominator = 1
    for xi, yi in zip(x, y):
        denominator *= xi * yi
    
    ans = product // denominator
    print(ans)
if __name__ == "__main__":
    main()
            
            
            
        