結果
| 問題 | No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-09-06 13:42:24 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 791 bytes | 
| コンパイル時間 | 176 ms | 
| コンパイル使用メモリ | 82,340 KB | 
| 実行使用メモリ | 76,872 KB | 
| 最終ジャッジ日時 | 2025-09-06 13:42:38 | 
| 合計ジャッジ時間 | 7,869 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 20 WA * 4 | 
ソースコード
from itertools import permutations
N=int(input())
mem=[]
for i in range(N):
    L, R = (int(x) for x in input().split())
    mem.append([L, R])
ans=0
for i in permutations(mem):
    ok=True
    S=[]
    for j in range(1, N):
        if i[j-1][0] <= i[j][1]:
            continue
        else:
            ok = False
    
    if ok:
        idx = 1
        x = 1
        while x <= 3854 and idx <= N-1:
            if i[idx-1][0] <= x <= i[idx][1]:
                S.append(x)
                idx += 1
            x += 1
        
        S.append(i[-1][1])
        ok2 = True
        if len(S) < N:
            ok2 = False
            continue
        for i in range(1, N):
            if S[i-1] > S[i]:
                ok2 = False
        
        if ok2:
            ans += 1
print(ans)
            
            
            
        