Typical DP Contest

Submission #6343630

Source codeソースコード

K = int(input())
N = 2 ** K
V = [[0 for _ in range(N)] for _ in range(N)]
R = []
for _ in range(N):
    R.append(int(input()))

for i in range(N):
    for j in range(0, i):
        V[i][j] = 1 / (1 + 10 ** ((R[j] - R[i]) / 400))
        V[j][i] = 1 - V[i][j]

dp = [[0 for _ in range(N)] for _ in range(K+1)]
dp[0] = [1] * N

for i in range(1, K+1):
    for j in range(N):
        a = 2 ** (i-1)
        a2 = a * 2
        b = j // a * a
        b2 = j // a2 * a2
        low = b2 + ((b + a) % a2)
        for k in range(low, low+a):
            dp[i][j] += V[j][k] * dp[i-1][k] * dp[i-1][j]

print('\n'.join(map(str, dp[-1])))

Submission

Task問題 C - トーナメント
User nameユーザ名 qython
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 AC
Score得点 4
Source lengthソースコード長 654 Byte
File nameファイル名
Exec time実行時間 1114 ms
Memory usageメモリ使用量 37492 KB

Test case

Set

Set name Score得点 / Max score Cases
All 4 / 4 00,01,02,03,90,91

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00 AC 1114 ms 37492 KB
01 AC 1078 ms 37492 KB
02 AC 1016 ms 37492 KB
03 AC 1100 ms 37492 KB
90 AC 17 ms 3064 KB
91 AC 17 ms 3064 KB