結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー ゼット
提出日時 2025-09-06 13:12:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 69,888 KB
最終ジャッジ日時 2025-09-06 13:15:05
合計ジャッジ時間 3,014 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=[]
for i in range(N):
  l,r=map(int,input().split())
  A.append((l,r))
from itertools import permutations
L=[i for i in range(N)]
result=0
for P in permutations(L):
  x=0
  ans=True
  for i in range(N):
    pos=P[i]
    l,r=A[pos][0],A[pos][1]
    if x<=l:
      x=l
    elif l<=x<=r:
      x+=0
    else:
      ans=False
  if ans==True:
    result+=1
print(result)
    
0