結果
問題 | No.462 6日知らずのコンピュータ |
ユーザー |
|
提出日時 | 2016-12-21 14:59:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 468 bytes |
コンパイル時間 | 737 ms |
コンパイル使用メモリ | 69,880 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-14 12:17:14 |
合計ジャッジ時間 | 2,977 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 84 |
ソースコード
#include<iostream> #include<algorithm> using namespace std; typedef long long int ll; const ll M=1e9+7; int main() { int n,k;cin>>n>>k; ll a[100]={}; for(int i=0;i<k;i++)cin>>a[i]; sort(a,a+k); a[k++]=(1LL<<n)-1; ll now=0; ll c=1; for(int i=0;i<k;i++) { if((now|a[i])>a[i]){c=0;break;} ll tmp=now^a[i]; int cou=0; while(tmp) { tmp=tmp&(tmp-1); cou++; } while(cou) { c*=cou--; c%=M; } now=a[i]; } cout<<c%M<<endl; return 0; }