結果
問題 |
No.462 6日知らずのコンピュータ
|
ユーザー |
![]() |
提出日時 | 2020-02-04 13:18:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 617 bytes |
コンパイル時間 | 87 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-09-21 07:19:24 |
合計ジャッジ時間 | 5,234 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 84 |
ソースコード
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,K,*A = map(int,read().split()) MOD = 10**9 + 7 fact = [1] * 100 for n in range(1,100): fact[n] = fact[n-1] * n % MOD def popcount(N): ret = 0 while N: if N & 1: ret += 1 N //= 2 return ret def solve(A): full = (1<<N) - 1 A = [0] + sorted(A) + [full] A.append(full) ret = 1 for x,y in zip(A,A[1:]): if x & y != x: return 0 p = popcount(x ^ y) ret *= fact[p] return ret % MOD print(solve(A))