結果

問題 No.462 6日知らずのコンピュータ
ユーザー htensaihtensai
提出日時 2019-12-12 20:19:50
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 2,924 ms
コンパイル使用メモリ 74,196 KB
実行使用メモリ 58,412 KB
最終ジャッジ日時 2023-09-07 20:44:16
合計ジャッジ時間 16,928 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,764 KB
testcase_01 AC 123 ms
56,076 KB
testcase_02 AC 135 ms
55,608 KB
testcase_03 AC 133 ms
56,068 KB
testcase_04 AC 125 ms
55,592 KB
testcase_05 AC 123 ms
56,084 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 116 ms
55,680 KB
testcase_09 AC 118 ms
56,376 KB
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 123 ms
56,224 KB
testcase_24 WA -
testcase_25 AC 127 ms
55,936 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 119 ms
56,244 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 121 ms
53,908 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 126 ms
56,052 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 126 ms
56,148 KB
testcase_46 WA -
testcase_47 AC 133 ms
55,748 KB
testcase_48 WA -
testcase_49 AC 125 ms
56,076 KB
testcase_50 AC 126 ms
56,256 KB
testcase_51 AC 123 ms
56,272 KB
testcase_52 AC 124 ms
55,924 KB
testcase_53 AC 120 ms
53,612 KB
testcase_54 AC 119 ms
56,036 KB
testcase_55 AC 122 ms
55,608 KB
testcase_56 AC 125 ms
56,380 KB
testcase_57 AC 129 ms
56,112 KB
testcase_58 AC 120 ms
56,196 KB
testcase_59 AC 122 ms
56,272 KB
testcase_60 AC 123 ms
55,596 KB
testcase_61 AC 118 ms
56,044 KB
testcase_62 WA -
testcase_63 AC 122 ms
56,044 KB
testcase_64 AC 118 ms
56,184 KB
testcase_65 AC 118 ms
56,556 KB
testcase_66 AC 120 ms
56,112 KB
testcase_67 AC 124 ms
55,944 KB
testcase_68 AC 122 ms
56,356 KB
testcase_69 AC 122 ms
56,116 KB
testcase_70 AC 119 ms
56,308 KB
testcase_71 AC 123 ms
55,900 KB
testcase_72 AC 119 ms
56,132 KB
testcase_73 AC 118 ms
56,224 KB
testcase_74 AC 118 ms
56,328 KB
testcase_75 AC 126 ms
55,908 KB
testcase_76 AC 120 ms
56,128 KB
testcase_77 AC 121 ms
55,932 KB
testcase_78 AC 127 ms
56,224 KB
testcase_79 AC 118 ms
55,972 KB
testcase_80 AC 117 ms
54,264 KB
testcase_81 AC 120 ms
55,904 KB
testcase_82 AC 123 ms
56,036 KB
testcase_83 AC 118 ms
56,200 KB
testcase_84 AC 119 ms
55,804 KB
testcase_85 AC 119 ms
56,400 KB
testcase_86 AC 119 ms
56,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long[] arr = new long[k];
        for (int i = 0; i < k; i++) {
            arr[i] = sc.nextLong();
        }
        Arrays.sort(arr);
        for (int i = 0; i < k - 1; i++) {
            if ((arr[i] & arr[i + 1]) != arr[i]) {
                System.out.println(0);
                return;
            }
        }
        if (k > 0 && arr[k - 1] == (long)(Math.pow(2, n)) - 1) {
            k--;
        }
        if (k > 0 && arr[0] == 0) {
            k--;
        }
        System.out.println(kaijo(n - k));
    }
    
    static long kaijo(long x) {
        long ret = 1;
        int mod = 1000000007;
        for (long i = 1; i <= x; i++) {
            ret *= i;
            ret %= mod;
        }
        return ret;
    }
}
0