結果

問題 No.750 Frac #1
ユーザー miya145592
提出日時 2023-05-02 23:50:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 1,000 ms
コード長 269 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 55,296 KB
最終ジャッジ日時 2024-11-21 11:15:25
合計ジャッジ時間 2,976 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import cmp_to_key
def cmp(a, b):
    if a[0]*b[1]==a[1]*b[0]:
        return 0
    return -1 if a[0]*b[1]>a[1]*b[0] else 1
n = int(input())
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort(key=cmp_to_key(cmp))
for ab in AB:
    print(*ab)
0