結果

問題 No.437 cwwゲーム
ユーザー H3PO4H3PO4
提出日時 2020-08-06 09:23:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 11,892 KB
実行使用メモリ 10,592 KB
最終ジャッジ日時 2023-10-19 11:16:31
合計ジャッジ時間 3,492 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,076 KB
testcase_01 AC 33 ms
10,072 KB
testcase_02 AC 47 ms
10,380 KB
testcase_03 AC 32 ms
10,076 KB
testcase_04 AC 32 ms
10,076 KB
testcase_05 AC 53 ms
10,416 KB
testcase_06 AC 75 ms
10,424 KB
testcase_07 AC 75 ms
10,428 KB
testcase_08 AC 55 ms
10,416 KB
testcase_09 AC 81 ms
10,428 KB
testcase_10 AC 56 ms
10,416 KB
testcase_11 AC 33 ms
10,128 KB
testcase_12 AC 35 ms
10,132 KB
testcase_13 AC 48 ms
10,456 KB
testcase_14 AC 36 ms
10,232 KB
testcase_15 AC 53 ms
10,416 KB
testcase_16 AC 134 ms
10,592 KB
testcase_17 AC 41 ms
10,368 KB
testcase_18 AC 41 ms
10,372 KB
testcase_19 AC 31 ms
10,076 KB
testcase_20 AC 33 ms
10,076 KB
testcase_21 AC 32 ms
10,084 KB
testcase_22 AC 32 ms
10,084 KB
testcase_23 AC 74 ms
10,568 KB
testcase_24 AC 32 ms
10,088 KB
testcase_25 AC 66 ms
10,552 KB
testcase_26 AC 79 ms
10,580 KB
testcase_27 AC 31 ms
10,072 KB
testcase_28 AC 31 ms
10,084 KB
testcase_29 AC 31 ms
10,072 KB
testcase_30 AC 32 ms
10,072 KB
testcase_31 AC 33 ms
10,076 KB
testcase_32 AC 34 ms
10,072 KB
testcase_33 AC 40 ms
10,360 KB
testcase_34 AC 33 ms
10,076 KB
testcase_35 AC 45 ms
10,404 KB
testcase_36 AC 31 ms
10,072 KB
testcase_37 AC 31 ms
10,072 KB
testcase_38 AC 34 ms
10,076 KB
testcase_39 AC 32 ms
10,072 KB
testcase_40 AC 32 ms
10,072 KB
testcase_41 AC 45 ms
10,400 KB
testcase_42 AC 42 ms
10,372 KB
testcase_43 AC 47 ms
10,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache
import itertools

N = tuple(int(x) for x in list(input()))

@lru_cache(maxsize=None)
def rec(n):
    if len(n) < 2:
        return 0
    res = 0
    for selector in itertools.combinations(range(len(n)), 3):
        num = tuple(x for i, x in enumerate(n) if i in selector)
        cww = 0
        if num[0] and num[0] != num[1] == num[2]:
            cww = num[0] * 100 + num[1] * 10 + num[2]

        remains = tuple(x for i, x in enumerate(n) if i not in selector)
        res = max(res, cww + rec(remains))
    return res


print(rec(N))
0