結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー yamasakih
提出日時 2025-09-13 11:16:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 843 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 13,824 KB
最終ジャッジ日時 2025-09-13 11:16:06
合計ジャッジ時間 5,213 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 4 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import *
from functools import cache, partial
from itertools import *
from pprint import pprint
from typing import Any, Final

try:
    from icecream import ic
except ImportError:  # Graceful fallback if IceCream isn't installed.
    ic = lambda *a: None if not a else (a[0] if len(a) == 1 else a)  # noqa
debug = partial(print, file=sys.stderr)
dpprint = partial(pprint, stream=sys.stderr)
sys.setrecursionlimit(10 ** 6)
MOD=998244353

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

ans = 0
for P in permutations(range(N)):
    # ic(P)
    is_ok = True
    for pi, pj in zip(P, P[1:]):
        # ic(pi, pj)
        if LR[pi][0] > LR[pj][1]:
            is_ok = False
    if is_ok:
        # ic([p + 1 for p in P])
        ans += 1

print(ans)
0