結果

問題 No.1231 Make a Multiple of Ten
ユーザー lloyzlloyz
提出日時 2022-02-05 09:13:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 392 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 118,132 KB
最終ジャッジ日時 2023-09-02 06:28:11
合計ジャッジ時間 15,307 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,956 KB
testcase_01 AC 15 ms
7,852 KB
testcase_02 AC 15 ms
7,880 KB
testcase_03 AC 16 ms
7,812 KB
testcase_04 AC 1,517 ms
58,208 KB
testcase_05 AC 1,319 ms
51,992 KB
testcase_06 AC 525 ms
25,404 KB
testcase_07 AC 1,614 ms
60,544 KB
testcase_08 AC 921 ms
37,996 KB
testcase_09 AC 322 ms
18,124 KB
testcase_10 AC 1,465 ms
54,580 KB
testcase_11 AC 1,782 ms
64,064 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

INF = 10**10
DP = [[-INF for _ in range(10)] for _ in range(n + 1)]
DP[0][0] = 0
for i in range(n):
    for j in range(10):
        if DP[i][j] == -INF:
            continue
        DP[i + 1][j] = max(DP[i + 1][j], DP[i][j])
        r = (j + A[i]) % 10
        DP[i + 1][r] = max(DP[i + 1][r], DP[i][j] + 1)
print(DP[n][0])
0