結果
| 問題 |
No.462 6日知らずのコンピュータ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-13 01:01:00 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 601 bytes |
| コンパイル時間 | 484 ms |
| コンパイル使用メモリ | 6,784 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2024-11-29 23:53:48 |
| 合計ジャッジ時間 | 3,207 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / 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