結果

問題 No.462 6日知らずのコンピュータ
ユーザー uafr_csuafr_cs
提出日時 2017-11-11 04:08:03
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 927 bytes
コンパイル時間 2,336 ms
コンパイル使用メモリ 74,336 KB
実行使用メモリ 57,816 KB
最終ジャッジ日時 2023-08-16 06:30:22
合計ジャッジ時間 17,542 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,996 KB
testcase_01 AC 120 ms
55,696 KB
testcase_02 AC 130 ms
55,760 KB
testcase_03 AC 130 ms
55,628 KB
testcase_04 AC 120 ms
53,972 KB
testcase_05 AC 120 ms
55,968 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 118 ms
55,684 KB
testcase_09 AC 121 ms
55,612 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 124 ms
55,988 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
55,824 KB
testcase_23 AC 127 ms
55,744 KB
testcase_24 AC 119 ms
55,988 KB
testcase_25 AC 126 ms
56,224 KB
testcase_26 AC 121 ms
55,808 KB
testcase_27 WA -
testcase_28 AC 118 ms
55,804 KB
testcase_29 AC 125 ms
55,916 KB
testcase_30 AC 117 ms
55,848 KB
testcase_31 AC 118 ms
55,832 KB
testcase_32 WA -
testcase_33 AC 118 ms
53,764 KB
testcase_34 WA -
testcase_35 AC 116 ms
55,840 KB
testcase_36 AC 122 ms
55,800 KB
testcase_37 WA -
testcase_38 AC 121 ms
57,496 KB
testcase_39 WA -
testcase_40 AC 123 ms
55,544 KB
testcase_41 AC 125 ms
55,964 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 125 ms
55,852 KB
testcase_45 AC 120 ms
56,656 KB
testcase_46 AC 125 ms
55,756 KB
testcase_47 AC 128 ms
55,752 KB
testcase_48 WA -
testcase_49 AC 121 ms
55,524 KB
testcase_50 AC 128 ms
55,976 KB
testcase_51 AC 121 ms
55,820 KB
testcase_52 AC 128 ms
55,952 KB
testcase_53 AC 121 ms
55,828 KB
testcase_54 AC 118 ms
55,836 KB
testcase_55 AC 121 ms
55,892 KB
testcase_56 AC 124 ms
55,828 KB
testcase_57 AC 129 ms
55,848 KB
testcase_58 AC 125 ms
55,900 KB
testcase_59 AC 124 ms
55,968 KB
testcase_60 AC 126 ms
55,992 KB
testcase_61 AC 119 ms
55,664 KB
testcase_62 WA -
testcase_63 AC 126 ms
55,828 KB
testcase_64 AC 124 ms
55,904 KB
testcase_65 AC 124 ms
55,696 KB
testcase_66 AC 127 ms
55,972 KB
testcase_67 AC 129 ms
55,828 KB
testcase_68 AC 125 ms
55,852 KB
testcase_69 AC 126 ms
53,764 KB
testcase_70 AC 123 ms
55,572 KB
testcase_71 AC 124 ms
55,992 KB
testcase_72 AC 121 ms
55,816 KB
testcase_73 AC 123 ms
55,880 KB
testcase_74 AC 118 ms
55,856 KB
testcase_75 AC 126 ms
55,664 KB
testcase_76 AC 121 ms
55,608 KB
testcase_77 AC 125 ms
56,228 KB
testcase_78 AC 126 ms
55,688 KB
testcase_79 AC 116 ms
55,540 KB
testcase_80 AC 118 ms
55,540 KB
testcase_81 AC 118 ms
55,884 KB
testcase_82 AC 117 ms
55,924 KB
testcase_83 AC 116 ms
55,904 KB
testcase_84 AC 120 ms
55,600 KB
testcase_85 AC 118 ms
55,964 KB
testcase_86 AC 118 ms
53,520 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();
		
		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++){
			long xor = as[i] ^ as[i - 1];
			answer *= fact(Long.bitCount(xor));
			answer %= MOD;
		}
		
		System.out.println(answer);
		
	}
}
0