結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー urunea
提出日時 2025-09-06 13:54:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 565 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 82,588 KB
実行使用メモリ 76,472 KB
最終ジャッジ日時 2025-09-06 13:55:14
合計ジャッジ時間 20,589 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N=int(input())
mem=[]
for _ in range(N):
    L, R = map(int, input().split())
    mem.append([L, R])

ans=0
for perm in permutations(mem):
    idx = 0
    x = 1
    S = []
    while x <= 3854 and idx < N:
        if perm[idx][0] <= x <= perm[idx][1]:
            S.append(x)
            idx += 1
        x += 1

    if len(S) == N:  # 全部埋まった
        ok = True
        for j in range(1, N):
            if S[j-1] > S[j]:
                ok = False
                break
        if ok:
            ans += 1

print(ans)
0