結果

問題 No.462 6日知らずのコンピュータ
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-12-17 23:15:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 718 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 75,792 KB
最終ジャッジ日時 2023-08-20 21:59:47
合計ジャッジ時間 9,949 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,232 KB
testcase_01 AC 73 ms
70,888 KB
testcase_02 AC 80 ms
75,500 KB
testcase_03 AC 77 ms
75,396 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 73 ms
71,224 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 79 ms
75,528 KB
testcase_24 WA -
testcase_25 AC 79 ms
75,276 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 72 ms
71,288 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 72 ms
71,136 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 78 ms
75,792 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 78 ms
75,524 KB
testcase_48 WA -
testcase_49 AC 73 ms
71,132 KB
testcase_50 AC 73 ms
71,348 KB
testcase_51 AC 73 ms
71,280 KB
testcase_52 AC 74 ms
71,168 KB
testcase_53 AC 72 ms
70,884 KB
testcase_54 AC 73 ms
71,424 KB
testcase_55 AC 72 ms
71,280 KB
testcase_56 AC 73 ms
71,012 KB
testcase_57 AC 73 ms
71,272 KB
testcase_58 AC 73 ms
71,100 KB
testcase_59 AC 73 ms
71,408 KB
testcase_60 AC 73 ms
71,228 KB
testcase_61 AC 74 ms
71,408 KB
testcase_62 WA -
testcase_63 AC 73 ms
71,272 KB
testcase_64 AC 72 ms
71,136 KB
testcase_65 AC 73 ms
71,256 KB
testcase_66 AC 73 ms
70,888 KB
testcase_67 AC 72 ms
71,016 KB
testcase_68 AC 73 ms
71,172 KB
testcase_69 AC 74 ms
71,108 KB
testcase_70 AC 73 ms
70,888 KB
testcase_71 AC 74 ms
71,020 KB
testcase_72 AC 75 ms
71,132 KB
testcase_73 AC 73 ms
71,140 KB
testcase_74 AC 73 ms
71,020 KB
testcase_75 AC 73 ms
71,396 KB
testcase_76 AC 72 ms
71,388 KB
testcase_77 AC 73 ms
71,124 KB
testcase_78 AC 74 ms
71,360 KB
testcase_79 AC 72 ms
71,116 KB
testcase_80 AC 73 ms
71,408 KB
testcase_81 AC 72 ms
71,228 KB
testcase_82 AC 72 ms
71,248 KB
testcase_83 AC 72 ms
71,412 KB
testcase_84 AC 73 ms
71,276 KB
testcase_85 AC 72 ms
70,988 KB
testcase_86 AC 73 ms
71,228 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