結果

問題 No.1682 Unfair Game
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2021-09-17 23:04:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 843 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 8,436 KB
最終ジャッジ日時 2023-09-12 09:07:42
合計ジャッジ時間 1,530 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,076 KB
testcase_01 AC 17 ms
8,432 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 17 ms
8,048 KB
testcase_05 WA -
testcase_06 AC 17 ms
8,180 KB
testcase_07 AC 17 ms
8,044 KB
testcase_08 WA -
testcase_09 AC 16 ms
8,048 KB
testcase_10 WA -
testcase_11 AC 16 ms
8,044 KB
testcase_12 AC 17 ms
8,000 KB
testcase_13 AC 17 ms
8,092 KB
testcase_14 AC 17 ms
8,436 KB
testcase_15 AC 17 ms
8,304 KB
testcase_16 AC 17 ms
8,240 KB
testcase_17 AC 17 ms
8,148 KB
testcase_18 AC 17 ms
8,072 KB
testcase_19 WA -
testcase_20 AC 17 ms
8,028 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 3  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
    
mod = 10**9 + 7
N = int(input())
p = list(map(int,input().split()))
front = 0
back = 0
eq = 0
for tp in p:
    if tp>50:
        front += 1
    elif tp < 50:
        back += 1
    else:
        eq += 1
        
cnt = 0
ans = 0
while 2*cnt+1 <= front:
    ans += cmb(front,2*cnt+1,mod)
    cnt += 1
    ans %= mod
    
ans *= pow(2,back+eq,mod)
print(ans%mod)
0