結果

問題 No.1785 Inequality Signs
ユーザー KudeKude
提出日時 2021-12-14 01:00:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 1,040 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 82,016 KB
最終ジャッジ日時 2023-09-30 07:06:43
合計ジャッジ時間 10,677 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,384 KB
testcase_01 AC 105 ms
78,228 KB
testcase_02 AC 188 ms
82,016 KB
testcase_03 AC 221 ms
81,432 KB
testcase_04 AC 84 ms
76,444 KB
testcase_05 AC 142 ms
79,840 KB
testcase_06 AC 202 ms
80,728 KB
testcase_07 AC 85 ms
76,184 KB
testcase_08 AC 195 ms
80,720 KB
testcase_09 AC 104 ms
78,000 KB
testcase_10 AC 165 ms
80,976 KB
testcase_11 AC 110 ms
78,052 KB
testcase_12 AC 130 ms
79,292 KB
testcase_13 AC 102 ms
78,036 KB
testcase_14 AC 147 ms
80,264 KB
testcase_15 AC 135 ms
79,180 KB
testcase_16 AC 119 ms
78,652 KB
testcase_17 AC 170 ms
81,484 KB
testcase_18 AC 169 ms
81,244 KB
testcase_19 AC 150 ms
80,324 KB
testcase_20 AC 158 ms
80,692 KB
testcase_21 AC 150 ms
80,320 KB
testcase_22 AC 108 ms
78,144 KB
testcase_23 AC 121 ms
78,968 KB
testcase_24 AC 215 ms
81,452 KB
testcase_25 AC 134 ms
79,436 KB
testcase_26 AC 132 ms
79,460 KB
testcase_27 AC 220 ms
81,540 KB
testcase_28 AC 220 ms
81,472 KB
testcase_29 AC 220 ms
81,484 KB
testcase_30 AC 222 ms
81,336 KB
testcase_31 AC 222 ms
81,664 KB
testcase_32 AC 220 ms
81,564 KB
testcase_33 AC 73 ms
71,348 KB
testcase_34 AC 90 ms
76,420 KB
testcase_35 AC 101 ms
78,100 KB
testcase_36 AC 188 ms
80,788 KB
testcase_37 AC 189 ms
81,428 KB
testcase_38 AC 175 ms
80,744 KB
testcase_39 AC 113 ms
78,792 KB
testcase_40 AC 126 ms
79,036 KB
testcase_41 AC 150 ms
80,732 KB
testcase_42 AC 208 ms
81,680 KB
testcase_43 AC 219 ms
81,484 KB
testcase_44 AC 195 ms
80,980 KB
testcase_45 AC 122 ms
78,936 KB
testcase_46 AC 169 ms
80,420 KB
testcase_47 AC 139 ms
79,972 KB
testcase_48 AC 160 ms
81,224 KB
testcase_49 AC 88 ms
76,288 KB
testcase_50 AC 194 ms
80,696 KB
testcase_51 AC 94 ms
77,404 KB
testcase_52 AC 89 ms
76,456 KB
testcase_53 AC 98 ms
77,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10 ** 9 + 7
n, k = map(int, input().split())
fact = [1] * (n + 1)
permk = [1] * (n + 1)
for i in range(n):
    fact[i + 1] = fact[i] * (i + 1) % mod
    permk[i + 1] = permk[i] * (k - i) % mod
ifact = [1] * (n + 1)
ifact[n] = pow(fact[n], mod - 2, mod)
for i in range(n)[::-1]:
    ifact[i] = ifact[i + 1] * (i + 1) % mod
ans = sum(permk[n - i] * ifact[n - i] * fact[n - 1] * ifact[n - 1 - i] * ifact[i] * pow(2, n - 1 - i, mod) for i in range(n)) % mod
print(ans)
0