結果

問題 No.462 6日知らずのコンピュータ
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-12-17 23:15:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 718 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 62,336 KB
最終ジャッジ日時 2024-05-08 04:14:45
合計ジャッジ時間 6,065 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,940 KB
testcase_01 AC 38 ms
53,536 KB
testcase_02 AC 46 ms
62,336 KB
testcase_03 AC 45 ms
60,224 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 40 ms
53,892 KB
testcase_09 WA -
testcase_10 WA -
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 44 ms
60,148 KB
testcase_24 WA -
testcase_25 AC 46 ms
61,488 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 38 ms
52,948 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 41 ms
57,920 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 46 ms
61,128 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 46 ms
60,848 KB
testcase_48 WA -
testcase_49 AC 39 ms
53,696 KB
testcase_50 AC 42 ms
52,476 KB
testcase_51 AC 39 ms
53,420 KB
testcase_52 AC 39 ms
52,948 KB
testcase_53 AC 40 ms
53,020 KB
testcase_54 AC 38 ms
53,068 KB
testcase_55 AC 39 ms
52,700 KB
testcase_56 AC 38 ms
53,212 KB
testcase_57 AC 37 ms
52,812 KB
testcase_58 AC 37 ms
53,136 KB
testcase_59 AC 36 ms
54,008 KB
testcase_60 AC 38 ms
53,304 KB
testcase_61 AC 39 ms
53,372 KB
testcase_62 WA -
testcase_63 AC 38 ms
53,340 KB
testcase_64 AC 38 ms
52,800 KB
testcase_65 AC 37 ms
53,008 KB
testcase_66 AC 37 ms
52,252 KB
testcase_67 AC 38 ms
53,544 KB
testcase_68 AC 38 ms
52,068 KB
testcase_69 AC 39 ms
52,448 KB
testcase_70 AC 38 ms
52,540 KB
testcase_71 AC 38 ms
52,800 KB
testcase_72 AC 39 ms
52,616 KB
testcase_73 AC 37 ms
52,580 KB
testcase_74 AC 38 ms
52,800 KB
testcase_75 AC 38 ms
53,284 KB
testcase_76 AC 37 ms
52,860 KB
testcase_77 AC 39 ms
53,628 KB
testcase_78 AC 37 ms
53,200 KB
testcase_79 AC 38 ms
52,732 KB
testcase_80 AC 38 ms
54,016 KB
testcase_81 AC 38 ms
52,812 KB
testcase_82 AC 38 ms
53,140 KB
testcase_83 AC 39 ms
52,828 KB
testcase_84 AC 38 ms
53,612 KB
testcase_85 AC 38 ms
52,536 KB
testcase_86 AC 38 ms
53,676 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(ys[:-1], ys[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