結果

問題 No.462 6日知らずのコンピュータ
ユーザー compass19
提出日時 2016-12-13 00:41:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-29 23:34:12
合計ジャッジ時間 5,097 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache
@lru_cache(maxsize=None)
def power(n):
	if n <= 1: return 1
	else: return power(n-1)*n


n, k = map(int, input().split())
if k == 0:
	print(power(n)); exit()
a_list = list(map(int, input().split()))
list_of_list = list()
for m in a_list:
	tmp = list(map(int, bin(m)[2:]))
	tmp += [0]*(n-len(tmp))
	list_of_list.append(tmp)

list_of_list = sorted(list_of_list, key=lambda x: x.count(1))
list_of_list.append([1]*n)
num_power = 1
source = [0]*n
for _list in list_of_list:
	count = 0
	for i, j in zip(source, _list):
		if j-i < 0: print(0); exit()
		elif j-i == 1: count += 1
	source = _list
	num_power *= power(count)
print(num_power)
0