結果
問題 | No.462 6日知らずのコンピュータ |
ユーザー | Grenache |
提出日時 | 2016-12-13 00:15:21 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,503 bytes |
コンパイル時間 | 4,210 ms |
コンパイル使用メモリ | 80,296 KB |
実行使用メモリ | 50,504 KB |
最終ジャッジ日時 | 2024-11-29 18:36:58 |
合計ジャッジ時間 | 11,334 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
36,948 KB |
testcase_01 | WA | - |
testcase_02 | AC | 56 ms
37,036 KB |
testcase_03 | AC | 53 ms
37,104 KB |
testcase_04 | AC | 51 ms
36,736 KB |
testcase_05 | AC | 52 ms
36,416 KB |
testcase_06 | AC | 52 ms
36,792 KB |
testcase_07 | AC | 52 ms
37,068 KB |
testcase_08 | AC | 53 ms
37,032 KB |
testcase_09 | AC | 52 ms
37,020 KB |
testcase_10 | AC | 53 ms
36,560 KB |
testcase_11 | AC | 52 ms
36,532 KB |
testcase_12 | AC | 52 ms
36,776 KB |
testcase_13 | AC | 53 ms
36,800 KB |
testcase_14 | AC | 54 ms
36,948 KB |
testcase_15 | AC | 52 ms
36,780 KB |
testcase_16 | AC | 52 ms
36,652 KB |
testcase_17 | AC | 54 ms
36,800 KB |
testcase_18 | AC | 56 ms
37,052 KB |
testcase_19 | AC | 53 ms
36,952 KB |
testcase_20 | AC | 53 ms
36,792 KB |
testcase_21 | AC | 54 ms
36,696 KB |
testcase_22 | AC | 52 ms
36,924 KB |
testcase_23 | AC | 54 ms
37,036 KB |
testcase_24 | AC | 53 ms
37,052 KB |
testcase_25 | AC | 54 ms
37,012 KB |
testcase_26 | AC | 55 ms
37,076 KB |
testcase_27 | AC | 53 ms
37,032 KB |
testcase_28 | AC | 53 ms
36,560 KB |
testcase_29 | AC | 52 ms
36,468 KB |
testcase_30 | AC | 52 ms
36,444 KB |
testcase_31 | AC | 54 ms
36,800 KB |
testcase_32 | AC | 53 ms
36,776 KB |
testcase_33 | AC | 54 ms
37,060 KB |
testcase_34 | AC | 53 ms
36,428 KB |
testcase_35 | AC | 53 ms
36,560 KB |
testcase_36 | AC | 53 ms
36,824 KB |
testcase_37 | AC | 53 ms
37,052 KB |
testcase_38 | AC | 52 ms
36,824 KB |
testcase_39 | AC | 52 ms
37,016 KB |
testcase_40 | AC | 51 ms
36,792 KB |
testcase_41 | AC | 53 ms
37,068 KB |
testcase_42 | AC | 52 ms
36,792 KB |
testcase_43 | AC | 52 ms
37,104 KB |
testcase_44 | AC | 52 ms
37,104 KB |
testcase_45 | AC | 52 ms
36,968 KB |
testcase_46 | AC | 52 ms
36,964 KB |
testcase_47 | AC | 58 ms
36,736 KB |
testcase_48 | AC | 54 ms
37,052 KB |
testcase_49 | AC | 52 ms
36,608 KB |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | AC | 53 ms
36,764 KB |
testcase_53 | AC | 52 ms
37,068 KB |
testcase_54 | AC | 53 ms
37,016 KB |
testcase_55 | AC | 52 ms
36,984 KB |
testcase_56 | AC | 52 ms
36,948 KB |
testcase_57 | AC | 52 ms
36,892 KB |
testcase_58 | AC | 52 ms
37,052 KB |
testcase_59 | AC | 53 ms
37,104 KB |
testcase_60 | AC | 53 ms
36,920 KB |
testcase_61 | AC | 52 ms
36,736 KB |
testcase_62 | AC | 55 ms
36,576 KB |
testcase_63 | AC | 53 ms
36,980 KB |
testcase_64 | AC | 52 ms
36,800 KB |
testcase_65 | AC | 51 ms
37,032 KB |
testcase_66 | AC | 52 ms
36,820 KB |
testcase_67 | AC | 52 ms
36,800 KB |
testcase_68 | AC | 51 ms
36,656 KB |
testcase_69 | AC | 51 ms
36,936 KB |
testcase_70 | AC | 52 ms
36,792 KB |
testcase_71 | AC | 52 ms
36,968 KB |
testcase_72 | AC | 52 ms
36,800 KB |
testcase_73 | AC | 51 ms
36,984 KB |
testcase_74 | WA | - |
testcase_75 | AC | 52 ms
37,104 KB |
testcase_76 | AC | 51 ms
37,092 KB |
testcase_77 | AC | 52 ms
36,928 KB |
testcase_78 | AC | 53 ms
36,596 KB |
testcase_79 | AC | 52 ms
37,012 KB |
testcase_80 | AC | 51 ms
36,608 KB |
testcase_81 | AC | 53 ms
36,964 KB |
testcase_82 | AC | 50 ms
36,792 KB |
testcase_83 | AC | 51 ms
36,888 KB |
testcase_84 | AC | 53 ms
36,860 KB |
testcase_85 | AC | 51 ms
36,588 KB |
testcase_86 | AC | 51 ms
36,736 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(); long[] a = new long[k]; for (int i = 0; i < k; i++) { a[i] = sc.nextLong(); } Set<Integer> hs = new TreeSet<>(); for (int i = 0; i < k; i++) { int tmp = Long.bitCount(a[i]); if (hs.contains(tmp)) { pr.println(0); return; } else { hs.add(tmp); } } hs.add(0); hs.add(n); long ret = 1; List<Integer> al = new ArrayList<>(hs); 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); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } private boolean isPrintable(int ch) { return ch >= '!' && ch <= '~'; } private boolean isCRLF(int ch) { return ch == '\n' || ch == '\r' || ch == -1; } private int nextPrintable() { try { int ch; while (!isPrintable(ch = br.read())) { if (ch == -1) { throw new NoSuchElementException(); } } return ch; } catch (IOException e) { throw new NoSuchElementException(); } } String next() { try { int ch = nextPrintable(); StringBuilder sb = new StringBuilder(); do { sb.appendCodePoint(ch); } while (isPrintable(ch = br.read())); return sb.toString(); } catch (IOException e) { throw new NoSuchElementException(); } } int nextInt() { try { // parseInt from Integer.parseInt() boolean negative = false; int res = 0; int limit = -Integer.MAX_VALUE; int radix = 10; int fc = nextPrintable(); if (fc < '0') { if (fc == '-') { negative = true; limit = Integer.MIN_VALUE; } else if (fc != '+') { throw new NumberFormatException(); } fc = br.read(); } int multmin = limit / radix; int ch = fc; do { int digit = ch - '0'; if (digit < 0 || digit >= radix) { throw new NumberFormatException(); } if (res < multmin) { throw new NumberFormatException(); } res *= radix; if (res < limit + digit) { throw new NumberFormatException(); } res -= digit; } while (isPrintable(ch = br.read())); return negative ? res : -res; } catch (IOException e) { throw new NoSuchElementException(); } } long nextLong() { try { // parseLong from Long.parseLong() boolean negative = false; long res = 0; long limit = -Long.MAX_VALUE; int radix = 10; int fc = nextPrintable(); if (fc < '0') { if (fc == '-') { negative = true; limit = Long.MIN_VALUE; } else if (fc != '+') { throw new NumberFormatException(); } fc = br.read(); } long multmin = limit / radix; int ch = fc; do { int digit = ch - '0'; if (digit < 0 || digit >= radix) { throw new NumberFormatException(); } if (res < multmin) { throw new NumberFormatException(); } res *= radix; if (res < limit + digit) { throw new NumberFormatException(); } res -= digit; } while (isPrintable(ch = br.read())); return negative ? res : -res; } catch (IOException e) { throw new NoSuchElementException(); } } float nextFloat() { return Float.parseFloat(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { try { int ch; while (isCRLF(ch = br.read())) { if (ch == -1) { throw new NoSuchElementException(); } } StringBuilder sb = new StringBuilder(); do { sb.appendCodePoint(ch); } while (!isCRLF(ch = br.read())); return sb.toString(); } catch (IOException e) { throw new NoSuchElementException(); } } void close() { try { br.close(); } catch (IOException e) { // throw new NoSuchElementException(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }