結果
問題 |
No.3073 Fraction Median
|
ユーザー |
![]() |
提出日時 | 2025-03-21 21:54:30 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 606 bytes |
コンパイル時間 | 304 ms |
コンパイル使用メモリ | 82,700 KB |
実行使用メモリ | 344,216 KB |
最終ジャッジ日時 | 2025-03-21 21:54:40 |
合計ジャッジ時間 | 9,876 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 6 TLE * 1 -- * 11 |
ソースコード
import sys import math from functools import cmp_to_key def main(): input = sys.stdin.readline # Use fast input n = int(input()) a = list(map(int, input().split())) a.sort() b = [(a[i], a[i+1]) for i in range(n - 1)] def c(x, y): x0, x1 = x y0, y1 = y if x0 * y1 > x1 * y0: return 1 elif x0 * y1 < x1 * y0: return -1 else: return 0 b.sort(key=cmp_to_key(c)) g = math.gcd(b[-1][0], b[-1][1]) sys.stdout.write(f"{b[-1][0] // g} {b[-1][1] // g}\n") if __name__ == '__main__': main()