結果
問題 | No.462 6日知らずのコンピュータ |
ユーザー | uafr_cs |
提出日時 | 2017-11-11 04:17:50 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,009 bytes |
コンパイル時間 | 2,430 ms |
コンパイル使用メモリ | 76,024 KB |
実行使用メモリ | 58,632 KB |
最終ジャッジ日時 | 2023-08-16 06:31:21 |
合計ジャッジ時間 | 15,925 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 134 ms
56,120 KB |
testcase_03 | AC | 131 ms
55,788 KB |
testcase_04 | AC | 123 ms
56,304 KB |
testcase_05 | AC | 120 ms
55,960 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 122 ms
56,160 KB |
testcase_09 | AC | 120 ms
55,872 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 126 ms
56,268 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
56,064 KB |
testcase_23 | AC | 127 ms
55,648 KB |
testcase_24 | AC | 120 ms
56,276 KB |
testcase_25 | AC | 129 ms
55,976 KB |
testcase_26 | AC | 128 ms
56,264 KB |
testcase_27 | WA | - |
testcase_28 | AC | 120 ms
56,224 KB |
testcase_29 | AC | 125 ms
55,628 KB |
testcase_30 | AC | 123 ms
56,096 KB |
testcase_31 | AC | 125 ms
56,076 KB |
testcase_32 | WA | - |
testcase_33 | AC | 125 ms
55,840 KB |
testcase_34 | WA | - |
testcase_35 | AC | 122 ms
56,204 KB |
testcase_36 | AC | 120 ms
55,736 KB |
testcase_37 | WA | - |
testcase_38 | AC | 123 ms
56,052 KB |
testcase_39 | WA | - |
testcase_40 | AC | 127 ms
55,976 KB |
testcase_41 | AC | 130 ms
56,196 KB |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | AC | 122 ms
56,480 KB |
testcase_45 | AC | 117 ms
56,012 KB |
testcase_46 | AC | 124 ms
55,940 KB |
testcase_47 | AC | 128 ms
55,608 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
55,832 KB |
testcase_80 | AC | 117 ms
56,116 KB |
testcase_81 | AC | 119 ms
56,192 KB |
testcase_82 | AC | 119 ms
55,864 KB |
testcase_83 | AC | 120 ms
55,676 KB |
testcase_84 | AC | 119 ms
56,028 KB |
testcase_85 | WA | - |
testcase_86 | AC | 118 ms
56,212 KB |
ソースコード
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); } }