結果
問題 |
No.462 6日知らずのコンピュータ
|
ユーザー |
![]() |
提出日時 | 2020-04-05 15:11:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 998 bytes |
コンパイル時間 | 2,611 ms |
コンパイル使用メモリ | 194,432 KB |
最終ジャッジ日時 | 2025-01-09 14:14:43 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 WA * 30 |
ソースコード
#include<bits/stdc++.h> #define ALL(v) std::begin(v),std::end(v) using lint=long long; using lubl=long double; struct mint{ lint value; mint()=default; mint(lint x):value(x){} }; std::ostream&operator<<(std::ostream&os,mint x){return os<<x.value;} lint mod=1'000'000'007; mint operator*(mint x,mint y){return mint{x.value*y.value%mod};} mint&operator*=(mint&x,mint y){return x=x*y;} int main(){ std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false); std::cout.setf(std::ios_base::fixed);std::cout.precision(15); lint n,k;std::cin>>n>>k; std::vector<mint>fact(n+1); fact.at(0)=1; for(lint i=1;i<=n;i++)fact.at(i)=fact.at(i-1)*i; mint ans=1; for(lint i=0,prv=0;i<=k;i++){ lint x; if(i==k)x=(1ll<<n)-1; else std::cin>>x; if(prv&~x){ std::cout<<0<<'\n'; return 0; } ans*=fact.at(__builtin_popcountll(x)-__builtin_popcountll(prv)); prv=x; } std::cout<<ans<<'\n'; }