結果
問題 | No.750 Frac #1 |
ユーザー |
![]() |
提出日時 | 2019-04-26 13:51:38 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 10 ms / 1,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 87 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2024-11-24 06:43:00 |
合計ジャッジ時間 | 1,354 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
def quicksort(lst): if lst == []: return [] if len(lst) == 1: return lst left = [] right = [] pivot = lst[0] for i in range(1, len(lst)): if float(lst[i][0])/float(lst[i][1]) > float(pivot[0])/float(pivot[1]): left.append(lst[i]) else: right.append(lst[i]) left.append(pivot) newleft = quicksort(left) newright = quicksort(right) newleft.extend(newright) return newleft n = int(raw_input()) lst = [] for i in range(0, n): lst.append(map(int, raw_input().split())) lst = quicksort(lst) for i in range(0, n): print str(lst[i][0]) + " " + str(lst[i][1])