結果

問題 No.462 6日知らずのコンピュータ
ユーザー yuppe19 😺
提出日時 2016-12-13 00:19:52
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 453 bytes
コンパイル時間 595 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-29 18:51:51
合計ジャッジ時間 3,526 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 WA * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python2
# -*- coding: utf-8 -*-
# †
from math import factorial as fact

mod = 10**9 + 7

n, k = map(int, raw_input().split())
if k == 0:
    res = fact(n) % mod
    print res
    exit(0)
a = sorted(map(int, raw_input().split()))
val = a[0]
xor = a[0]
for i in xrange(1, k):
    val |= a[i]
    xor ^= a[i]
    if val != a[i]:
        print 0
        exit(0)

bit = bin(xor)[2:].zfill(n)
cnt = bit.count('0')
res = fact(cnt) % mod
print res
0