結果
| 問題 |
No.462 6日知らずのコンピュータ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-17 20:27:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,021 bytes |
| コンパイル時間 | 1,230 ms |
| コンパイル使用メモリ | 95,216 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 01:16:29 |
| 合計ジャッジ時間 | 3,744 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 84 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
int n, k;
long long a[66], o = 1;
cin >> n >> k;
for (int i = 1; i <= k; i++) {
cin >> a[i];
}
a[0] = 0, a[k + 1] = (o << n) - 1;
sort(a, a + k + 1);
long long ans = 1;
for (int i = 1; i <= k + 1; i++) {
long long co = 0;
for (long long j = 0; j < n; j++) {
if (!(a[i] & (o << j)) && (a[i - 1] & (o << j))) {
cout << 0 << endl;
return 0;
}
if ((a[i] & (o << j)) && !(a[i - 1] & (o << j))) {
co++;
}
}
for (long long j = co; j > 0; j--) {
ans *= j;
ans %= 1000000007;
}
}
cout << ans << endl;
return 0;
}