結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー LyricalMaestro
提出日時 2025-09-13 10:23:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 75,468 KB
最終ジャッジ日時 2025-09-13 10:23:55
合計ジャッジ時間 3,274 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

# https://yukicoder.me/problems/no/801

import itertools

def main():
    N = int(input())
    lr = []
    for _ in range(N):
        L, R = map(int, input().split())
        lr.append((L, R))
    
    answer= 0
    for p in itertools.permutations([j for j in range(N)]):
        x = -1
        is_ok = True
        for i in p:
            l, r = lr[i]
            if x > r:
                is_ok = False
                break

            x = max(x, l)
        if is_ok:
            answer += 1
    print(answer)







if __name__ == "__main__":
    main()
0