結果

問題 No.462 6日知らずのコンピュータ
ユーザー rlangevin
提出日時 2023-03-02 08:56:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 66,220 KB
最終ジャッジ日時 2024-09-17 05:46:56
合計ジャッジ時間 6,128 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 51 WA * 27 RE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

def popcount(n):
    cnt = 0
    while n:
        cnt += n & 1
        n >>= 1
    return cnt

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.append((1 << N) - 1)
A.append(0)
A.sort()

M = 65
fact = [1] * M
for i in range(1, M):
    fact[i] = fact[i - 1] * i

ans = 1
for i in range(K + 1):
    if A[i] | A[i + 1] != A[i + 1]:
        print(0)
        exit()
    ans *= fact[popcount(A[i] ^ A[i + 1])]

print(ans)
0