Typical DP Contest

Submission #6343634

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言語 PyPy3 (2.4.0)
Status状態 AC
Score得点 4
Source lengthソースコード長 654 Byte
File nameファイル名
Exec time実行時間 409 ms
Memory usageメモリ使用量 85596 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 409 ms 85596 KB
01 AC 384 ms 83804 KB
02 AC 337 ms 83548 KB
03 AC 382 ms 83932 KB
90 AC 162 ms 38256 KB
91 AC 164 ms 38256 KB