結果

問題 No.750 Frac #1
ユーザー miya145592miya145592
提出日時 2023-05-02 23:50:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 1,000 ms
コード長 269 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,280 KB
実行使用メモリ 56,876 KB
最終ジャッジ日時 2024-05-01 08:14:50
合計ジャッジ時間 2,402 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,076 KB
testcase_01 AC 39 ms
56,124 KB
testcase_02 AC 38 ms
55,372 KB
testcase_03 AC 38 ms
55,312 KB
testcase_04 AC 37 ms
55,452 KB
testcase_05 AC 39 ms
55,784 KB
testcase_06 AC 39 ms
55,920 KB
testcase_07 AC 38 ms
56,264 KB
testcase_08 AC 42 ms
55,556 KB
testcase_09 AC 43 ms
56,396 KB
testcase_10 AC 42 ms
55,552 KB
testcase_11 AC 39 ms
54,992 KB
testcase_12 AC 38 ms
55,376 KB
testcase_13 AC 40 ms
55,224 KB
testcase_14 AC 38 ms
55,752 KB
testcase_15 AC 38 ms
55,328 KB
testcase_16 AC 39 ms
55,380 KB
testcase_17 AC 39 ms
55,636 KB
testcase_18 AC 39 ms
55,424 KB
testcase_19 AC 39 ms
55,704 KB
testcase_20 AC 40 ms
56,876 KB
testcase_21 AC 38 ms
56,088 KB
testcase_22 AC 39 ms
54,912 KB
testcase_23 AC 40 ms
55,600 KB
testcase_24 AC 41 ms
55,152 KB
testcase_25 AC 37 ms
55,524 KB
testcase_26 AC 39 ms
55,648 KB
testcase_27 AC 40 ms
55,436 KB
testcase_28 AC 41 ms
55,300 KB
testcase_29 AC 41 ms
55,724 KB
testcase_30 AC 40 ms
56,400 KB
testcase_31 AC 40 ms
55,876 KB
testcase_32 AC 40 ms
55,320 KB
権限があれば一括ダウンロードができます

ソースコード

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