結果

問題 No.2796 Small Matryoshka
ユーザー 2000 Ekiben2000 Ekiben
提出日時 2024-06-28 22:00:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 23,968 KB
最終ジャッジ日時 2024-06-28 22:00:29
合計ジャッジ時間 4,181 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
17,696 KB
testcase_01 AC 24 ms
10,752 KB
testcase_02 AC 25 ms
10,752 KB
testcase_03 AC 25 ms
10,624 KB
testcase_04 WA -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def min_(N, dolls):
    dolls.sort(key=lambda x: (x[1], x[0]))
    dp = [1] * N
    #?
    for i in range(N):
        for j in range(i):
            if dolls[j][1] <= dolls[i][0]:
                dp[i] = max(dp[i], dp[j] + 1)
    max_ = max(dp)
    return N - max_
N = int(input())
dolls = []
for _ in range(N):
    r, R = map(int, input().split())
    dolls.append((r, R))
print(min_(N, dolls))
0