結果

問題 No.336 門松列列
ユーザー HIROPON87069639HIROPON87069639
提出日時 2016-02-13 15:50:54
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 1,069 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 7,132 KB
実行使用メモリ 8,096 KB
最終ジャッジ日時 2023-10-22 04:58:53
合計ジャッジ時間 10,332 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 2016.2.13
import time
#N = input()
N = 1000
alpha = [0 for i in range(0, N)]
beta = [0 for i in range(0, N)]
start = time.time()
if N < 3:
    print "0"
else:
    flag = "alpha"
    alpha[0] = 4
    alpha[1] = 2
    beta[0] = 4
    beta[1] = 2
    for i in xrange(3, N):
        if flag == "alpha":
            for j in xrange(0, min(i-1, N/2)):
                tmp = alpha[j]
                beta[j] = 2 * tmp
            for j in xrange(0, min(i-1, N/2)):
                tmp = alpha[j]
                beta[j-1] += tmp * j
                beta[j+1] += tmp * (i - 1 - j)
            flag = "beta"
        else:
            for j in xrange(0, min(i-1, N/2)):
                tmp = beta[j]
                alpha[j] = 2 * tmp
            for j in xrange(0, min(i-1, N/2)):
                tmp = beta[j]
                alpha[j-1] += tmp * j
                alpha[j+1] += tmp * (i - 1 - j)
            flag = "alpha"
    if flag == "alpha":
        print alpha[0] % 1000000007
    else:
        print beta[0] % 1000000007
#print int((time.time() - start) * 1000),  "ms"
0