結果

問題 No.462 6日知らずのコンピュータ
ユーザー brthyyjpbrthyyjp
提出日時 2021-12-19 14:30:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 1,670 ms
コンパイル使用メモリ 86,392 KB
実行使用メモリ 76,576 KB
最終ジャッジ日時 2023-10-13 18:45:47
合計ジャッジ時間 12,400 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,404 KB
testcase_01 AC 75 ms
71,400 KB
testcase_02 AC 88 ms
76,312 KB
testcase_03 AC 80 ms
76,456 KB
testcase_04 AC 74 ms
71,068 KB
testcase_05 AC 78 ms
71,084 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 75 ms
71,432 KB
testcase_09 AC 75 ms
71,080 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 77 ms
71,352 KB
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 AC 75 ms
71,112 KB
testcase_23 AC 82 ms
76,544 KB
testcase_24 AC 77 ms
71,428 KB
testcase_25 AC 83 ms
76,364 KB
testcase_26 AC 81 ms
76,192 KB
testcase_27 WA -
testcase_28 AC 75 ms
71,284 KB
testcase_29 AC 76 ms
71,248 KB
testcase_30 AC 77 ms
70,964 KB
testcase_31 AC 76 ms
71,292 KB
testcase_32 WA -
testcase_33 AC 80 ms
76,364 KB
testcase_34 WA -
testcase_35 AC 74 ms
71,156 KB
testcase_36 AC 76 ms
71,216 KB
testcase_37 WA -
testcase_38 AC 76 ms
71,432 KB
testcase_39 WA -
testcase_40 AC 79 ms
76,368 KB
testcase_41 AC 81 ms
76,544 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 79 ms
76,304 KB
testcase_45 AC 75 ms
71,212 KB
testcase_46 AC 80 ms
76,200 KB
testcase_47 AC 80 ms
76,576 KB
testcase_48 WA -
testcase_49 AC 81 ms
71,152 KB
testcase_50 AC 74 ms
70,964 KB
testcase_51 AC 77 ms
71,128 KB
testcase_52 AC 75 ms
71,136 KB
testcase_53 AC 74 ms
71,092 KB
testcase_54 AC 75 ms
71,236 KB
testcase_55 AC 74 ms
71,244 KB
testcase_56 AC 75 ms
71,148 KB
testcase_57 AC 73 ms
71,388 KB
testcase_58 AC 75 ms
71,256 KB
testcase_59 AC 75 ms
71,212 KB
testcase_60 AC 75 ms
71,428 KB
testcase_61 AC 75 ms
71,372 KB
testcase_62 WA -
testcase_63 AC 74 ms
71,076 KB
testcase_64 AC 73 ms
71,004 KB
testcase_65 AC 74 ms
71,212 KB
testcase_66 AC 75 ms
71,148 KB
testcase_67 AC 75 ms
71,304 KB
testcase_68 AC 75 ms
71,260 KB
testcase_69 AC 77 ms
71,316 KB
testcase_70 AC 75 ms
71,080 KB
testcase_71 AC 75 ms
71,092 KB
testcase_72 AC 76 ms
71,332 KB
testcase_73 AC 75 ms
71,260 KB
testcase_74 AC 76 ms
71,388 KB
testcase_75 AC 76 ms
71,244 KB
testcase_76 AC 77 ms
71,088 KB
testcase_77 AC 74 ms
71,212 KB
testcase_78 AC 77 ms
71,324 KB
testcase_79 AC 76 ms
71,340 KB
testcase_80 AC 75 ms
71,168 KB
testcase_81 AC 76 ms
71,348 KB
testcase_82 AC 74 ms
71,332 KB
testcase_83 AC 74 ms
70,960 KB
testcase_84 AC 74 ms
71,096 KB
testcase_85 AC 75 ms
71,084 KB
testcase_86 AC 78 ms
71,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
N = 1000
mod = 10**9+7
fac = [1]*(N+1)
finv = [1]*(N+1)
for i in range(N):
    fac[i+1] = fac[i] * (i+1) % mod

if k == 0:
    ans = 1
    print(fac[n]%mod)
    exit()

A = list(map(int, input().split()))
A.sort()
if k == n+1:
    if A[0] != 0:
        print(0)
        exit()
    if A[-1] != pow(2, n)-1:
        print(0)
        exit()

ans = 1
b = 0
for a in A:
    cnt = 0
    for i in range(65):
        if (a>>i)&1:
            if (b>>i)&1:
                continue
            else:
                cnt += 1
        else:
            if (b>>i)&1:
                print(0)
                exit()
            else:
                continue
    ans *= fac[cnt]
    ans %= mod
    b |= a
print(ans)
0