結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー Kaira
提出日時 2025-09-06 13:51:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,512 KB
実行使用メモリ 73,812 KB
最終ジャッジ日時 2025-09-06 13:52:04
合計ジャッジ時間 2,638 ms
ジャッジサーバーID
(参考情報)
judge3 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations
N = int(input())
probs = []
for _ in range(N):
  L, R = map(int, input().split())
  probs.append((L, R))

cnt = 0
isValid = True
for perm in permutations(probs):
  x = -float("inf")
  for L, R in perm:
    x = max(L, x)
    if x > R:
      isValid = False
      break
  if isValid:
    cnt += 1
  else:
    isValid = True

print(cnt)


0