結果

問題 No.2353 Guardian Dogs in Spring
ユーザー mkawa2mkawa2
提出日時 2023-06-16 22:31:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 405 ms / 2,000 ms
コード長 1,285 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 79,852 KB
最終ジャッジ日時 2023-09-06 20:48:44
合計ジャッジ時間 14,733 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,036 KB
testcase_01 AC 73 ms
71,096 KB
testcase_02 AC 74 ms
71,200 KB
testcase_03 AC 75 ms
71,256 KB
testcase_04 AC 76 ms
71,192 KB
testcase_05 AC 248 ms
79,248 KB
testcase_06 AC 253 ms
78,996 KB
testcase_07 AC 265 ms
79,184 KB
testcase_08 AC 264 ms
79,160 KB
testcase_09 AC 405 ms
79,272 KB
testcase_10 AC 396 ms
78,936 KB
testcase_11 AC 280 ms
79,508 KB
testcase_12 AC 288 ms
79,116 KB
testcase_13 AC 328 ms
79,292 KB
testcase_14 AC 85 ms
75,828 KB
testcase_15 AC 334 ms
79,640 KB
testcase_16 AC 340 ms
79,852 KB
testcase_17 AC 321 ms
79,348 KB
testcase_18 AC 336 ms
79,372 KB
testcase_19 AC 345 ms
79,544 KB
testcase_20 AC 89 ms
75,884 KB
testcase_21 AC 138 ms
78,116 KB
testcase_22 AC 182 ms
78,196 KB
testcase_23 AC 254 ms
78,916 KB
testcase_24 AC 126 ms
77,780 KB
testcase_25 AC 122 ms
77,564 KB
testcase_26 AC 107 ms
77,020 KB
testcase_27 AC 85 ms
75,648 KB
testcase_28 AC 132 ms
78,132 KB
testcase_29 AC 199 ms
79,236 KB
testcase_30 AC 177 ms
78,352 KB
testcase_31 AC 196 ms
78,156 KB
testcase_32 AC 258 ms
78,980 KB
testcase_33 AC 318 ms
79,428 KB
testcase_34 AC 329 ms
79,512 KB
testcase_35 AC 310 ms
79,332 KB
testcase_36 AC 135 ms
77,636 KB
testcase_37 AC 112 ms
76,712 KB
testcase_38 AC 168 ms
78,012 KB
testcase_39 AC 162 ms
78,136 KB
testcase_40 AC 197 ms
78,140 KB
testcase_41 AC 210 ms
79,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(1000005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# md = 10**9+7
md = 998244353

def outer(x,y,p,q,s,t):
    return (s-x)*(q-y)-(t-y)*(p-x)

n = II()
xy = []
for i in range(n):
    x, y = LI()
    xy.append((x, y, i))
xy.sort()
fin = [0]*n

ans = []
for p, (x, y, i) in enumerate(xy):
    if fin[p]:continue
    q=p+1
    while q<n and fin[q]:q+=1
    if q==n:break
    a,b,_=xy[q]
    for r in range(q+1,n):
        if fin[r]:continue
        c,d,_=xy[r]
        if outer(x,y,a,b,c,d)>0:
            a,b,q=c,d,r
    j=xy[q][2]
    ans.append((i+1,j+1))
    fin[p]=1
    fin[q]=1

print(len(ans))
for i,j in ans:print(i,j)
0