結果

問題 No.1151 チャレンジゲーム
ユーザー Kiri8128Kiri8128
提出日時 2020-07-03 01:42:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 465 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 81,508 KB
実行使用メモリ 85,052 KB
最終ジャッジ日時 2023-10-17 06:33:46
合計ジャッジ時間 17,155 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,352 KB
testcase_01 AC 39 ms
53,348 KB
testcase_02 AC 94 ms
73,564 KB
testcase_03 AC 38 ms
53,400 KB
testcase_04 AC 39 ms
53,404 KB
testcase_05 AC 39 ms
53,404 KB
testcase_06 AC 39 ms
53,404 KB
testcase_07 AC 40 ms
53,404 KB
testcase_08 AC 39 ms
53,404 KB
testcase_09 AC 40 ms
53,404 KB
testcase_10 AC 41 ms
53,404 KB
testcase_11 AC 50 ms
62,160 KB
testcase_12 AC 62 ms
68,640 KB
testcase_13 AC 288 ms
80,448 KB
testcase_14 AC 270 ms
79,632 KB
testcase_15 AC 264 ms
79,404 KB
testcase_16 AC 332 ms
80,824 KB
testcase_17 AC 334 ms
81,352 KB
testcase_18 AC 293 ms
79,256 KB
testcase_19 AC 256 ms
78,864 KB
testcase_20 AC 251 ms
78,984 KB
testcase_21 AC 290 ms
80,384 KB
testcase_22 AC 247 ms
79,300 KB
testcase_23 AC 249 ms
78,720 KB
testcase_24 AC 256 ms
79,316 KB
testcase_25 AC 301 ms
79,904 KB
testcase_26 AC 292 ms
80,776 KB
testcase_27 AC 263 ms
79,052 KB
testcase_28 AC 369 ms
81,860 KB
testcase_29 AC 404 ms
83,516 KB
testcase_30 AC 352 ms
81,848 KB
testcase_31 AC 397 ms
82,740 KB
testcase_32 AC 362 ms
81,848 KB
testcase_33 AC 407 ms
84,160 KB
testcase_34 AC 366 ms
83,380 KB
testcase_35 AC 372 ms
83,140 KB
testcase_36 AC 438 ms
85,052 KB
testcase_37 AC 429 ms
83,884 KB
testcase_38 AC 394 ms
83,008 KB
testcase_39 AC 357 ms
82,140 KB
testcase_40 AC 363 ms
82,028 KB
testcase_41 AC 335 ms
82,048 KB
testcase_42 AC 420 ms
83,724 KB
testcase_43 AC 414 ms
83,656 KB
testcase_44 AC 378 ms
82,464 KB
testcase_45 AC 388 ms
83,120 KB
testcase_46 AC 465 ms
84,776 KB
testcase_47 AC 373 ms
81,248 KB
testcase_48 AC 254 ms
79,568 KB
testcase_49 AC 271 ms
80,588 KB
testcase_50 AC 346 ms
80,860 KB
testcase_51 AC 385 ms
83,328 KB
testcase_52 AC 443 ms
84,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = [int(a) for a in input().split()]
D = {}
def prob(i, j, s, t, h):
    p, q, a, b = 1 / A[i], 1 / A[j], 1 - calc(s ^ (1 << i), h + 1 - t), calc(s ^ (1 << j), t)
    x = (p * a + (1 - p) * q * b) / (p + q - p * q)
    return x
def calc(s, t):
    if t <= 0: return 1
    if s == 0: return 0
    y = s + (t << N)
    if y in D: return D[y]
    h = sum([A[i] for i in range(N) if s >> i & 1])
    D[y] = max([min([prob(i, j, s, t, h) for j in range(N) if s >> j & 1] + [1]) for i in range(N) if s >> i & 1] + [0])
    return D[y]
print(calc((1 << N) - 1, sum(A) // 2 + 1))
0