結果

問題 No.1682 Unfair Game
ユーザー ああいいああいい
提出日時 2022-04-27 08:37:07
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 558 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 79,136 KB
最終ジャッジ日時 2023-09-10 16:31:39
合計ジャッジ時間 4,240 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,280 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 70 ms
71,456 KB
testcase_05 RE -
testcase_06 AC 71 ms
71,284 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 72 ms
71,284 KB
testcase_12 RE -
testcase_13 AC 72 ms
71,340 KB
testcase_14 AC 72 ms
71,120 KB
testcase_15 RE -
testcase_16 AC 71 ms
71,284 KB
testcase_17 RE -
testcase_18 AC 70 ms
71,540 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
P = list(map(int,input().split()))
dp = [[0] * 2 for _ in range(N + 1)]
mod = 10 ** 9 + 7
dp[0][0] = 1

import sys
for p in P:
    if p == 50:
        print(pow(2,P-2,P))
        exit()
for i in range(1,N+1):
    if P[i-1] > 50:
        dp[i][1] = dp[i-1][0] + dp[i-1][1]
        dp[i][0] = dp[i-1][1] + dp[i-1][0]
    elif P[i-1] == 50:
        dp[i][0] = dp[i-1][0] * 2
        dp[i][1] = dp[i-1][1] * 2
    else:
        dp[i][1] = dp[i-1][1] * 2
        dp[i][0] = dp[i-1][0] * 2
    dp[i][0] %= mod
    dp[i][1] %= mod
print(dp[-1][1])
0