結果

問題 No.462 6日知らずのコンピュータ
ユーザー roaris
提出日時 2019-08-20 14:26:30
言語 PyPy3
(7.0.0)
結果
AC  
実行時間 244 ms
コード長 561 Byte
コンパイル時間 520 ms
使用メモリ 79,100 KB
最終ジャッジ日時 2020-02-14 22:10:37

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
input01.txt AC 236 ms
78,588 KB
input02.txt AC 228 ms
78,536 KB
input03.txt AC 240 ms
78,984 KB
input04.txt AC 244 ms
78,676 KB
input05.txt AC 220 ms
78,272 KB
input06.txt AC 228 ms
78,472 KB
input07.txt AC 220 ms
78,364 KB
input08.txt AC 224 ms
78,480 KB
input09.txt AC 236 ms
78,628 KB
input10.txt AC 224 ms
78,476 KB
input11.txt AC 224 ms
78,268 KB
input12.txt AC 224 ms
78,356 KB
input13.txt AC 220 ms
78,524 KB
input14.txt AC 216 ms
78,364 KB
input15.txt AC 228 ms
78,664 KB
input16.txt AC 212 ms
78,256 KB
input17.txt AC 220 ms
78,732 KB
input18.txt AC 216 ms
78,268 KB
input19.txt AC 224 ms
78,484 KB
input20.txt AC 228 ms
78,256 KB
input21.txt AC 236 ms
78,260 KB
input22.txt AC 228 ms
78,544 KB
input23.txt AC 240 ms
78,352 KB
input24.txt AC 240 ms
78,648 KB
input25.txt AC 224 ms
78,360 KB
input26.txt AC 240 ms
78,940 KB
input27.txt AC 240 ms
78,364 KB
input28.txt AC 236 ms
78,256 KB
input29.txt AC 232 ms
78,272 KB
input30.txt AC 228 ms
78,532 KB
input31.txt AC 228 ms
78,332 KB
input32.txt AC 240 ms
78,736 KB
input33.txt AC 240 ms
78,444 KB
input34.txt AC 236 ms
78,492 KB
input35.txt AC 236 ms
78,472 KB
input36.txt AC 240 ms
78,436 KB
input37.txt AC 232 ms
78,348 KB
input38.txt AC 236 ms
78,592 KB
input39.txt AC 236 ms
78,436 KB
input40.txt AC 236 ms
78,368 KB
input41.txt AC 224 ms
78,368 KB
input42.txt AC 224 ms
78,876 KB
input43.txt AC 224 ms
78,568 KB
input44.txt AC 224 ms
78,488 KB
input45.txt AC 224 ms
78,364 KB
input46.txt AC 220 ms
78,420 KB
input47.txt AC 224 ms
78,360 KB
input48.txt AC 224 ms
78,604 KB
input49.txt AC 224 ms
79,100 KB
input50.txt AC 224 ms
78,448 KB
input51.txt AC 228 ms
78,428 KB
input52.txt AC 216 ms
78,480 KB
input53.txt AC 228 ms
78,340 KB
input54.txt AC 236 ms
78,444 KB
input55.txt AC 236 ms
78,440 KB
input56.txt AC 236 ms
78,252 KB
input57.txt AC 228 ms
78,476 KB
input58.txt AC 240 ms
78,476 KB
input59.txt AC 236 ms
78,624 KB
input60.txt AC 244 ms
78,448 KB
input61.txt AC 236 ms
78,472 KB
input62.txt AC 236 ms
78,440 KB
input63.txt AC 236 ms
78,476 KB
input64.txt AC 240 ms
78,484 KB
input65.txt AC 236 ms
78,736 KB
input66.txt AC 224 ms
78,252 KB
input67.txt AC 224 ms
78,444 KB
input68.txt AC 216 ms
78,480 KB
input69.txt AC 216 ms
78,476 KB
input70.txt AC 224 ms
78,680 KB
input71.txt AC 224 ms
78,364 KB
input72.txt AC 212 ms
78,728 KB
input73.txt AC 212 ms
78,600 KB
input74.txt AC 224 ms
78,472 KB
input75.txt AC 236 ms
78,372 KB
input76.txt AC 240 ms
78,736 KB
input77.txt AC 228 ms
78,548 KB
input78.txt AC 236 ms
78,348 KB
input79.txt AC 236 ms
78,628 KB
NoNumcase1.txt AC 236 ms
78,336 KB
NoNumcase2.txt AC 236 ms
78,364 KB
NoNumcase3.txt AC 236 ms
78,584 KB
NoNumcase4.txt AC 244 ms
78,596 KB
NoNumcase5.txt AC 244 ms
78,596 KB
sample1.txt AC 240 ms
78,428 KB
sample2.txt AC 240 ms
78,592 KB
sample3.txt AC 240 ms
78,364 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