結果

問題 No.2353 Guardian Dogs in Spring
ユーザー H20
提出日時 2023-06-16 22:47:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 82,132 KB
実行使用メモリ 80,032 KB
最終ジャッジ日時 2024-06-24 15:42:25
合計ジャッジ時間 10,216 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import cmp_to_key

def f(r1, r2):
    x1, y1,_ = r1
    x2, y2,_ = r2
    if  x2 * y1 - y2 * x1==0:
        return x1-x2
    else:
        return x2 * y1 - y2 * x1




N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
XYI = []
for i,(x,y) in enumerate(XY):
    XYI.append([x,y,i+1])

XYI.sort(key = cmp_to_key(f))
print(N//2)
for i in range(N//2):
    print(XYI[i*2][2],XYI[i*2+1][2])
0