結果

問題 No.462 6日知らずのコンピュータ
ユーザー taba
提出日時 2017-04-03 12:30:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-08 03:16:38
合計ジャッジ時間 4,787 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
n,k=map(int,input().split())
b=lambda x:sum(i=="1" for i in bin(x))
if k<1:
	a=[]
else:
	a=sorted(map(int,input().split()))
f=0
c=1
for i in a:
	if i&f!=f:
		print(0)
		exit()
	t=b(i^f)
	c*=math.factorial(t)
	f=i
t=n-b(f)
c*=math.factorial(t)
print(c%(10**9+7))
0