結果
| 問題 |
No.462 6日知らずのコンピュータ
|
| ユーザー |
rlangevin
|
| 提出日時 | 2023-03-02 08:58:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 499 bytes |
| コンパイル時間 | 203 ms |
| コンパイル使用メモリ | 82,264 KB |
| 実行使用メモリ | 67,388 KB |
| 最終ジャッジ日時 | 2024-09-17 05:48:45 |
| 合計ジャッジ時間 | 5,628 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 78 RE * 6 |
ソースコード
def popcount(n):
cnt = 0
while n:
cnt += n & 1
n >>= 1
return cnt
N, K = map(int, input().split())
if K:
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
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
fact[i] %= mod
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])]
ans %= mod
print(ans)
rlangevin