結果

問題 No.389 ロジックパズルの組み合わせ
ユーザー titiatitia
提出日時 2023-02-08 01:52:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 472 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 259,240 KB
最終ジャッジ日時 2023-09-19 06:08:19
合計ジャッジ時間 33,523 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 320 ms
257,296 KB
testcase_01 WA -
testcase_02 AC 273 ms
256,968 KB
testcase_03 AC 275 ms
256,996 KB
testcase_04 AC 279 ms
257,368 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 285 ms
255,196 KB
testcase_10 AC 283 ms
256,140 KB
testcase_11 AC 276 ms
257,632 KB
testcase_12 AC 272 ms
255,724 KB
testcase_13 AC 292 ms
257,068 KB
testcase_14 AC 277 ms
257,928 KB
testcase_15 AC 275 ms
254,684 KB
testcase_16 AC 274 ms
256,232 KB
testcase_17 AC 272 ms
256,672 KB
testcase_18 AC 303 ms
254,280 KB
testcase_19 AC 270 ms
257,020 KB
testcase_20 AC 269 ms
257,328 KB
testcase_21 AC 264 ms
257,240 KB
testcase_22 AC 267 ms
257,056 KB
testcase_23 AC 272 ms
257,116 KB
testcase_24 AC 272 ms
257,052 KB
testcase_25 AC 265 ms
257,184 KB
testcase_26 AC 267 ms
257,184 KB
testcase_27 AC 265 ms
257,084 KB
testcase_28 AC 267 ms
257,176 KB
testcase_29 AC 266 ms
257,328 KB
testcase_30 AC 263 ms
257,332 KB
testcase_31 AC 264 ms
257,108 KB
testcase_32 AC 267 ms
257,296 KB
testcase_33 AC 266 ms
257,112 KB
testcase_34 AC 261 ms
257,004 KB
testcase_35 AC 259 ms
257,392 KB
testcase_36 AC 261 ms
257,060 KB
testcase_37 AC 260 ms
257,180 KB
testcase_38 AC 260 ms
257,236 KB
testcase_39 AC 259 ms
257,364 KB
testcase_40 AC 261 ms
257,056 KB
testcase_41 AC 262 ms
257,088 KB
testcase_42 AC 266 ms
257,332 KB
testcase_43 AC 264 ms
257,292 KB
testcase_44 AC 264 ms
256,968 KB
testcase_45 AC 267 ms
256,992 KB
testcase_46 AC 264 ms
257,088 KB
testcase_47 AC 262 ms
257,004 KB
testcase_48 AC 262 ms
257,300 KB
testcase_49 AC 312 ms
251,284 KB
testcase_50 AC 262 ms
254,632 KB
testcase_51 AC 266 ms
254,984 KB
testcase_52 AC 270 ms
255,296 KB
testcase_53 AC 273 ms
256,176 KB
testcase_54 AC 272 ms
256,880 KB
testcase_55 AC 268 ms
257,272 KB
testcase_56 AC 269 ms
255,868 KB
testcase_57 AC 285 ms
257,196 KB
testcase_58 AC 304 ms
256,928 KB
testcase_59 AC 288 ms
250,744 KB
testcase_60 AC 277 ms
256,784 KB
testcase_61 AC 318 ms
254,436 KB
testcase_62 AC 279 ms
256,684 KB
testcase_63 AC 294 ms
256,736 KB
testcase_64 AC 275 ms
256,608 KB
testcase_65 AC 272 ms
255,964 KB
testcase_66 AC 275 ms
256,384 KB
testcase_67 AC 273 ms
257,176 KB
testcase_68 AC 289 ms
255,752 KB
testcase_69 AC 265 ms
257,092 KB
testcase_70 AC 262 ms
257,284 KB
testcase_71 AC 262 ms
257,104 KB
testcase_72 AC 263 ms
256,820 KB
testcase_73 AC 261 ms
257,040 KB
testcase_74 AC 258 ms
256,944 KB
testcase_75 AC 258 ms
256,932 KB
testcase_76 AC 263 ms
256,880 KB
testcase_77 AC 263 ms
257,280 KB
testcase_78 AC 262 ms
257,112 KB
testcase_79 AC 259 ms
256,888 KB
testcase_80 AC 260 ms
256,964 KB
testcase_81 AC 259 ms
256,828 KB
testcase_82 AC 261 ms
257,156 KB
testcase_83 AC 260 ms
257,264 KB
testcase_84 AC 262 ms
257,052 KB
testcase_85 AC 261 ms
257,472 KB
testcase_86 AC 263 ms
257,504 KB
testcase_87 AC 261 ms
256,932 KB
testcase_88 AC 264 ms
256,984 KB
testcase_89 AC 277 ms
256,732 KB
testcase_90 AC 286 ms
257,572 KB
testcase_91 AC 316 ms
250,940 KB
testcase_92 AC 270 ms
256,632 KB
testcase_93 AC 290 ms
249,428 KB
testcase_94 AC 263 ms
257,480 KB
testcase_95 AC 299 ms
250,444 KB
testcase_96 AC 307 ms
257,384 KB
testcase_97 AC 284 ms
257,048 KB
testcase_98 AC 272 ms
255,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M=int(input())
H=list(map(int,input().split()))

mod=10**9+7

FACT=[1]
for i in range(1,2*10**6+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(2*10**6,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]%mod*FACT_INV[a-b]%mod
    else:
        return 0

x=sum(H)+len(H)-1
rest=M-x

if rest<0:
    print("NA")
else:
    print(Combi(rest+len(H),rest))
0