結果

問題 No.1682 Unfair Game
ユーザー shotoyooshotoyoo
提出日時 2021-09-24 01:04:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 71,592 KB
最終ジャッジ日時 2023-09-18 20:06:29
合計ジャッジ時間 3,260 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,460 KB
testcase_01 AC 77 ms
71,204 KB
testcase_02 AC 78 ms
71,336 KB
testcase_03 AC 80 ms
71,200 KB
testcase_04 AC 79 ms
71,268 KB
testcase_05 AC 78 ms
71,060 KB
testcase_06 AC 77 ms
71,512 KB
testcase_07 AC 76 ms
71,100 KB
testcase_08 AC 77 ms
71,208 KB
testcase_09 AC 75 ms
71,240 KB
testcase_10 AC 77 ms
71,216 KB
testcase_11 AC 76 ms
71,492 KB
testcase_12 AC 75 ms
71,300 KB
testcase_13 AC 78 ms
71,192 KB
testcase_14 AC 77 ms
71,456 KB
testcase_15 AC 76 ms
71,452 KB
testcase_16 AC 76 ms
71,140 KB
testcase_17 AC 75 ms
71,132 KB
testcase_18 AC 75 ms
71,336 KB
testcase_19 AC 78 ms
71,592 KB
testcase_20 AC 76 ms
71,240 KB
testcase_21 AC 75 ms
71,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


n = int(input())
p = list(map(int, input().split()))
M = 10**9+7
inv2 = pow(2, M-2, M)
dp = [1,0,0] # (0.5未満, 0.5, 0.5以上)
for v in p:
    ndp = dp[:]
    if v<50:
        for i in range(3):
            ndp[i] += dp[i]
            ndp[i] %= M
    elif v>50:
        for i in range(3):
            ndp[2-i] += dp[i]
            ndp[2-i] %= M
    else:
        ndp[1] += sum(dp)
        ndp[1] %= M
    dp = ndp
ans = dp[2]
print(ans%M)
0