結果
| 問題 | No.462 6日知らずのコンピュータ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-13 00:38:53 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 441µs | |
| コード長 | 616 bytes |
| 記録 | |
| コンパイル時間 | 940 ms |
| コンパイル使用メモリ | 190,816 KB |
| 実行使用メモリ | 9,920 KB |
| 最終ジャッジ日時 | 2026-10-02 06:30:30 |
| 合計ジャッジ時間 | 4,564 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 84 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
vector<int64_t> a(k + 2);
for (int i = 0; i < k; i++) {
cin >> a[i];
}
a.back() = (1LL << n) - 1;
sort(a.begin(), a.end());
int64_t ans = 1;
for (int i = 0; i < a.size() - 1; i++) {
if (a[i] & ~a[i + 1]) {
ans = 0;
}
int cnt = 0;
int64_t d = a[i] ^ a[i + 1];
for (int64_t d = a[i] ^ a[i + 1]; d > 0; d &= d - 1) {
ans *= ++cnt;
ans %= mod;
}
}
cout << ans << endl;
}