結果

問題 No.389 ロジックパズルの組み合わせ
ユーザー tjaketjake
提出日時 2016-07-08 22:49:06
言語 Python2
(2.7.18)
結果
AC  
実行時間 316 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 6,644 KB
実行使用メモリ 45,336 KB
最終ジャッジ日時 2023-08-03 08:43:12
合計ジャッジ時間 11,785 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
5,944 KB
testcase_01 AC 12 ms
6,024 KB
testcase_02 AC 12 ms
6,048 KB
testcase_03 AC 12 ms
5,956 KB
testcase_04 AC 177 ms
31,616 KB
testcase_05 AC 13 ms
6,036 KB
testcase_06 AC 12 ms
6,052 KB
testcase_07 AC 13 ms
6,172 KB
testcase_08 AC 12 ms
6,024 KB
testcase_09 AC 220 ms
37,464 KB
testcase_10 AC 53 ms
10,748 KB
testcase_11 AC 231 ms
37,836 KB
testcase_12 AC 38 ms
8,580 KB
testcase_13 AC 313 ms
45,028 KB
testcase_14 AC 69 ms
11,560 KB
testcase_15 AC 52 ms
11,304 KB
testcase_16 AC 108 ms
19,736 KB
testcase_17 AC 167 ms
27,896 KB
testcase_18 AC 282 ms
33,124 KB
testcase_19 AC 12 ms
5,984 KB
testcase_20 AC 12 ms
6,100 KB
testcase_21 AC 12 ms
6,024 KB
testcase_22 AC 12 ms
6,140 KB
testcase_23 AC 12 ms
6,096 KB
testcase_24 AC 12 ms
6,148 KB
testcase_25 AC 12 ms
5,980 KB
testcase_26 AC 12 ms
6,064 KB
testcase_27 AC 12 ms
6,156 KB
testcase_28 AC 11 ms
6,112 KB
testcase_29 AC 12 ms
6,092 KB
testcase_30 AC 12 ms
6,004 KB
testcase_31 AC 12 ms
6,040 KB
testcase_32 AC 12 ms
5,964 KB
testcase_33 AC 12 ms
6,040 KB
testcase_34 AC 12 ms
5,980 KB
testcase_35 AC 12 ms
6,156 KB
testcase_36 AC 12 ms
6,024 KB
testcase_37 AC 12 ms
5,972 KB
testcase_38 AC 12 ms
6,108 KB
testcase_39 AC 12 ms
6,128 KB
testcase_40 AC 11 ms
6,040 KB
testcase_41 AC 12 ms
5,960 KB
testcase_42 AC 12 ms
6,112 KB
testcase_43 AC 11 ms
6,176 KB
testcase_44 AC 12 ms
6,060 KB
testcase_45 AC 11 ms
6,108 KB
testcase_46 AC 12 ms
6,080 KB
testcase_47 AC 12 ms
5,948 KB
testcase_48 AC 12 ms
6,060 KB
testcase_49 AC 134 ms
11,072 KB
testcase_50 AC 19 ms
6,876 KB
testcase_51 AC 18 ms
6,116 KB
testcase_52 AC 34 ms
9,048 KB
testcase_53 AC 23 ms
6,476 KB
testcase_54 AC 40 ms
9,660 KB
testcase_55 AC 13 ms
6,172 KB
testcase_56 AC 21 ms
6,296 KB
testcase_57 AC 63 ms
8,152 KB
testcase_58 AC 111 ms
10,312 KB
testcase_59 AC 88 ms
9,292 KB
testcase_60 AC 46 ms
7,320 KB
testcase_61 AC 176 ms
13,044 KB
testcase_62 AC 48 ms
7,600 KB
testcase_63 AC 116 ms
10,404 KB
testcase_64 AC 39 ms
9,532 KB
testcase_65 AC 28 ms
6,692 KB
testcase_66 AC 42 ms
7,332 KB
testcase_67 AC 41 ms
7,712 KB
testcase_68 AC 40 ms
9,876 KB
testcase_69 AC 190 ms
33,068 KB
testcase_70 AC 135 ms
25,144 KB
testcase_71 AC 87 ms
17,328 KB
testcase_72 AC 216 ms
38,472 KB
testcase_73 AC 95 ms
18,872 KB
testcase_74 AC 90 ms
18,088 KB
testcase_75 AC 91 ms
18,380 KB
testcase_76 AC 131 ms
24,624 KB
testcase_77 AC 130 ms
24,956 KB
testcase_78 AC 56 ms
12,884 KB
testcase_79 AC 80 ms
15,968 KB
testcase_80 AC 53 ms
12,112 KB
testcase_81 AC 23 ms
7,612 KB
testcase_82 AC 205 ms
36,700 KB
testcase_83 AC 105 ms
20,580 KB
testcase_84 AC 60 ms
13,108 KB
testcase_85 AC 232 ms
40,864 KB
testcase_86 AC 209 ms
37,160 KB
testcase_87 AC 29 ms
8,316 KB
testcase_88 AC 14 ms
6,280 KB
testcase_89 AC 159 ms
23,560 KB
testcase_90 AC 316 ms
45,336 KB
testcase_91 AC 304 ms
36,028 KB
testcase_92 AC 74 ms
13,324 KB
testcase_93 AC 247 ms
33,052 KB
testcase_94 AC 171 ms
31,156 KB
testcase_95 AC 203 ms
25,280 KB
testcase_96 AC 306 ms
44,336 KB
testcase_97 AC 266 ms
38,732 KB
testcase_98 AC 242 ms
38,756 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