結果

問題 No.462 6日知らずのコンピュータ
ユーザー one0803
提出日時 2019-08-20 14:26:30
言語 PyPy3
(7.0.0)
結果
AC  
実行時間 119 ms
コード長 561 Byte
コンパイル時間 1,510 ms
使用メモリ 66,644 KB
最終ジャッジ日時 2019-08-20 14:26:42

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
input01.txt AC 91 ms
66,132 KB
input02.txt AC 99 ms
66,132 KB
input03.txt AC 119 ms
66,644 KB
input04.txt AC 96 ms
66,644 KB
input05.txt AC 93 ms
66,132 KB
input06.txt AC 91 ms
66,128 KB
input07.txt AC 91 ms
66,136 KB
input08.txt AC 90 ms
66,132 KB
input09.txt AC 88 ms
66,132 KB
input10.txt AC 91 ms
66,128 KB
input11.txt AC 90 ms
66,128 KB
input12.txt AC 91 ms
66,128 KB
input13.txt AC 89 ms
66,128 KB
input14.txt AC 90 ms
66,136 KB
input15.txt AC 93 ms
66,616 KB
input16.txt AC 105 ms
66,136 KB
input17.txt AC 110 ms
66,136 KB
input18.txt AC 94 ms
66,128 KB
input19.txt AC 90 ms
66,132 KB
input20.txt AC 94 ms
66,128 KB
input21.txt AC 94 ms
66,132 KB
input22.txt AC 98 ms
66,132 KB
input23.txt AC 95 ms
66,128 KB
input24.txt AC 99 ms
66,616 KB
input25.txt AC 95 ms
66,132 KB
input26.txt AC 100 ms
66,636 KB
input27.txt AC 102 ms
66,136 KB
input28.txt AC 108 ms
66,132 KB
input29.txt AC 94 ms
66,128 KB
input30.txt AC 95 ms
66,132 KB
input31.txt AC 95 ms
66,128 KB
input32.txt AC 94 ms
66,212 KB
input33.txt AC 94 ms
66,128 KB
input34.txt AC 95 ms
66,132 KB
input35.txt AC 97 ms
66,124 KB
input36.txt AC 94 ms
66,128 KB
input37.txt AC 92 ms
66,132 KB
input38.txt AC 93 ms
66,236 KB
input39.txt AC 94 ms
66,128 KB
input40.txt AC 105 ms
66,128 KB
input41.txt AC 112 ms
66,128 KB
input42.txt AC 96 ms
66,620 KB
input43.txt AC 92 ms
66,128 KB
input44.txt AC 92 ms
66,136 KB
input45.txt AC 93 ms
66,132 KB
input46.txt AC 92 ms
66,136 KB
input47.txt AC 92 ms
66,132 KB
input48.txt AC 93 ms
66,616 KB
input49.txt AC 99 ms
66,624 KB
input50.txt AC 94 ms
66,184 KB
input51.txt AC 90 ms
66,200 KB
input52.txt AC 91 ms
66,132 KB
input53.txt AC 103 ms
66,128 KB
input54.txt AC 114 ms
66,136 KB
input55.txt AC 90 ms
66,136 KB
input56.txt AC 91 ms
66,132 KB
input57.txt AC 91 ms
66,136 KB
input58.txt AC 92 ms
66,140 KB
input59.txt AC 91 ms
66,140 KB
input60.txt AC 93 ms
66,132 KB
input61.txt AC 91 ms
66,136 KB
input62.txt AC 94 ms
66,136 KB
input63.txt AC 91 ms
66,128 KB
input64.txt AC 89 ms
66,132 KB
input65.txt AC 100 ms
66,136 KB
input66.txt AC 116 ms
66,132 KB
input67.txt AC 94 ms
66,140 KB
input68.txt AC 95 ms
66,136 KB
input69.txt AC 91 ms
66,132 KB
input70.txt AC 93 ms
66,132 KB
input71.txt AC 94 ms
66,140 KB
input72.txt AC 94 ms
66,136 KB
input73.txt AC 92 ms
66,132 KB
input74.txt AC 95 ms
66,136 KB
input75.txt AC 96 ms
66,140 KB
input76.txt AC 92 ms
66,136 KB
input77.txt AC 94 ms
66,136 KB
input78.txt AC 100 ms
66,140 KB
input79.txt AC 112 ms
66,132 KB
NoNumcase1.txt AC 96 ms
66,128 KB
NoNumcase2.txt AC 97 ms
66,136 KB
NoNumcase3.txt AC 92 ms
66,132 KB
NoNumcase4.txt AC 93 ms
66,128 KB
NoNumcase5.txt AC 93 ms
66,136 KB
sample1.txt AC 92 ms
66,132 KB
sample2.txt AC 91 ms
66,128 KB
sample3.txt AC 92 ms
66,128 KB
テストケース一括ダウンロード

ソースコード

diff #
N, k = map(int, input().split())
MOD = 10 ** 9 + 7

fact = [1]

for i in range(1, N+1):
    fact.append(fact[-1] * i % MOD)

if k != 0:
    a = list(map(int, input().split()))
else:
    a = []
    
a.append(2**N - 1)
a.sort()
flag = [0] * N
ans = 1

for ai in a:
    cnt = 0
    b = format(ai, '0'+str(N)+'b')[::-1]

    for i in range(N):
        if b[i] == '1' and flag[i] == 0:
            cnt += 1
            flag[i] = 1
        elif b[i] == '0' and flag[i] == 1:
            print(0)
            exit()
    
    ans *= fact[cnt]
    ans %= MOD

print(ans)
0