結果

問題 No.2796 Small Matryoshka
ユーザー akazuki8
提出日時 2024-06-28 22:35:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 257 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 111,408 KB
最終ジャッジ日時 2024-06-28 22:35:13
合計ジャッジ時間 9,319 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=sorted([list(map(int,input().split())) for i in range(n)],key=lambda item: (item[0], -item[1]))
c=0
T=True
for i in range(n-1):
	if a[i][1]>a[i+1][0]:
		if T and i!=n-2 and a[i][1]<a[i+2][0]:
			T=False
			continue
		c+=1 
		T=True
print(c)
0