結果

問題 No.2353 Guardian Dogs in Spring
ユーザー timi
提出日時 2023-06-16 22:20:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 82,212 KB
実行使用メモリ 79,328 KB
最終ジャッジ日時 2024-06-24 14:53:32
合計ジャッジ時間 9,741 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
D={};E=[]
for i in range(N):
  x,y=map(int, input().split())
  if y not in D:
    E.append(y)
    D[y]=[]
  D[y].append([x,i+1])

ans=[];f=0
E=sorted(E)[::-1]
F=[]
from collections import deque
d=deque()
for e in E:
  A=D[e]
  A=sorted(A)[::-1]
  for a,b in A:
    d.append((a,b))

s=len(d)//2 
for i in range(s):
  _,x=d.popleft()
  _,y=d.popleft()
  ans.append((x,y))
print(len(ans))
for x,y in ans:
  print(x,y)
0