結果

問題 No.462 6日知らずのコンピュータ
ユーザー はむ吉🐹はむ吉🐹
提出日時 2017-01-03 17:07:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 730 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 75,896 KB
最終ジャッジ日時 2023-08-22 10:26:16
合計ジャッジ時間 9,778 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,400 KB
testcase_01 AC 71 ms
71,464 KB
testcase_02 AC 79 ms
75,336 KB
testcase_03 AC 75 ms
75,700 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 70 ms
71,564 KB
testcase_09 WA -
testcase_10 AC 71 ms
71,612 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 78 ms
75,704 KB
testcase_24 WA -
testcase_25 AC 76 ms
75,640 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 69 ms
71,284 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 73 ms
71,060 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 77 ms
75,668 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 79 ms
75,620 KB
testcase_48 WA -
testcase_49 AC 73 ms
71,660 KB
testcase_50 AC 73 ms
71,584 KB
testcase_51 AC 74 ms
71,132 KB
testcase_52 AC 73 ms
71,348 KB
testcase_53 AC 72 ms
71,392 KB
testcase_54 AC 73 ms
71,284 KB
testcase_55 AC 71 ms
71,392 KB
testcase_56 AC 71 ms
71,260 KB
testcase_57 AC 71 ms
71,280 KB
testcase_58 AC 72 ms
71,240 KB
testcase_59 AC 71 ms
71,296 KB
testcase_60 AC 72 ms
71,236 KB
testcase_61 AC 73 ms
71,316 KB
testcase_62 WA -
testcase_63 AC 72 ms
71,264 KB
testcase_64 AC 73 ms
71,656 KB
testcase_65 AC 73 ms
71,436 KB
testcase_66 AC 73 ms
71,328 KB
testcase_67 AC 72 ms
71,532 KB
testcase_68 AC 71 ms
71,368 KB
testcase_69 AC 72 ms
71,388 KB
testcase_70 AC 71 ms
71,332 KB
testcase_71 AC 72 ms
71,136 KB
testcase_72 AC 71 ms
71,404 KB
testcase_73 AC 70 ms
71,104 KB
testcase_74 AC 72 ms
71,532 KB
testcase_75 AC 71 ms
71,316 KB
testcase_76 AC 71 ms
71,520 KB
testcase_77 AC 71 ms
71,132 KB
testcase_78 AC 72 ms
71,328 KB
testcase_79 AC 71 ms
71,148 KB
testcase_80 AC 72 ms
71,332 KB
testcase_81 AC 70 ms
71,348 KB
testcase_82 AC 71 ms
71,580 KB
testcase_83 AC 71 ms
71,536 KB
testcase_84 AC 70 ms
71,312 KB
testcase_85 AC 72 ms
71,332 KB
testcase_86 AC 72 ms
71,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env pypy3
# Ref: #138103

import math


P = 10 ** 9 + 7


def bits(n):
    return {i for i, b in enumerate(reversed("{:b}".format(n))) if b == '1'}


def solve(n, xs, mod=P):
    if not xs:
        return math.factorial(n) % mod
    ys = sorted(xs)
    ans = 1
    for y_i, y_j in zip([0] + ys, ys + [2 ** n - 1]):
        bs_i = bits(y_i)
        bs_j = bits(y_j)
        if bs_i <= bs_j:
            ans = ans * math.factorial(len(bs_j) - len(bs_i)) & mod
        else:
            return 0
    return ans


def main():
    n, k = (int(x) for x in input().split())
    if k == 0:
        xs = []
    else:
        xs = [int(x) for x in input().split()]
    print(solve(n, xs))


if __name__ == '__main__':
    main()
0