結果
問題 | No.462 6日知らずのコンピュータ |
ユーザー | crazybbb3 |
提出日時 | 2017-01-16 20:26:30 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 61 ms / 2,000 ms |
コード長 | 2,397 bytes |
コンパイル時間 | 2,664 ms |
コンパイル使用メモリ | 78,124 KB |
実行使用メモリ | 37,492 KB |
最終ジャッジ日時 | 2024-12-22 20:48:59 |
合計ジャッジ時間 | 10,052 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 59 ms
37,160 KB |
testcase_01 | AC | 59 ms
37,092 KB |
testcase_02 | AC | 60 ms
37,036 KB |
testcase_03 | AC | 60 ms
37,088 KB |
testcase_04 | AC | 56 ms
36,912 KB |
testcase_05 | AC | 55 ms
37,320 KB |
testcase_06 | AC | 57 ms
37,060 KB |
testcase_07 | AC | 57 ms
36,924 KB |
testcase_08 | AC | 59 ms
37,324 KB |
testcase_09 | AC | 58 ms
37,080 KB |
testcase_10 | AC | 59 ms
37,292 KB |
testcase_11 | AC | 60 ms
37,376 KB |
testcase_12 | AC | 58 ms
37,260 KB |
testcase_13 | AC | 58 ms
37,032 KB |
testcase_14 | AC | 58 ms
37,172 KB |
testcase_15 | AC | 61 ms
37,188 KB |
testcase_16 | AC | 58 ms
37,180 KB |
testcase_17 | AC | 58 ms
37,340 KB |
testcase_18 | AC | 60 ms
36,768 KB |
testcase_19 | AC | 59 ms
37,396 KB |
testcase_20 | AC | 58 ms
37,172 KB |
testcase_21 | AC | 57 ms
37,204 KB |
testcase_22 | AC | 57 ms
37,260 KB |
testcase_23 | AC | 56 ms
37,308 KB |
testcase_24 | AC | 59 ms
37,364 KB |
testcase_25 | AC | 60 ms
37,064 KB |
testcase_26 | AC | 57 ms
37,220 KB |
testcase_27 | AC | 59 ms
37,008 KB |
testcase_28 | AC | 59 ms
37,084 KB |
testcase_29 | AC | 60 ms
37,056 KB |
testcase_30 | AC | 59 ms
37,324 KB |
testcase_31 | AC | 59 ms
36,988 KB |
testcase_32 | AC | 55 ms
36,920 KB |
testcase_33 | AC | 60 ms
37,188 KB |
testcase_34 | AC | 57 ms
36,920 KB |
testcase_35 | AC | 56 ms
37,292 KB |
testcase_36 | AC | 57 ms
37,364 KB |
testcase_37 | AC | 58 ms
37,328 KB |
testcase_38 | AC | 58 ms
37,012 KB |
testcase_39 | AC | 58 ms
37,160 KB |
testcase_40 | AC | 56 ms
37,072 KB |
testcase_41 | AC | 59 ms
37,308 KB |
testcase_42 | AC | 55 ms
37,156 KB |
testcase_43 | AC | 57 ms
37,380 KB |
testcase_44 | AC | 57 ms
37,284 KB |
testcase_45 | AC | 56 ms
37,352 KB |
testcase_46 | AC | 58 ms
36,924 KB |
testcase_47 | AC | 59 ms
37,008 KB |
testcase_48 | AC | 57 ms
37,184 KB |
testcase_49 | AC | 58 ms
37,236 KB |
testcase_50 | AC | 57 ms
37,232 KB |
testcase_51 | AC | 57 ms
37,092 KB |
testcase_52 | AC | 57 ms
37,296 KB |
testcase_53 | AC | 56 ms
37,172 KB |
testcase_54 | AC | 56 ms
37,048 KB |
testcase_55 | AC | 58 ms
37,312 KB |
testcase_56 | AC | 61 ms
37,016 KB |
testcase_57 | AC | 56 ms
37,052 KB |
testcase_58 | AC | 55 ms
37,492 KB |
testcase_59 | AC | 57 ms
37,192 KB |
testcase_60 | AC | 56 ms
37,048 KB |
testcase_61 | AC | 55 ms
37,296 KB |
testcase_62 | AC | 56 ms
37,352 KB |
testcase_63 | AC | 56 ms
37,396 KB |
testcase_64 | AC | 56 ms
37,348 KB |
testcase_65 | AC | 57 ms
37,308 KB |
testcase_66 | AC | 57 ms
37,228 KB |
testcase_67 | AC | 57 ms
37,252 KB |
testcase_68 | AC | 57 ms
37,300 KB |
testcase_69 | AC | 57 ms
37,088 KB |
testcase_70 | AC | 58 ms
37,072 KB |
testcase_71 | AC | 59 ms
37,368 KB |
testcase_72 | AC | 59 ms
36,940 KB |
testcase_73 | AC | 57 ms
37,360 KB |
testcase_74 | AC | 57 ms
37,352 KB |
testcase_75 | AC | 56 ms
37,288 KB |
testcase_76 | AC | 57 ms
36,928 KB |
testcase_77 | AC | 58 ms
37,088 KB |
testcase_78 | AC | 58 ms
37,300 KB |
testcase_79 | AC | 57 ms
37,180 KB |
testcase_80 | AC | 57 ms
37,188 KB |
testcase_81 | AC | 57 ms
37,176 KB |
testcase_82 | AC | 58 ms
37,076 KB |
testcase_83 | AC | 57 ms
37,320 KB |
testcase_84 | AC | 57 ms
37,316 KB |
testcase_85 | AC | 56 ms
37,004 KB |
testcase_86 | AC | 57 ms
36,740 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(); } }