結果

問題 No.1824 門\松\列
ユーザー stngstng
提出日時 2022-05-14 16:40:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 357 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 815,056 KB
最終ジャッジ日時 2023-09-30 08:28:22
合計ジャッジ時間 4,267 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 242 ms
86,528 KB
testcase_01 MLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)

n = int(input())
t = [int(input()) for i in range(n)]
#print(t)

ans = [0]*(10**7+1)

from functools import lru_cache
@lru_cache(maxsize=10**7)
def dfs(x):
    if x == 3:
        return 4
    ans[x] += dfs(x-1)+(x-1)*(x-2)*2
    return ans[x]

for i in range(n):
    #print(t[i],i)
    print(dfs(t[i]))
    #print(i)
0