結果

問題 No.3073 Fraction Median
ユーザー titia
提出日時 2025-03-22 00:10:55
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 2,235 ms / 2,500 ms
コード長 249 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 189,044 KB
最終ジャッジ日時 2025-03-22 00:11:27
合計ジャッジ時間 31,781 ms
ジャッジサーバーID
(参考情報)
judge3 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from math import gcd

N=int(input())
A=list(map(int,input().split()))

A.sort()

a=A[0]
b=A[1]

for i in range(N-1):
    c=A[i]
    d=A[i+1]

    if a*d<b*c:
        a,b=c,d

g=gcd(a,b)
a//=g
b//=g

print(a,b)
0