結果

問題 No.462 6日知らずのコンピュータ
ユーザー ttttanttttan
提出日時 2019-01-08 02:05:08
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 791 bytes
コンパイル時間 1,344 ms
コンパイル使用メモリ 160,760 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-05-03 03:37:34
合計ジャッジ時間 13,057 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
int main(){
  
    ll n,k;cin>>n>>k;
    if(k==0){
        ll s=1;
        for(ll i=1;i<=n;i++){
            s*=i;
            s%=mod;
        }
        cout<<s<<endl;
        return 0;
    }
    ll a[k];for(ll i=0;i<k;i++)cin>>a[i];
    sort(a,a+n);
    ll sum=0;
    ll ans=1;
    for(ll i=0;i<k;i++){
      int r=sum|a[i];
        if(r!=a[i]){
            cout<<0<<endl;
            return 0;
        }
        ll j=sum^a[i];
        ll u=__builtin_popcount(j);
        for(ll y=u;y>=1;y--){
            ans*=y;
            ans%=mod;
        }
        sum=a[i];
      
    }
    ll x=__builtin_popcount(a[k-1]);
    for(ll i=n-x;i>=1;i--){
        ans*=i;
        ans%=mod;
    }
    cout<<ans<<endl;
}
0