結果

問題 No.462 6日知らずのコンピュータ
ユーザー uafr_csuafr_cs
提出日時 2017-11-11 04:17:50
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,009 bytes
コンパイル時間 1,994 ms
コンパイル使用メモリ 77,568 KB
実行使用メモリ 56,144 KB
最終ジャッジ日時 2024-05-03 15:36:19
合計ジャッジ時間 13,891 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 123 ms
54,212 KB
testcase_03 AC 122 ms
54,244 KB
testcase_04 AC 119 ms
54,348 KB
testcase_05 AC 118 ms
54,356 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 101 ms
53,088 KB
testcase_09 AC 103 ms
53,088 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 126 ms
54,004 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 122 ms
54,316 KB
testcase_23 AC 122 ms
53,944 KB
testcase_24 AC 118 ms
54,020 KB
testcase_25 AC 122 ms
53,856 KB
testcase_26 AC 119 ms
54,064 KB
testcase_27 WA -
testcase_28 AC 103 ms
53,128 KB
testcase_29 AC 106 ms
52,780 KB
testcase_30 AC 120 ms
53,980 KB
testcase_31 AC 119 ms
53,896 KB
testcase_32 WA -
testcase_33 AC 115 ms
53,784 KB
testcase_34 WA -
testcase_35 AC 111 ms
53,748 KB
testcase_36 AC 100 ms
52,608 KB
testcase_37 WA -
testcase_38 AC 127 ms
53,808 KB
testcase_39 WA -
testcase_40 AC 123 ms
54,204 KB
testcase_41 AC 121 ms
54,268 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 120 ms
54,292 KB
testcase_45 AC 104 ms
52,724 KB
testcase_46 AC 121 ms
54,352 KB
testcase_47 AC 119 ms
54,124 KB
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 AC 117 ms
54,280 KB
testcase_80 AC 103 ms
53,028 KB
testcase_81 AC 117 ms
54,016 KB
testcase_82 AC 112 ms
54,188 KB
testcase_83 AC 112 ms
53,988 KB
testcase_84 AC 118 ms
54,152 KB
testcase_85 WA -
testcase_86 AC 144 ms
53,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static long MOD = 1000000007;
	
	public static long fact(long N){
		long ret = 1;
		for(long i = 1; i <= N; i++){ 
			ret *= i;
			ret %= MOD;
		}
		return ret;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		final int k = sc.nextInt();
		
		// k = 0 の時は N bit なので N! 個の立て方がある 
		if(k == 0){
			System.out.println(fact(N));
			return;
		}
		
		//
		
		long[] as = new long[k];
		for(int i = 0; i < k; i++){
			as[i] = sc.nextLong();
		}
		Arrays.sort(as);
		
		for(int i = 1; i < k; i++){
			if((as[i] & as[i - 1]) != as[i - 1]){
				//System.out.println(0);
				return;
			}
		}
		
		long answer = fact(Long.bitCount(as[0]));
		for(int i = 1; i < k; i++){
			final long xor = as[i] ^ as[i - 1];
			answer *= fact(Long.bitCount(xor));
			answer %= MOD;
		}
		
		System.out.println(answer);
		
	}
}
0