結果

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

ソースコード

diff #

from itertools import groupby, accumulate, combinations, permutations, product, combinations_with_replacement

n = int(input().strip())
L = []
R = []

for i in range(n):
    l,r = map(int, input().split())
    L.append(l)
    R.append(r)

cnt = 0
for per in permutations(range(n)):
    flag = True
    now = 0
    for num in per:
        now = max(now, L[num])
        if now > R[num]:
            flag = False
            break
    if flag:
        cnt += 1

print(cnt)
0