結果

問題 No.1231 Make a Multiple of Ten
ユーザー yvay5cqeyvay5cqe
提出日時 2020-09-28 02:53:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 325 bytes
コンパイル時間 988 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 24,116 KB
最終ジャッジ日時 2023-09-13 13:58:18
合計ジャッジ時間 16,308 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,736 KB
testcase_01 AC 15 ms
7,788 KB
testcase_02 AC 15 ms
7,824 KB
testcase_03 AC 15 ms
7,924 KB
testcase_04 AC 1,081 ms
15,136 KB
testcase_05 AC 957 ms
14,208 KB
testcase_06 AC 382 ms
10,460 KB
testcase_07 AC 1,123 ms
15,716 KB
testcase_08 AC 646 ms
12,296 KB
testcase_09 AC 230 ms
9,420 KB
testcase_10 AC 1,022 ms
14,908 KB
testcase_11 AC 1,185 ms
16,048 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 15 ms
7,880 KB
testcase_15 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = map(int, input().split())
dp = [-1 for _ in range(10)]
dp[0] = 0
for a in A:
    tmp = [-1 for _ in range(10)]
    for i in range(10):
        if dp[i] == -1:
            continue
        tmp[i] = max(tmp[i], dp[i])
        tmp[(i + a) % 10] = max(tmp[(i + a) % 10], dp[i] + 1)
    dp = tmp
print(dp[0])
0