結果

問題 No.389 ロジックパズルの組み合わせ
ユーザー TawaraTawara
提出日時 2016-07-08 23:44:01
言語 Python2
(2.7.18)
結果
AC  
実行時間 752 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 68,548 KB
最終ジャッジ日時 2024-04-21 08:39:00
合計ジャッジ時間 26,219 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,816 KB
testcase_01 AC 20 ms
6,944 KB
testcase_02 AC 12 ms
6,940 KB
testcase_03 AC 12 ms
6,940 KB
testcase_04 AC 434 ms
47,928 KB
testcase_05 AC 64 ms
11,392 KB
testcase_06 AC 255 ms
30,380 KB
testcase_07 AC 608 ms
65,884 KB
testcase_08 AC 271 ms
32,384 KB
testcase_09 AC 527 ms
56,736 KB
testcase_10 AC 97 ms
14,020 KB
testcase_11 AC 535 ms
57,452 KB
testcase_12 AC 63 ms
10,624 KB
testcase_13 AC 679 ms
68,136 KB
testcase_14 AC 116 ms
14,880 KB
testcase_15 AC 103 ms
14,976 KB
testcase_16 AC 243 ms
28,136 KB
testcase_17 AC 378 ms
41,336 KB
testcase_18 AC 523 ms
48,748 KB
testcase_19 AC 12 ms
6,944 KB
testcase_20 AC 13 ms
6,944 KB
testcase_21 AC 13 ms
6,940 KB
testcase_22 AC 12 ms
6,944 KB
testcase_23 AC 13 ms
6,940 KB
testcase_24 AC 13 ms
6,940 KB
testcase_25 AC 12 ms
6,944 KB
testcase_26 AC 13 ms
6,940 KB
testcase_27 AC 12 ms
6,944 KB
testcase_28 AC 12 ms
6,944 KB
testcase_29 AC 12 ms
6,940 KB
testcase_30 AC 11 ms
6,940 KB
testcase_31 AC 11 ms
6,944 KB
testcase_32 AC 11 ms
6,940 KB
testcase_33 AC 12 ms
6,940 KB
testcase_34 AC 13 ms
6,944 KB
testcase_35 AC 12 ms
6,944 KB
testcase_36 AC 12 ms
6,940 KB
testcase_37 AC 12 ms
6,944 KB
testcase_38 AC 12 ms
6,940 KB
testcase_39 AC 13 ms
6,944 KB
testcase_40 AC 12 ms
6,940 KB
testcase_41 AC 13 ms
6,944 KB
testcase_42 AC 13 ms
6,940 KB
testcase_43 AC 13 ms
6,944 KB
testcase_44 AC 12 ms
6,944 KB
testcase_45 AC 11 ms
6,940 KB
testcase_46 AC 12 ms
6,944 KB
testcase_47 AC 12 ms
6,940 KB
testcase_48 AC 13 ms
6,944 KB
testcase_49 AC 552 ms
51,052 KB
testcase_50 AC 143 ms
18,424 KB
testcase_51 AC 59 ms
10,496 KB
testcase_52 AC 518 ms
55,360 KB
testcase_53 AC 142 ms
18,592 KB
testcase_54 AC 626 ms
65,764 KB
testcase_55 AC 110 ms
15,872 KB
testcase_56 AC 53 ms
9,472 KB
testcase_57 AC 358 ms
36,624 KB
testcase_58 AC 645 ms
62,424 KB
testcase_59 AC 516 ms
50,184 KB
testcase_60 AC 197 ms
21,944 KB
testcase_61 AC 752 ms
67,296 KB
testcase_62 AC 365 ms
38,576 KB
testcase_63 AC 552 ms
51,280 KB
testcase_64 AC 573 ms
59,640 KB
testcase_65 AC 114 ms
15,044 KB
testcase_66 AC 154 ms
18,032 KB
testcase_67 AC 362 ms
38,708 KB
testcase_68 AC 615 ms
64,168 KB
testcase_69 AC 454 ms
49,956 KB
testcase_70 AC 327 ms
37,068 KB
testcase_71 AC 197 ms
24,832 KB
testcase_72 AC 530 ms
58,928 KB
testcase_73 AC 221 ms
27,136 KB
testcase_74 AC 211 ms
25,984 KB
testcase_75 AC 214 ms
26,240 KB
testcase_76 AC 312 ms
36,564 KB
testcase_77 AC 315 ms
36,660 KB
testcase_78 AC 126 ms
17,536 KB
testcase_79 AC 181 ms
22,912 KB
testcase_80 AC 115 ms
16,256 KB
testcase_81 AC 41 ms
9,216 KB
testcase_82 AC 507 ms
55,720 KB
testcase_83 AC 249 ms
29,732 KB
testcase_84 AC 131 ms
18,048 KB
testcase_85 AC 574 ms
62,292 KB
testcase_86 AC 506 ms
56,188 KB
testcase_87 AC 54 ms
10,624 KB
testcase_88 AC 15 ms
6,944 KB
testcase_89 AC 323 ms
34,224 KB
testcase_90 AC 694 ms
68,548 KB
testcase_91 AC 580 ms
52,972 KB
testcase_92 AC 145 ms
18,128 KB
testcase_93 AC 498 ms
48,964 KB
testcase_94 AC 420 ms
46,692 KB
testcase_95 AC 374 ms
36,320 KB
testcase_96 AC 662 ms
67,188 KB
testcase_97 AC 574 ms
58,404 KB
testcase_98 AC 561 ms
58,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p = 10**9+7
M = int(raw_input())
H = map(int,raw_input().split())
lenH = len(H)
fact=[1]
for i in xrange(1,M+1):
	fact+=[i*fact[i-1]%p]
finv=[0]*(M+1)
finv[M]=pow(fact[M],p-2,p)
for i in xrange(M,0,-1):
	finv[i-1]=i*finv[i]%p
rest = M - sum(H) - (lenH - 1)
if H[0] == 0:
	print 1
elif rest < 0:
	print "NA"
else:
	print fact[lenH+rest]*finv[lenH]*finv[rest] % p
0