結果

問題 No.2353 Guardian Dogs in Spring
ユーザー rlangevinrlangevin
提出日時 2023-06-16 22:00:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 78,928 KB
最終ジャッジ日時 2023-09-06 19:45:39
合計ジャッジ時間 9,935 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
75,704 KB
testcase_01 AC 68 ms
75,732 KB
testcase_02 AC 66 ms
75,676 KB
testcase_03 AC 67 ms
75,772 KB
testcase_04 AC 71 ms
75,724 KB
testcase_05 AC 96 ms
78,716 KB
testcase_06 AC 92 ms
78,384 KB
testcase_07 AC 94 ms
78,736 KB
testcase_08 AC 97 ms
78,684 KB
testcase_09 AC 99 ms
78,484 KB
testcase_10 AC 97 ms
78,484 KB
testcase_11 AC 96 ms
78,712 KB
testcase_12 AC 99 ms
78,928 KB
testcase_13 AC 98 ms
78,524 KB
testcase_14 AC 71 ms
75,788 KB
testcase_15 AC 109 ms
78,804 KB
testcase_16 AC 106 ms
78,488 KB
testcase_17 AC 103 ms
78,784 KB
testcase_18 AC 107 ms
78,764 KB
testcase_19 AC 105 ms
78,712 KB
testcase_20 AC 71 ms
75,976 KB
testcase_21 AC 86 ms
76,780 KB
testcase_22 AC 96 ms
78,700 KB
testcase_23 AC 108 ms
78,420 KB
testcase_24 AC 87 ms
76,536 KB
testcase_25 AC 82 ms
76,724 KB
testcase_26 AC 77 ms
76,412 KB
testcase_27 AC 67 ms
75,932 KB
testcase_28 AC 85 ms
76,804 KB
testcase_29 AC 102 ms
78,384 KB
testcase_30 AC 102 ms
78,556 KB
testcase_31 AC 101 ms
78,204 KB
testcase_32 AC 108 ms
78,384 KB
testcase_33 AC 110 ms
78,436 KB
testcase_34 AC 109 ms
78,640 KB
testcase_35 AC 108 ms
78,456 KB
testcase_36 AC 89 ms
76,836 KB
testcase_37 AC 74 ms
76,312 KB
testcase_38 AC 96 ms
78,204 KB
testcase_39 AC 97 ms
78,220 KB
testcase_40 AC 101 ms
78,436 KB
testcase_41 AC 103 ms
78,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
X, Y = [0] * N, [0] * N
M = 8005
D = [[] for i in range(M)]
for i in range(N):
    X[i], Y[i] = map(int, input().split())
    D[Y[i]].append((X[i], i))

ans = []
pre = -1
for i in range(M):
    if not D[i]:
        continue
    D[i].sort()
    if pre != -1:
        _, z = D[i].pop()
        ans.append((pre, z + 1))        
    while len(D[i]) >= 2:
        _, z = D[i].pop()
        _, w = D[i].pop()
        ans.append((z + 1, w + 1))
    if D[i]:
        _, pre = D[i].pop()
        pre += 1
    else:
        pre = -1
        
print(len(ans))
for a, b in ans:
    print(a, b)
0