結果
| 問題 |
No.462 6日知らずのコンピュータ
|
| コンテスト | |
| ユーザー |
ferin
|
| 提出日時 | 2017-01-26 19:02:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,176 bytes |
| コンパイル時間 | 1,333 ms |
| コンパイル使用メモリ | 158,732 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-23 11:43:48 |
| 合計ジャッジ時間 | 3,414 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 45 WA * 39 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;
#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12
ll fact[70];
int main(void)
{
int n, k;
cin >> n >> k;
ll a[70];
REP(i, k) cin >> a[i];
ll nn = 1;
REP(i, n) nn *= 2;
nn--;
//sort(a, a+k);
ll before = 0;
REP(i, k) {
if((a[i] & before) != before) {cout << "0" << endl; return 0;}
before = a[i];
}
fact[0] = 1;
FOR(i, 1, 70) {
fact[i] = (fact[i-1] * i) % MOD;
//cout << fact[i] << " ";
}
int count = 0;
ll ans = 1;
before = 0;
REP(i, k) {
count = __builtin_popcount(before ^ a[i]);
ans = (ans * fact[count]) % MOD;
before = a[i];
//cout << ans << " " << count << endl;
}
count = __builtin_popcount(before ^ nn);
//cout << before << " " << nn << " " << count << endl;
ans = (ans * fact[count]) % MOD;
cout << ans << endl;
return 0;
}
ferin