結果

問題 No.462 6日知らずのコンピュータ
ユーザー qwegat
提出日時 2023-01-05 13:13:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 405 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,496 KB
実行使用メモリ 59,660 KB
最終ジャッジ日時 2024-11-29 02:44:45
合計ジャッジ時間 6,102 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 53 WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n,k = list(map(int,input().split()))
na = []
ns = 0
nd = 1
df = False
if k > 0:
	a = list(map(int,input().split()))
	a.append(0)
	
	a.sort()

	for i in range(k):
		if (a[i])&(~a[i+1]) > 0:
			df = True
			break
		else:
			d = bin(a[i]^a[i+1]).count("1")
			na.append(d)
			ns += d
			nd *= math.factorial(d)
if df:
	print(0)
elif ns > n:
	print(0)
else:
	nd *= math.factorial(n-ns)
	print(nd)
0