結果

問題 No.2353 Guardian Dogs in Spring
ユーザー AEnAEn
提出日時 2023-07-24 01:03:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 81,668 KB
実行使用メモリ 79,028 KB
最終ジャッジ日時 2023-10-25 08:48:14
合計ジャッジ時間 12,048 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,356 KB
testcase_01 AC 39 ms
53,356 KB
testcase_02 AC 39 ms
53,356 KB
testcase_03 AC 40 ms
53,356 KB
testcase_04 AC 41 ms
53,356 KB
testcase_05 AC 119 ms
78,096 KB
testcase_06 AC 110 ms
77,960 KB
testcase_07 AC 113 ms
78,280 KB
testcase_08 AC 110 ms
78,224 KB
testcase_09 AC 133 ms
79,028 KB
testcase_10 AC 134 ms
79,000 KB
testcase_11 AC 113 ms
78,252 KB
testcase_12 AC 116 ms
78,216 KB
testcase_13 AC 114 ms
78,004 KB
testcase_14 AC 43 ms
53,368 KB
testcase_15 AC 127 ms
78,736 KB
testcase_16 AC 134 ms
78,996 KB
testcase_17 AC 129 ms
78,736 KB
testcase_18 AC 132 ms
78,736 KB
testcase_19 AC 127 ms
78,732 KB
testcase_20 AC 43 ms
53,368 KB
testcase_21 AC 91 ms
76,556 KB
testcase_22 AC 118 ms
78,116 KB
testcase_23 AC 122 ms
78,028 KB
testcase_24 AC 88 ms
76,700 KB
testcase_25 AC 81 ms
74,300 KB
testcase_26 AC 63 ms
65,068 KB
testcase_27 AC 44 ms
53,368 KB
testcase_28 AC 96 ms
76,668 KB
testcase_29 AC 115 ms
78,168 KB
testcase_30 AC 117 ms
78,140 KB
testcase_31 AC 113 ms
78,044 KB
testcase_32 AC 123 ms
77,892 KB
testcase_33 AC 122 ms
78,728 KB
testcase_34 AC 123 ms
78,736 KB
testcase_35 AC 124 ms
78,736 KB
testcase_36 AC 94 ms
76,864 KB
testcase_37 AC 63 ms
67,116 KB
testcase_38 AC 106 ms
77,264 KB
testcase_39 AC 108 ms
77,164 KB
testcase_40 AC 113 ms
78,160 KB
testcase_41 AC 115 ms
78,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

Y = []
posi = []
for i in range(N):
    x,y = map(int, input().split())
    Y.append(y)
    posi.append((i,x,y))
posi.sort(key=lambda x:x[1])

d = {num:i for i,num in enumerate(sorted(list(set(Y))))}
p = [list() for _ in range(N)]
for i,x,y in posi:
    p[d[y]].append((i,x))

res = []
m = []
for i in range(len(p)):
    if len(p[i])>=3:
        cnt = len(p[i])//2
        while cnt:
            id1,_ = p[i].pop()
            id2,_ = p[i].pop()
            res.append((id1+1,id2+1))
            cnt -= 1
    while p[i]:
        id,_ = p[i].pop()
        m.append(id+1)

cnt = len(m)//2
while cnt:
    id1 = m.pop()
    id2 = m.pop()
    res.append((id1,id2))
    cnt -= 1
print(len(res))
for a,b in res:
    print(a,b)
0