結果

問題 No.1231 Make a Multiple of Ten
ユーザー c-yanc-yan
提出日時 2020-09-20 02:16:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 283 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 10,716 KB
実行使用メモリ 29,928 KB
最終ジャッジ日時 2023-09-06 06:07:12
合計ジャッジ時間 14,349 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,952 KB
testcase_01 AC 16 ms
7,748 KB
testcase_02 AC 15 ms
7,812 KB
testcase_03 AC 15 ms
7,852 KB
testcase_04 AC 1,018 ms
18,016 KB
testcase_05 AC 901 ms
16,772 KB
testcase_06 AC 362 ms
11,500 KB
testcase_07 AC 1,043 ms
18,528 KB
testcase_08 AC 611 ms
13,860 KB
testcase_09 AC 216 ms
9,988 KB
testcase_10 AC 942 ms
17,284 KB
testcase_11 AC 1,133 ms
19,196 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 16 ms
7,784 KB
testcase_15 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, *A = map(int, open(0).read().split())

dp = [-1] * 10
dp[0] = 0
for a in A:
    t = [-1] * 10
    for i in range(10):
        if dp[i] == -1:
            continue
        t[i] = max(t[i], dp[i])
        n = (i + a) % 10
        t[n] = max(t[n], dp[i] + 1)
    dp = t
print(dp[0])
0