結果

問題 No.3073 Fraction Median
ユーザー PNJ
提出日時 2025-03-22 15:13:00
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 378 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 353,600 KB
最終ジャッジ日時 2025-03-22 15:13:11
合計ジャッジ時間 10,255 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import cmp_to_key
def cmp(a, b):
  x, y = a
  xx, yy = b
  s = x * yy - y * xx
  return 1 if s > 0 else -1 if s < 0 else 0

def gcd(a, b):
  while b: a, b = b, a % b
  return a

N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [(A[i - 1], A[i]) for i in range(1, N)]
B.sort(key = cmp_to_key(cmp))
a, b = B[-1]
g = gcd(a, b)
print(a // g, b // g)
0