結果
| 問題 | No.462 6日知らずのコンピュータ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-13 01:01:00 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 156 ms / 2,000 ms |
| コード長 | 601 bytes |
| 記録 | |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 77,492 KB |
| 最終ジャッジ日時 | 2025-12-03 22:54:00 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 84 |
ソースコード
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# †
from math import factorial as fact
mod = 10**9 + 7
from itertools import tee
# s -> (s0,s1), (s1,s2), (s2,s3), ...
def pairwise(iterable):
a, b = tee(iterable)
next(b, None)
return zip(a, b)
n, k = map(int, raw_input().split())
if k == 0:
res = fact(n) % mod
print res
exit(0)
a = map(int, raw_input().split())
a.append(0)
a.append((1<<n) - 1)
a = sorted(set(a))
res = 1
for p, q in pairwise(a):
if p | q != q:
print 0
exit(0)
cnt = bin(p ^ q).count('1')
res *= fact(cnt)
res %= mod
print res