結果

問題 No.1816 MUL-DIV Game
ユーザー chineristAC
提出日時 2022-01-21 21:30:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 773 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 85,888 KB
最終ジャッジ日時 2024-11-25 22:45:26
合計ジャッジ時間 3,033 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations

from math import log,gcd

input = lambda :sys.stdin.readline()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N = int(input())
A = li()

A.sort()

if N==1:
    exit(print(A[0]))
if N==2:
    exit(print(A[0]*A[1]))

if all(A[i]==1 for i in range(N)):
    exit(print(1))

if all(A[0]*A[1]==A[i] for i in range(2,N)):
    if N&1:
        print(1)
    else:
        print(A[2])
elif all(A[0]*A[-1]==A[i] for i in range(1,N-1)):
    if N&1:
        print(1)
    else:
        print(A[1])
elif all(A[-2]*A[-1]==A[i] for i in range(0,N-2)):
    if N&1:
        print(1)
    else:
        print(A[0])
else:
    print(0)
0