結果
| 問題 |
No.462 6日知らずのコンピュータ
|
| コンテスト | |
| ユーザー |
ttttan
|
| 提出日時 | 2019-01-08 02:08:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 790 bytes |
| コンパイル時間 | 1,321 ms |
| コンパイル使用メモリ | 160,212 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 00:33:06 |
| 合計ジャッジ時間 | 3,381 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 58 WA * 26 |
ソースコード
#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+k);
ll sum=0;
ll ans=1;
for(ll i=0;i<k;i++){
ll 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;
}
ttttan