結果

問題 No.389 ロジックパズルの組み合わせ
ユーザー tjaketjake
提出日時 2016-07-08 22:49:06
言語 Python2
(2.7.18)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 45,668 KB
最終ジャッジ日時 2024-04-21 07:29:32
合計ジャッジ時間 10,013 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,400 KB
testcase_01 AC 10 ms
6,400 KB
testcase_02 AC 11 ms
6,400 KB
testcase_03 AC 9 ms
6,400 KB
testcase_04 AC 172 ms
32,256 KB
testcase_05 AC 12 ms
6,400 KB
testcase_06 AC 10 ms
6,400 KB
testcase_07 AC 10 ms
6,400 KB
testcase_08 AC 9 ms
6,400 KB
testcase_09 AC 232 ms
37,820 KB
testcase_10 AC 50 ms
11,380 KB
testcase_11 AC 239 ms
38,236 KB
testcase_12 AC 34 ms
8,928 KB
testcase_13 AC 310 ms
45,456 KB
testcase_14 AC 60 ms
11,860 KB
testcase_15 AC 47 ms
11,648 KB
testcase_16 AC 104 ms
20,224 KB
testcase_17 AC 170 ms
28,444 KB
testcase_18 AC 278 ms
33,556 KB
testcase_19 AC 11 ms
6,400 KB
testcase_20 AC 10 ms
6,400 KB
testcase_21 AC 11 ms
6,272 KB
testcase_22 AC 10 ms
6,272 KB
testcase_23 AC 9 ms
6,400 KB
testcase_24 AC 10 ms
6,400 KB
testcase_25 AC 9 ms
6,400 KB
testcase_26 AC 9 ms
6,272 KB
testcase_27 AC 10 ms
6,272 KB
testcase_28 AC 9 ms
6,144 KB
testcase_29 AC 10 ms
6,400 KB
testcase_30 AC 10 ms
6,400 KB
testcase_31 AC 10 ms
6,272 KB
testcase_32 AC 10 ms
6,400 KB
testcase_33 AC 10 ms
6,400 KB
testcase_34 AC 10 ms
6,400 KB
testcase_35 AC 10 ms
6,400 KB
testcase_36 AC 10 ms
6,272 KB
testcase_37 AC 10 ms
6,400 KB
testcase_38 AC 10 ms
6,272 KB
testcase_39 AC 9 ms
6,400 KB
testcase_40 AC 10 ms
6,400 KB
testcase_41 AC 10 ms
6,400 KB
testcase_42 AC 10 ms
6,272 KB
testcase_43 AC 10 ms
6,400 KB
testcase_44 AC 10 ms
6,400 KB
testcase_45 AC 10 ms
6,400 KB
testcase_46 AC 10 ms
6,400 KB
testcase_47 AC 11 ms
6,144 KB
testcase_48 AC 11 ms
6,272 KB
testcase_49 AC 122 ms
11,588 KB
testcase_50 AC 17 ms
7,168 KB
testcase_51 AC 16 ms
6,528 KB
testcase_52 AC 31 ms
9,600 KB
testcase_53 AC 20 ms
7,040 KB
testcase_54 AC 37 ms
10,112 KB
testcase_55 AC 12 ms
6,528 KB
testcase_56 AC 19 ms
6,656 KB
testcase_57 AC 60 ms
8,668 KB
testcase_58 AC 104 ms
10,728 KB
testcase_59 AC 80 ms
9,584 KB
testcase_60 AC 45 ms
7,920 KB
testcase_61 AC 167 ms
13,504 KB
testcase_62 AC 44 ms
7,936 KB
testcase_63 AC 109 ms
10,928 KB
testcase_64 AC 35 ms
9,984 KB
testcase_65 AC 26 ms
7,040 KB
testcase_66 AC 37 ms
7,808 KB
testcase_67 AC 36 ms
8,064 KB
testcase_68 AC 40 ms
10,368 KB
testcase_69 AC 194 ms
33,536 KB
testcase_70 AC 133 ms
25,808 KB
testcase_71 AC 83 ms
17,920 KB
testcase_72 AC 225 ms
39,040 KB
testcase_73 AC 93 ms
19,456 KB
testcase_74 AC 88 ms
18,560 KB
testcase_75 AC 92 ms
18,816 KB
testcase_76 AC 138 ms
25,216 KB
testcase_77 AC 132 ms
25,216 KB
testcase_78 AC 52 ms
13,312 KB
testcase_79 AC 75 ms
16,640 KB
testcase_80 AC 51 ms
12,544 KB
testcase_81 AC 21 ms
8,064 KB
testcase_82 AC 207 ms
36,976 KB
testcase_83 AC 107 ms
20,992 KB
testcase_84 AC 58 ms
13,568 KB
testcase_85 AC 242 ms
41,252 KB
testcase_86 AC 225 ms
37,616 KB
testcase_87 AC 29 ms
9,088 KB
testcase_88 AC 12 ms
6,528 KB
testcase_89 AC 163 ms
23,916 KB
testcase_90 AC 337 ms
45,668 KB
testcase_91 AC 301 ms
36,568 KB
testcase_92 AC 71 ms
13,832 KB
testcase_93 AC 251 ms
33,376 KB
testcase_94 AC 181 ms
31,744 KB
testcase_95 AC 198 ms
25,568 KB
testcase_96 AC 319 ms
44,864 KB
testcase_97 AC 269 ms
39,152 KB
testcase_98 AC 250 ms
39,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9 + 7
m = input()
H = map(int, raw_input().split())
if H[0] == 0:
    print 1
else:
    cnt = m - (sum(H) + len(H)-1) + len(H)
    if cnt < len(H):
        print "NA"
        exit(0)
    fact = [1]*(m+1)
    rev = [1]*(m+1)
    for i in xrange(1, m+1):
        fact[i] = (fact[i-1]*i) % MOD
    print (fact[cnt]*pow(fact[len(H)], MOD-2, MOD)*pow(fact[cnt-len(H)], MOD-2, MOD)) % MOD
0