結果

問題 No.83 最大マッチング
ユーザー tktk_snsntktk_snsn
提出日時 2021-05-17 23:44:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 261 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 818,176 KB
最終ジャッジ日時 2024-04-16 11:19:59
合計ジャッジ時間 11,420 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 AC 31 ms
10,624 KB
testcase_03 AC 30 ms
10,624 KB
testcase_04 AC 32 ms
10,624 KB
testcase_05 AC 33 ms
10,752 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 30 ms
10,624 KB
testcase_09 RE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [-1] * (N+1)
dp[0] = 0
for i in range(N):
    if dp[i] == -1:
        continue
    for j, x in enumerate(M):
        if i + x <= N:
            dp[i+x] = max(dp[i+x], dp[i]*10 + j)

print(max(dp[:N+1]))
0