結果

問題 No.462 6日知らずのコンピュータ
ユーザー 夜
提出日時 2020-08-08 11:48:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,828 bytes
コンパイル時間 8,347 ms
コンパイル使用メモリ 405,988 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 21:01:21
合計ジャッジ時間 11,859 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 RE -
testcase_10 RE -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 RE -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 RE -
testcase_24 WA -
testcase_25 RE -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 RE -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 RE -
testcase_39 WA -
testcase_40 RE -
testcase_41 RE -
testcase_42 WA -
testcase_43 WA -
testcase_44 RE -
testcase_45 WA -
testcase_46 WA -
testcase_47 RE -
testcase_48 RE -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 WA -
testcase_83 WA -
testcase_84 WA -
testcase_85 WA -
testcase_86 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
int main() {
    int n, k;
    Bint a[66];
    bitset<66> bit[66];
    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        cin >> a[i];
    }
    sort(a, a + k);
    for (int i = 0; i < k; i++) {
        int co = -1;
        while (a[i] >= 1) {
            co++;
            if (a[i] % 2 == 1) {
                bit[i].set(co);
            }
            a[i] /= 2;
        }
        bit[i][co] = 1;
    }
    for (int i = 0; i < k; i++) {
        cout << bit[i] << endl;
    }
    long long ans = 1;
    for (int i = 1; i < k; i++) {
        long long co = 0;
        for (int j = 0; j < 61; j++) {
            if (!bit[i][j] && bit[i - 1][j]) {
                cout << "0" << endl;
                return 0;
            }
            if (bit[i][j] && !bit[i - 1][j]) {
                co++;
            }
        }
        for (long long j = co; j > 0; j--) {
            ans *= j;
            ans %= 1000000007;
        }
    }
   long long co = 0;
    for (int j = 0; j < 61; j++) {
        if (bit[0][j]) {
            co++;
        }
    }
    for (long long j = co; j > 0; j--) {
        ans *= j;
        ans %= 1000000007;
    }
    co = 0;
    for (int j = 0; j < n; j++) {
        if (!bit[k-1][j]) {
            co++;
        }
    }
    for (long long j = co; j > 0; j--) {
        ans *= j;
        ans %= 1000000007;
    }
    cout << ans << endl;
    return 0;
}
0