結果

問題 No.108 トリプルカードコンプ
ユーザー ygd.ygd.
提出日時 2021-01-28 00:10:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 595 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 209,380 KB
最終ジャッジ日時 2023-09-07 06:56:15
合計ジャッジ時間 6,964 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
209,380 KB
testcase_01 AC 23 ms
8,924 KB
testcase_02 AC 21 ms
8,936 KB
testcase_03 AC 21 ms
8,804 KB
testcase_04 AC 21 ms
8,864 KB
testcase_05 AC 22 ms
8,808 KB
testcase_06 AC 21 ms
8,808 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000)

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

B = [min(A[i],3) for i in range(N)]
B = tuple(B)
#print(B)

@lru_cache(maxsize=None)
def solve(X):
    ret = 1
    Z = list(X)
    loop = N
    for i,v in enumerate(Z):
        if v < 3:
            T = copy.copy(Z)
            T[i] = v+1
            T = tuple(T)
            ret += solve(T)/N
        else:
            loop -= 1
    if loop == 0:
        ret = 0
    else:
        ret *= N/loop
    #print(Z,ret)
    return ret

ans = solve(B)
print(ans)
0