結果
問題 | No.462 6日知らずのコンピュータ |
ユーザー |
![]() |
提出日時 | 2017-01-16 20:26:30 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 2,397 bytes |
コンパイル時間 | 3,831 ms |
コンパイル使用メモリ | 74,052 KB |
実行使用メモリ | 50,100 KB |
最終ジャッジ日時 | 2023-08-24 13:35:10 |
合計ジャッジ時間 | 9,324 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
49,572 KB |
testcase_01 | AC | 43 ms
49,572 KB |
testcase_02 | AC | 45 ms
49,744 KB |
testcase_03 | AC | 44 ms
49,996 KB |
testcase_04 | AC | 42 ms
50,100 KB |
testcase_05 | AC | 43 ms
49,408 KB |
testcase_06 | AC | 43 ms
49,636 KB |
testcase_07 | AC | 44 ms
49,564 KB |
testcase_08 | AC | 43 ms
47,432 KB |
testcase_09 | AC | 43 ms
49,652 KB |
testcase_10 | AC | 44 ms
49,644 KB |
testcase_11 | AC | 43 ms
47,476 KB |
testcase_12 | AC | 43 ms
49,812 KB |
testcase_13 | AC | 43 ms
49,796 KB |
testcase_14 | AC | 43 ms
49,688 KB |
testcase_15 | AC | 43 ms
49,372 KB |
testcase_16 | AC | 43 ms
49,740 KB |
testcase_17 | AC | 43 ms
49,600 KB |
testcase_18 | AC | 43 ms
49,416 KB |
testcase_19 | AC | 42 ms
49,492 KB |
testcase_20 | AC | 43 ms
49,620 KB |
testcase_21 | AC | 44 ms
49,416 KB |
testcase_22 | AC | 44 ms
49,636 KB |
testcase_23 | AC | 44 ms
47,592 KB |
testcase_24 | AC | 42 ms
49,408 KB |
testcase_25 | AC | 45 ms
49,468 KB |
testcase_26 | AC | 44 ms
49,580 KB |
testcase_27 | AC | 43 ms
49,576 KB |
testcase_28 | AC | 43 ms
49,332 KB |
testcase_29 | AC | 44 ms
49,440 KB |
testcase_30 | AC | 43 ms
49,376 KB |
testcase_31 | AC | 42 ms
49,824 KB |
testcase_32 | AC | 44 ms
49,340 KB |
testcase_33 | AC | 44 ms
49,620 KB |
testcase_34 | AC | 44 ms
49,408 KB |
testcase_35 | AC | 43 ms
49,748 KB |
testcase_36 | AC | 43 ms
49,904 KB |
testcase_37 | AC | 43 ms
49,664 KB |
testcase_38 | AC | 44 ms
49,680 KB |
testcase_39 | AC | 43 ms
49,724 KB |
testcase_40 | AC | 44 ms
47,708 KB |
testcase_41 | AC | 45 ms
49,648 KB |
testcase_42 | AC | 44 ms
49,408 KB |
testcase_43 | AC | 43 ms
49,688 KB |
testcase_44 | AC | 44 ms
49,468 KB |
testcase_45 | AC | 42 ms
49,672 KB |
testcase_46 | AC | 45 ms
49,560 KB |
testcase_47 | AC | 44 ms
49,748 KB |
testcase_48 | AC | 44 ms
49,668 KB |
testcase_49 | AC | 42 ms
49,620 KB |
testcase_50 | AC | 43 ms
49,624 KB |
testcase_51 | AC | 43 ms
49,480 KB |
testcase_52 | AC | 45 ms
49,464 KB |
testcase_53 | AC | 43 ms
49,900 KB |
testcase_54 | AC | 43 ms
49,280 KB |
testcase_55 | AC | 43 ms
49,408 KB |
testcase_56 | AC | 44 ms
49,540 KB |
testcase_57 | AC | 44 ms
49,752 KB |
testcase_58 | AC | 44 ms
49,624 KB |
testcase_59 | AC | 46 ms
49,420 KB |
testcase_60 | AC | 43 ms
49,344 KB |
testcase_61 | AC | 43 ms
49,316 KB |
testcase_62 | AC | 42 ms
49,592 KB |
testcase_63 | AC | 43 ms
49,568 KB |
testcase_64 | AC | 42 ms
49,592 KB |
testcase_65 | AC | 42 ms
49,540 KB |
testcase_66 | AC | 43 ms
49,556 KB |
testcase_67 | AC | 44 ms
49,532 KB |
testcase_68 | AC | 43 ms
49,900 KB |
testcase_69 | AC | 44 ms
49,456 KB |
testcase_70 | AC | 44 ms
49,416 KB |
testcase_71 | AC | 44 ms
49,500 KB |
testcase_72 | AC | 43 ms
49,804 KB |
testcase_73 | AC | 43 ms
49,824 KB |
testcase_74 | AC | 43 ms
49,604 KB |
testcase_75 | AC | 44 ms
49,536 KB |
testcase_76 | AC | 43 ms
49,740 KB |
testcase_77 | AC | 43 ms
49,428 KB |
testcase_78 | AC | 44 ms
49,592 KB |
testcase_79 | AC | 43 ms
49,912 KB |
testcase_80 | AC | 43 ms
50,012 KB |
testcase_81 | AC | 43 ms
49,432 KB |
testcase_82 | AC | 43 ms
49,524 KB |
testcase_83 | AC | 43 ms
49,456 KB |
testcase_84 | AC | 43 ms
49,472 KB |
testcase_85 | AC | 43 ms
49,612 KB |
testcase_86 | AC | 42 ms
50,044 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { void solve() throws IOException { int n = ni(), k = ni(); long[] a = new long[k + 2]; for (int i = 0; i < k; i++) { a[i] = nl(); } a[k] = 0; a[k + 1] = (1L << n) - 1; Arrays.sort(a); long MOD = 1000000007; long[] p = new long[61]; p[0] = 1; for (int i = 1; i < 61; i++) { p[i] = (p[i - 1] * i) % MOD; } int[] d = new int[k + 1]; for (int i = 0; i < k + 1; i++) { if ((a[i] | (a[i + 1] - a[i])) != a[i + 1]) { out.println(0); return; } d[i] = Long.bitCount(a[i + 1]) - Long.bitCount(a[i]); } long ans = 1; for (int i = 0; i < k + 1; i++) { ans = (ans * p[d[i]]) % MOD; } out.println(ans); } String ns() throws IOException { while (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine(), " "); } return tok.nextToken(); } int ni() throws IOException { return Integer.parseInt(ns()); } long nl() throws IOException { return Long.parseLong(ns()); } double nd() throws IOException { return Double.parseDouble(ns()); } String[] nsa(int n) throws IOException { String[] res = new String[n]; for (int i = 0; i < n; i++) { res[i] = ns(); } return res; } int[] nia(int n) throws IOException { int[] res = new int[n]; for (int i = 0; i < n; i++) { res[i] = ni(); } return res; } long[] nla(int n) throws IOException { long[] res = new long[n]; for (int i = 0; i < n; i++) { res[i] = nl(); } return res; } static BufferedReader in; static PrintWriter out; static StringTokenizer tok; public static void main(String[] args) throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); tok = new StringTokenizer(""); Main main = new Main(); main.solve(); out.close(); } }