結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー ねしん
提出日時 2025-09-06 14:36:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 69,504 KB
最終ジャッジ日時 2025-09-06 14:36:21
合計ジャッジ時間 2,872 ms
ジャッジサーバーID
(参考情報)
judge / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N = int(input())

A = []
for i in range(N):
	A.append(i)

T = []
for i in range(N):
	L, R = list(map(int,input().split()))
	T.append((L, R))
	
ans = 0
for per in itertools.permutations(A):
	now = 0
	ok = 1
	for i in range(N):
		L, R = T[per[i]]
		if R < now:
			ok = 0
			break
		elif now < L:
			now = L
		else:
			continue
	ans += ok
print(ans)
0