結果
| 問題 |
No.462 6日知らずのコンピュータ
|
| コンテスト | |
| ユーザー |
char134217728
|
| 提出日時 | 2017-08-20 01:12:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 845 bytes |
| コンパイル時間 | 1,558 ms |
| コンパイル使用メモリ | 163,292 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-14 15:57:23 |
| 合計ジャッジ時間 | 4,105 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 55 WA * 29 |
コンパイルメッセージ
main.cpp:24:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
24 | main(){
| ^~~~
ソースコード
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
const int inf = 1e9;
const int mod = 1e9+7;
ll f[65];
vi a;
int bc(ll i){
int co = 0;
while(i > 0){
if(i&1)co++;
i >>= 1;
}
return co;
}
main(){
cin.tie(0);
ios::sync_with_stdio(false);
f[0] = 1;
FOR(i, 1, 65) f[i] = f[i-1] * i % mod;
int n, k;
cin >> n >> k;
a.pb(0);
FOR(i, 0, k){
ll b;
cin >> b;
a.pb(b);
}
a.pb((1ll << n) - 1);
sort(a.begin(), a.end());
ll ans = 1;
FOR(i, 1, a.size()){
if((a[i] & a[i-1]) != a[i-1]){
ans = 0;
break;
}
ans = ans * f[bc(a[i]) - bc(a[i-1])] % mod;
}
cout << ans << endl;
}
char134217728