結果

問題 No.108 トリプルカードコンプ
ユーザー ygd.ygd.
提出日時 2021-01-28 00:09:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 594 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 202,560 KB
最終ジャッジ日時 2023-09-07 06:55:38
合計ジャッジ時間 7,469 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
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