結果

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

ソースコード

diff #

from heapq import heappop, heappush, heapify
from bisect import bisect
#from sortedcontainers import SortedList
from itertools import permutations
from collections import deque, defaultdict
from math import floor, ceil, isqrt, comb
from sys import stdin, setrecursionlimit
#setrecursionlimit(10**7)
intin = lambda: int(stdin.readline())
strin = lambda: stdin.readline().rstrip()
listin = lambda: list(map(int, stdin.readline().split()))
tuplein = lambda m: [tuple(map(lambda x: int(x) if x.isdigit() or (len(x) > 1 and x[0] == "-" and x[1:].isdigit()) else x, stdin.readline().split())) for _ in range(m)]
gridin = lambda m: [list(map(int, stdin.readline().split())) for _ in range(m)]
strgridin = lambda h: [stdin.readline().rstrip() for _ in range(h)]
mapin = lambda: map(int, stdin.readline().split())
N = intin()
LR = tuplein(N)
ans = 0
for ls in permutations(range(N)):
    prev = 0
    isok = True
    for i in ls:
        if prev <= LR[i][1]:
            prev = max(prev, LR[i][0])
        else:
            isok = False
            break
    if isok:
        ans += 1
print(ans)
0