結果
問題 | No.462 6日知らずのコンピュータ |
ユーザー | Grenache |
提出日時 | 2016-12-13 00:58:11 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 153 ms / 2,000 ms |
コード長 | 1,488 bytes |
コンパイル時間 | 3,907 ms |
コンパイル使用メモリ | 81,572 KB |
実行使用メモリ | 42,032 KB |
最終ジャッジ日時 | 2024-11-29 23:49:48 |
合計ジャッジ時間 | 18,661 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 137 ms
41,548 KB |
testcase_01 | AC | 151 ms
41,232 KB |
testcase_02 | AC | 149 ms
41,448 KB |
testcase_03 | AC | 152 ms
41,484 KB |
testcase_04 | AC | 140 ms
41,576 KB |
testcase_05 | AC | 143 ms
41,556 KB |
testcase_06 | AC | 144 ms
41,332 KB |
testcase_07 | AC | 144 ms
41,232 KB |
testcase_08 | AC | 142 ms
41,428 KB |
testcase_09 | AC | 144 ms
41,424 KB |
testcase_10 | AC | 143 ms
41,500 KB |
testcase_11 | AC | 141 ms
41,544 KB |
testcase_12 | AC | 141 ms
41,732 KB |
testcase_13 | AC | 144 ms
42,032 KB |
testcase_14 | AC | 146 ms
41,212 KB |
testcase_15 | AC | 139 ms
41,624 KB |
testcase_16 | AC | 139 ms
41,496 KB |
testcase_17 | AC | 140 ms
41,556 KB |
testcase_18 | AC | 140 ms
41,460 KB |
testcase_19 | AC | 139 ms
41,568 KB |
testcase_20 | AC | 142 ms
41,588 KB |
testcase_21 | AC | 141 ms
41,660 KB |
testcase_22 | AC | 139 ms
41,304 KB |
testcase_23 | AC | 153 ms
41,624 KB |
testcase_24 | AC | 141 ms
41,748 KB |
testcase_25 | AC | 150 ms
41,800 KB |
testcase_26 | AC | 144 ms
41,272 KB |
testcase_27 | AC | 137 ms
41,520 KB |
testcase_28 | AC | 140 ms
41,476 KB |
testcase_29 | AC | 144 ms
41,392 KB |
testcase_30 | AC | 141 ms
41,380 KB |
testcase_31 | AC | 135 ms
41,272 KB |
testcase_32 | AC | 143 ms
41,488 KB |
testcase_33 | AC | 144 ms
41,624 KB |
testcase_34 | AC | 140 ms
41,396 KB |
testcase_35 | AC | 143 ms
41,624 KB |
testcase_36 | AC | 139 ms
41,452 KB |
testcase_37 | AC | 140 ms
41,224 KB |
testcase_38 | AC | 139 ms
41,752 KB |
testcase_39 | AC | 140 ms
41,236 KB |
testcase_40 | AC | 143 ms
41,716 KB |
testcase_41 | AC | 150 ms
41,348 KB |
testcase_42 | AC | 141 ms
41,112 KB |
testcase_43 | AC | 141 ms
41,844 KB |
testcase_44 | AC | 141 ms
41,588 KB |
testcase_45 | AC | 139 ms
41,176 KB |
testcase_46 | AC | 143 ms
41,520 KB |
testcase_47 | AC | 146 ms
41,808 KB |
testcase_48 | AC | 147 ms
41,716 KB |
testcase_49 | AC | 141 ms
41,416 KB |
testcase_50 | AC | 139 ms
41,492 KB |
testcase_51 | AC | 139 ms
41,716 KB |
testcase_52 | AC | 139 ms
41,308 KB |
testcase_53 | AC | 139 ms
41,244 KB |
testcase_54 | AC | 142 ms
41,648 KB |
testcase_55 | AC | 139 ms
41,744 KB |
testcase_56 | AC | 134 ms
41,256 KB |
testcase_57 | AC | 125 ms
39,956 KB |
testcase_58 | AC | 137 ms
41,084 KB |
testcase_59 | AC | 139 ms
41,476 KB |
testcase_60 | AC | 138 ms
41,576 KB |
testcase_61 | AC | 138 ms
41,532 KB |
testcase_62 | AC | 139 ms
41,216 KB |
testcase_63 | AC | 137 ms
41,520 KB |
testcase_64 | AC | 137 ms
41,356 KB |
testcase_65 | AC | 125 ms
40,164 KB |
testcase_66 | AC | 141 ms
41,088 KB |
testcase_67 | AC | 142 ms
41,624 KB |
testcase_68 | AC | 140 ms
41,820 KB |
testcase_69 | AC | 142 ms
41,112 KB |
testcase_70 | AC | 139 ms
41,612 KB |
testcase_71 | AC | 141 ms
41,604 KB |
testcase_72 | AC | 142 ms
41,448 KB |
testcase_73 | AC | 142 ms
41,192 KB |
testcase_74 | AC | 140 ms
41,520 KB |
testcase_75 | AC | 140 ms
41,648 KB |
testcase_76 | AC | 137 ms
41,432 KB |
testcase_77 | AC | 141 ms
41,124 KB |
testcase_78 | AC | 140 ms
41,440 KB |
testcase_79 | AC | 138 ms
41,264 KB |
testcase_80 | AC | 140 ms
41,440 KB |
testcase_81 | AC | 141 ms
41,716 KB |
testcase_82 | AC | 137 ms
41,332 KB |
testcase_83 | AC | 141 ms
41,516 KB |
testcase_84 | AC | 139 ms
41,484 KB |
testcase_85 | AC | 141 ms
41,692 KB |
testcase_86 | AC | 141 ms
41,672 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder462 { private static Scanner sc; private static Printer pr; private static void solve() { final int MOD = 1_000_000_007; int n = sc.nextInt(); int k = sc.nextInt(); Pair[] a = new Pair[k]; Set<Integer> hs = new TreeSet<>(); for (int i = 0; i < k; i++) { long tmp = sc.nextLong(); a[i] = new Pair(tmp, Long.bitCount(tmp)); if (hs.contains(a[i].b)) { pr.println(0); return; } else { hs.add(a[i].b); } } Arrays.sort(a); for (int i = 1; i < k; i++) { if ((a[i].a & a[i - 1].a) != a[i - 1].a) { pr.println(0); return; } } hs.add(0); hs.add(n); long ret = 1; List<Integer> al = new ArrayList<>(hs); // Collections.sort(al); for (int i = 1, size = al.size(); i < size; i++) { int tmp = al.get(i) - al.get(i - 1); for (int j = 1; j <= tmp; j++) { ret = ret * j % MOD; } } pr.println(ret); } private static class Pair implements Comparable<Pair> { long a; int b; Pair(long a, int b) { this.a = a; this.b = b; } @Override public int compareTo(Pair o) { return Integer.compare(b, o.b); } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }