結果

問題 No.2353 Guardian Dogs in Spring
ユーザー navel_tosnavel_tos
提出日時 2023-06-16 22:23:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,117 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 86,736 KB
実行使用メモリ 116,184 KB
最終ジャッジ日時 2023-09-06 20:33:43
合計ジャッジ時間 11,236 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 234 ms
93,820 KB
testcase_01 AC 230 ms
89,552 KB
testcase_02 AC 229 ms
89,228 KB
testcase_03 AC 237 ms
89,328 KB
testcase_04 AC 235 ms
89,332 KB
testcase_05 AC 286 ms
92,524 KB
testcase_06 AC 352 ms
93,708 KB
testcase_07 AC 336 ms
93,764 KB
testcase_08 AC 340 ms
94,088 KB
testcase_09 WA -
testcase_10 AC 327 ms
92,828 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 371 ms
94,696 KB
testcase_14 WA -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#yukicoder393D

'''
「近い奴とつねに向き合う」ってしょうもな貪欲法するか。
ただN=8000だとちょっと制約がきついなぁ。

え、この貪欲落ちるの?
'''
from fractions import Fraction as Fc
from collections import defaultdict as dd
f=lambda:tuple(map(int,input().split()))

#直線の切片のx座標y座標を返す
def line(P,Q):
    x1,y1=P; x2,y2=Q
    if x1==x2: return (x1,10**18)
    R=Fc(y2-y1,x2-x1); return (R,-R*x1+y1)

N=int(input()); N=N//2*2; P=[f() for _ in range(N)]; print(N//2); looked=[0]*N
for i in range(N):
    if looked[i]: continue
    for j in range(i+1,N):
        if not looked[j]: break
    #iとjの直線上にいる奴を探す
    x,y=line(P[i],P[j]); same,diff=set([i,j]),set()
    for k in range(j+1,N):
        if looked[k]: continue
        x2,y2=line(P[i],P[k])
        if x==x2 and y==y2: same.add(k)
        else: diff.add(k)
    #マッチング
    while same and diff: p,q=same.pop(),diff.pop(); print(p+1,q+1); looked[p]=1; looked[q]=1
    while len(same)>=2: p=same.pop(); q=same.pop(); print(p+1,q+1); looked[p]=1; looked[q]=1
0