結果
問題 |
No.462 6日知らずのコンピュータ
|
ユーザー |
![]() |
提出日時 | 2020-10-26 22:58:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 805 bytes |
コンパイル時間 | 2,288 ms |
コンパイル使用メモリ | 199,500 KB |
最終ジャッジ日時 | 2025-01-15 15:57:53 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 84 |
ソースコード
#include <bits/stdc++.h> #define be(v) (v).begin(),(v).end() #define pb(q) push_back(q) typedef long long ll; using namespace std; const ll mod=1000000007, INF=(1LL<<60); #define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); ll n, k, ans = 1; cin >> n >> k; vector<ll> a(k+1, 0LL); ll fac[100]; fac[0] = 1; for(ll i = 1; i < 100; i++){ fac[i] = (fac[i - 1] * i) % mod; } for(int i=1;i<=k;i++) cin >> a[i]; sort(be(a)); a.pb((1LL << n) - 1); for(int i=0;i<=k;i++){ if((a[i] & a[i + 1]) == a[i]){ ans *= fac[int(__builtin_popcountll(a[i + 1] - a[i]))]; ans %= mod; }else ans = 0; } cout << ans << endl; return 0; }