結果
問題 | No.2353 Guardian Dogs in Spring |
ユーザー |
|
提出日時 | 2023-06-16 22:16:47 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 97 ms / 2,000 ms |
コード長 | 588 bytes |
コンパイル時間 | 391 ms |
コンパイル使用メモリ | 82,116 KB |
実行使用メモリ | 78,860 KB |
最終ジャッジ日時 | 2024-06-24 14:47:08 |
合計ジャッジ時間 | 9,089 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 40 |
ソースコード
import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd n = int(input()) xs = [[] for i in range(8050)] for i in range(n): x,y = map(int,input().split()) xs[x].append((y,i)) ans = [] left = [] for x in range(8050): xs[x].sort() for y,i in xs[x]: if not left: left.append(i+1) else: ans.append([i+1,left.pop()]) print(len(ans)) for a,b in ans: print(a,b)