結果
問題 | No.462 6日知らずのコンピュータ |
ユーザー | tenten |
提出日時 | 2021-11-02 10:40:01 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,866 bytes |
コンパイル時間 | 2,225 ms |
コンパイル使用メモリ | 77,496 KB |
実行使用メモリ | 37,096 KB |
最終ジャッジ日時 | 2024-10-11 08:54:02 |
合計ジャッジ時間 | 9,060 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
36,808 KB |
testcase_01 | AC | 52 ms
36,556 KB |
testcase_02 | AC | 51 ms
36,868 KB |
testcase_03 | AC | 51 ms
36,520 KB |
testcase_04 | AC | 50 ms
36,884 KB |
testcase_05 | AC | 51 ms
36,852 KB |
testcase_06 | WA | - |
testcase_07 | AC | 50 ms
36,524 KB |
testcase_08 | AC | 50 ms
36,732 KB |
testcase_09 | AC | 51 ms
36,964 KB |
testcase_10 | AC | 49 ms
36,492 KB |
testcase_11 | AC | 50 ms
36,852 KB |
testcase_12 | AC | 52 ms
36,860 KB |
testcase_13 | AC | 50 ms
36,860 KB |
testcase_14 | AC | 50 ms
36,816 KB |
testcase_15 | AC | 51 ms
36,944 KB |
testcase_16 | AC | 53 ms
36,912 KB |
testcase_17 | AC | 50 ms
36,852 KB |
testcase_18 | AC | 51 ms
36,540 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 52 ms
37,092 KB |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | AC | 51 ms
36,952 KB |
testcase_50 | AC | 51 ms
37,000 KB |
testcase_51 | AC | 51 ms
36,940 KB |
testcase_52 | AC | 51 ms
36,892 KB |
testcase_53 | AC | 50 ms
37,040 KB |
testcase_54 | AC | 48 ms
36,732 KB |
testcase_55 | AC | 50 ms
36,944 KB |
testcase_56 | AC | 51 ms
36,932 KB |
testcase_57 | AC | 49 ms
36,572 KB |
testcase_58 | AC | 49 ms
36,680 KB |
testcase_59 | AC | 53 ms
36,924 KB |
testcase_60 | AC | 50 ms
36,716 KB |
testcase_61 | AC | 52 ms
37,032 KB |
testcase_62 | AC | 49 ms
36,728 KB |
testcase_63 | AC | 50 ms
36,584 KB |
testcase_64 | AC | 49 ms
36,832 KB |
testcase_65 | AC | 49 ms
36,552 KB |
testcase_66 | AC | 52 ms
36,824 KB |
testcase_67 | AC | 51 ms
36,528 KB |
testcase_68 | AC | 50 ms
36,820 KB |
testcase_69 | AC | 50 ms
37,044 KB |
testcase_70 | AC | 50 ms
36,536 KB |
testcase_71 | AC | 54 ms
36,884 KB |
testcase_72 | AC | 53 ms
36,796 KB |
testcase_73 | AC | 53 ms
36,860 KB |
testcase_74 | AC | 51 ms
36,536 KB |
testcase_75 | AC | 51 ms
36,836 KB |
testcase_76 | AC | 52 ms
36,836 KB |
testcase_77 | AC | 52 ms
36,940 KB |
testcase_78 | AC | 53 ms
36,524 KB |
testcase_79 | AC | 50 ms
37,012 KB |
testcase_80 | AC | 50 ms
36,680 KB |
testcase_81 | AC | 51 ms
36,828 KB |
testcase_82 | AC | 52 ms
36,664 KB |
testcase_83 | AC | 50 ms
36,964 KB |
testcase_84 | AC | 49 ms
36,732 KB |
testcase_85 | AC | 52 ms
36,832 KB |
testcase_86 | AC | 53 ms
36,536 KB |
ソースコード
import java.io.*; import java.util.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); long current = 0; int k = sc.nextInt(); long ans = 1; for (int i = 0; i < k; i++) { long x = sc.nextLong(); if ((current | x) == x) { ans *= kaijo(pop(x) - pop(current)); ans %= MOD; } else { ans = 0; } current = x; } long last = (1L << n) - 1; if ((current | last) == last) { ans *= kaijo(pop(last) - pop(current)); ans %= MOD; } else { ans = 0; } System.out.println(ans); } static long kaijo(int x) { if (x == 0) { return 1; } else { return x * kaijo(x - 1) % MOD; } } static int pop(long x) { int count = 0; while (x > 0) { if (x % 2 == 1) { count++; } x /= 2; } return count; } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }