結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー programogumogu
提出日時 2025-09-06 17:18:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 81,932 KB
実行使用メモリ 76,492 KB
最終ジャッジ日時 2025-09-06 17:18:15
合計ジャッジ時間 2,911 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
n = int(input())
lr = []
for i in range(n):
  l,r = map(int,input().split())
  lr.append((l,r))
ans = 0
for res in itertools.permutations(range(n)):
  now = 0
  for i in range(n-1):
    if max(lr[res[i]][0],now) > lr[res[i+1]][1]:
      break
    else:
      now = max(lr[res[i]][0],now)
  else:
    ans += 1
    #print(res)
print(ans)
0