結果

問題 No.462 6日知らずのコンピュータ
ユーザー fal_rndfal_rnd
提出日時 2016-12-13 22:57:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 955 bytes
コンパイル時間 1,949 ms
コンパイル使用メモリ 77,580 KB
実行使用メモリ 41,756 KB
最終ジャッジ日時 2024-05-07 10:00:23
合計ジャッジ時間 14,236 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
41,516 KB
testcase_01 AC 116 ms
41,096 KB
testcase_02 AC 126 ms
40,976 KB
testcase_03 AC 129 ms
41,196 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 113 ms
40,056 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 107 ms
40,348 KB
testcase_10 AC 122 ms
41,756 KB
testcase_11 AC 109 ms
39,960 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 118 ms
41,648 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 146 ms
41,388 KB
testcase_24 AC 113 ms
41,236 KB
testcase_25 AC 123 ms
41,120 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 105 ms
39,616 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 120 ms
40,952 KB
testcase_34 WA -
testcase_35 AC 116 ms
41,136 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 111 ms
39,920 KB
testcase_39 WA -
testcase_40 AC 114 ms
40,076 KB
testcase_41 AC 124 ms
41,376 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 130 ms
41,084 KB
testcase_45 AC 121 ms
41,484 KB
testcase_46 WA -
testcase_47 AC 126 ms
41,108 KB
testcase_48 WA -
testcase_49 AC 114 ms
40,988 KB
testcase_50 AC 117 ms
41,460 KB
testcase_51 AC 122 ms
41,636 KB
testcase_52 AC 134 ms
41,328 KB
testcase_53 AC 120 ms
41,172 KB
testcase_54 AC 104 ms
40,052 KB
testcase_55 AC 106 ms
40,052 KB
testcase_56 AC 108 ms
40,248 KB
testcase_57 AC 122 ms
41,108 KB
testcase_58 AC 120 ms
41,396 KB
testcase_59 AC 126 ms
41,276 KB
testcase_60 AC 119 ms
41,208 KB
testcase_61 AC 101 ms
40,232 KB
testcase_62 AC 114 ms
41,252 KB
testcase_63 AC 122 ms
41,092 KB
testcase_64 AC 107 ms
39,832 KB
testcase_65 AC 119 ms
41,496 KB
testcase_66 AC 120 ms
41,488 KB
testcase_67 AC 125 ms
40,420 KB
testcase_68 AC 121 ms
41,388 KB
testcase_69 AC 119 ms
41,144 KB
testcase_70 AC 124 ms
41,300 KB
testcase_71 AC 129 ms
41,624 KB
testcase_72 AC 119 ms
41,396 KB
testcase_73 AC 111 ms
40,072 KB
testcase_74 AC 111 ms
39,996 KB
testcase_75 AC 129 ms
41,164 KB
testcase_76 AC 117 ms
40,836 KB
testcase_77 AC 121 ms
41,144 KB
testcase_78 AC 120 ms
40,976 KB
testcase_79 AC 110 ms
40,240 KB
testcase_80 AC 117 ms
41,216 KB
testcase_81 AC 120 ms
40,940 KB
testcase_82 WA -
testcase_83 WA -
testcase_84 AC 106 ms
40,076 KB
testcase_85 AC 117 ms
41,432 KB
testcase_86 AC 110 ms
41,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package src;

import java.math.BigInteger;
import java.util.*;
class B{
	static Scanner s = new Scanner(System.in);
	static final int mod=1000000007;
	public static void main(String[] args){
		int n=s.nextInt();
		BigInteger[] in = new BigInteger[s.nextInt()];
		for(int i=0;i<in.length;i++)
			in[i]=s.nextBigInteger();
		Arrays.sort(in);
		{
			BigInteger b = BigInteger.ZERO;
			for(BigInteger bb:in) {
				b=b.or(bb);
				if(b.xor(bb).getLowestSetBit()!=-1) {
					System.out.println(0);
					return;
				}
			}
		}
		{
			int r=1;
			int b=0;
			for(BigInteger bb:in) {
				r*=getFactorial(bb.bitCount()-b, mod);
				b=bb.bitCount();
			}
			r*=getFactorial(n-b,mod);
			System.out.println(r);
		}
	}
	static int getFactorial(long value,int mod) {
		if(value==0||value==1)
			return 1;
		if(value==2)
			return 2;
		return g(value,value-1,mod);
	}
	static int g(long v,long i,int m) {
		if(i==2)
			return (int) ((v*2)%m);
		return g(v*i,i-1,m);
	}
}
0