結果

問題 No.1231 Make a Multiple of Ten
ユーザー yatsurugiyatsurugi
提出日時 2020-09-24 14:19:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 358 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 30,404 KB
最終ジャッジ日時 2023-09-10 13:26:32
合計ジャッジ時間 14,478 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 17 ms
7,860 KB
testcase_02 AC 16 ms
7,804 KB
testcase_03 AC 15 ms
7,876 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 17 ms
7,856 KB
testcase_15 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

# dp[mod] = 最大の枚数
dp = [-1] * 10
dp[0] = 0
for a in A:
    dp_tmp = [-1] * 10
    for i in range(10):
        if dp[i] == -1:
            continue
        dp_tmp[i] = max(dp[i], dp_tmp[i])
        n = (i + a) % 10
        dp_tmp[n] = max(dp_tmp[i] + 1, dp_tmp[n])
    dp = dp_tmp

print(dp[0])
0