結果
問題 | No.462 6日知らずのコンピュータ |
ユーザー |
![]() |
提出日時 | 2017-03-08 13:22:14 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 478 bytes |
コンパイル時間 | 87 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-23 18:54:09 |
合計ジャッジ時間 | 4,544 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 84 |
ソースコード
N, k = map(int, input().split())B = [0]*Nans = 1mod = 10**9+7if k:A = [int(i) for i in input().split()]if 0 not in A:A.append(0)if 2**N-1 not in A:A.append(2**N-1)A.sort()A = [bin(a)[:1:-1] for a in A]for a in A:n = 0for i, l in enumerate(a):if l == "1" and not B[i]:n += 1ans *= nans %= modB[i] = 1elif l == "0" and B[i]:print(0)exit()print(ans)else:for i in range(N):ans *= i+1ans %= modprint(ans)