結果

問題 No.437 cwwゲーム
ユーザー kohei2019kohei2019
提出日時 2022-01-25 00:41:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 726 bytes
コンパイル時間 1,105 ms
コンパイル使用メモリ 86,644 KB
実行使用メモリ 78,144 KB
最終ジャッジ日時 2023-08-21 16:04:44
合計ジャッジ時間 6,950 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,704 KB
testcase_01 AC 92 ms
71,404 KB
testcase_02 AC 122 ms
77,664 KB
testcase_03 AC 92 ms
71,632 KB
testcase_04 AC 90 ms
71,644 KB
testcase_05 AC 121 ms
77,764 KB
testcase_06 AC 122 ms
77,772 KB
testcase_07 AC 124 ms
77,332 KB
testcase_08 AC 125 ms
77,740 KB
testcase_09 AC 123 ms
77,612 KB
testcase_10 AC 119 ms
77,608 KB
testcase_11 AC 93 ms
71,652 KB
testcase_12 AC 94 ms
71,320 KB
testcase_13 AC 114 ms
77,660 KB
testcase_14 AC 102 ms
76,832 KB
testcase_15 AC 118 ms
77,600 KB
testcase_16 AC 142 ms
77,968 KB
testcase_17 AC 112 ms
77,444 KB
testcase_18 AC 109 ms
77,392 KB
testcase_19 AC 92 ms
71,648 KB
testcase_20 AC 89 ms
71,792 KB
testcase_21 AC 90 ms
71,496 KB
testcase_22 AC 91 ms
71,548 KB
testcase_23 AC 143 ms
77,984 KB
testcase_24 AC 91 ms
71,460 KB
testcase_25 AC 136 ms
78,144 KB
testcase_26 AC 138 ms
78,136 KB
testcase_27 AC 91 ms
71,736 KB
testcase_28 AC 89 ms
71,700 KB
testcase_29 AC 89 ms
71,644 KB
testcase_30 AC 88 ms
71,672 KB
testcase_31 AC 89 ms
71,636 KB
testcase_32 AC 87 ms
71,616 KB
testcase_33 AC 103 ms
77,696 KB
testcase_34 AC 90 ms
71,756 KB
testcase_35 AC 113 ms
77,412 KB
testcase_36 AC 91 ms
71,352 KB
testcase_37 AC 96 ms
71,560 KB
testcase_38 AC 91 ms
71,780 KB
testcase_39 AC 91 ms
71,640 KB
testcase_40 AC 91 ms
71,640 KB
testcase_41 AC 115 ms
77,676 KB
testcase_42 AC 111 ms
77,328 KB
testcase_43 AC 114 ms
77,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N = list(input())
ans = 0
dd = collections.defaultdict(lambda:0)
def func(ls):
    if len(ls) < 3:
        dd[''.join(ls)] = 0
        return 0
    s = ''.join(ls)
    if s in dd:
        return dd[s]
    c = len(ls)
    val = 0
    for i in range(c-2):
        for j in range(i+1,c-1):
            for k in range(j+1,c):
                ls0 = ls[:]
                a0,b0,c0 = ls0[i],ls0[k],ls0[j]
                del ls0[i]
                del ls0[j-1]
                del ls0[k-2]
                if a0 != '0' and a0!=b0 and b0==c0:
                    val = max(val,func(ls0)+int(a0+b0+c0))
                else:
                    val = max(val,func(ls0))
    dd[s] = val
    return val
print(func(N))
0