結果
問題 |
No.462 6日知らずのコンピュータ
|
ユーザー |
|
提出日時 | 2017-06-11 20:06:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,029 bytes |
コンパイル時間 | 973 ms |
コンパイル使用メモリ | 108,040 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-24 16:26:54 |
合計ジャッジ時間 | 3,289 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 84 |
ソースコード
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> using namespace std; const int MOD = 1000000007; int main() { int n, k; cin >> n >> k; vector<long long> a(k+2); a[k] = 0; a[k+1] = (1LL << n) - 1; for(int i=0; i<k; ++i) cin >> a[i]; sort(a.begin(), a.end()); long long ans = 1; for(int i=1; i<k+2; ++i){ if(a[i-1] & ~a[i]){ cout << 0 << endl; return 0; } bitset<64> bs = a[i-1] ^ a[i]; int cnt = bs.count(); for(int j=1; j<=cnt; ++j){ ans *= j; ans %= MOD; } } cout << ans << endl; return 0; }