結果
問題 |
No.462 6日知らずのコンピュータ
|
ユーザー |
![]() |
提出日時 | 2020-10-26 22:50:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,020 bytes |
コンパイル時間 | 1,976 ms |
コンパイル使用メモリ | 197,184 KB |
最終ジャッジ日時 | 2025-01-15 15:57:30 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 WA * 39 |
ソースコード
#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; long long modpow(long long a, long long n) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } 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]; } a.pb((1LL << n) - 1); for(int i=1;i<=k+1;i++){ if((a[i] & a[i - 1]) == a[i - 1]){ ans *= fac[__builtin_popcount(a[i] - a[i - 1])]; ans %= mod; }else{ ans = 0; } } cout << ans << endl; return 0; }