結果

問題 No.750 Frac #1
コンテスト
ユーザー bellangeldindon
提出日時 2019-04-26 13:51:38
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 81 ms / 1,000 ms
コード長 571 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 177 ms
コンパイル使用メモリ 77,520 KB
最終ジャッジ日時 2025-12-04 01:36:31
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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])
0