結果
| 問題 |
No.1560 majority x majority
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-06-25 22:49:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 745 bytes |
| コンパイル時間 | 890 ms |
| コンパイル使用メモリ | 79,444 KB |
| 最終ジャッジ日時 | 2025-01-22 12:32:12 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 26 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <atcoder/modint>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int main(){
int M, N;
cin >> M >> N;
vector<int> X(1<<N,0);
rep(i,M){
int a=0; rep(i,N){ int t; cin >> t; a = a * 2 + t; }
X[a]++;
}
rep(d,N) rep(i,1<<N) if(i&(1<<d)) X[i-(1<<d)] += X[i];
vector<ll> dp(1<<N,0);
dp[0] = 1;
rep(i,1<<N) rep(d,N) if((i&(1<<d)) == 0){
if(X[i] - X[i|(1<<d)] > X[i|(1<<d)]) continue;
dp[i|(1<<d)] += dp[i];
}
cout << dp.back() << "\n";
return 0;
}
struct ios_do_not_sync{
ios_do_not_sync(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
} ios_do_not_sync_inst;
Nachia