結果

問題 No.1231 Make a Multiple of Ten
ユーザー Yahiya YusufzaiYahiya Yusufzai
提出日時 2020-09-19 00:17:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 334 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 100,504 KB
最終ジャッジ日時 2023-09-04 13:58:53
合計ジャッジ時間 14,743 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,768 KB
testcase_01 AC 16 ms
7,752 KB
testcase_02 AC 16 ms
7,848 KB
testcase_03 AC 17 ms
7,772 KB
testcase_04 AC 1,484 ms
52,612 KB
testcase_05 AC 1,269 ms
46,896 KB
testcase_06 AC 492 ms
23,280 KB
testcase_07 AC 1,525 ms
54,500 KB
testcase_08 AC 861 ms
34,404 KB
testcase_09 AC 297 ms
17,044 KB
testcase_10 AC 1,353 ms
49,160 KB
testcase_11 AC 1,629 ms
57,808 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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