結果
問題 |
No.462 6日知らずのコンピュータ
|
ユーザー |
![]() |
提出日時 | 2016-12-13 00:24:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,664 bytes |
コンパイル時間 | 1,145 ms |
コンパイル使用メモリ | 119,336 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-29 18:53:00 |
合計ジャッジ時間 | 3,151 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 56 WA * 28 |
ソースコード
#include <iostream> #include <sstream> #include <iomanip> #include <cstdio> #include <cassert> #include <algorithm> #include <iterator> #include <string> #include <vector> #include <list> #include <deque> #include <set> #include <unordered_set> #include <map> #include <unordered_map> #include <tuple> #include <queue> #include <stack> #include <functional> #include <utility> #include <complex> #include <bitset> #include <numeric> #include <random> using namespace std; #define REP(i,n) for(int (i)=0; (i)<(n) ;++(i)) #define REPN(i,a,n) FOR((i),(a),(a)+(n)) #define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i)) #define PB push_back #define MP make_pair #define SE second #define FI first #define DBG(a) cerr<<(a)<<endl; #define dump(a) cerr<<#a <<' '<< a <<endl; #define ALL(v) (v).begin(),(v).end() typedef long long LL; typedef pair<LL, LL> PLL; typedef vector<LL> VLL; typedef pair<int,int>PI; typedef vector<int> VI; const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n,k; cin >> n >> k; vector<LL> a; LL ans=1; a.push_back(0); a.push_back((1<<n)-1); REP(i,k){ LL tmp; cin >> tmp; a.push_back(tmp); } sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); FOR(i,1,a.size()){ int c=__builtin_popcount(a[i-1]); int d=__builtin_popcount(a[i]); REP(j,n){ if(((a[i-1]>>j)&1)>((a[i]>>j)&1)){ cout << 0 << endl; return 0; } } FOR(j,1,d-c+1){ ans=ans*j%MOD; } } cout << ans <<endl; return 0; }