結果

問題 No.2911 位相の公理
ユーザー GOTKAKO
提出日時 2024-10-04 21:55:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,288 ms / 2,000 ms
コード長 696 bytes
コンパイル時間 2,049 ms
コンパイル使用メモリ 203,764 KB
最終ジャッジ日時 2025-02-24 15:14:56
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N,M; cin >> N >> M;
    vector<int> S(M);
    set<int> X;
    for(auto &s : S){
        string t; cin >> t;
        int p2 = 1;
        for(auto &c : t){
            s += (c-'0')*p2;
            p2 *= 2;
        }
        X.insert(s);
    }
    set<int> Y;
    for(int i=0; i<M; i++) for(int k=i; k<M; k++) Y.insert(S.at(i)&S.at(k));
    Y.insert((1<<N)-1);

    set<int> Z = {0};
    for(auto y : Y){
        Z.insert(y);
        for(auto &z : Z) Z.insert(y|z);
        if(Z.size() > X.size()) break; 
    }
    if(X == Z) cout << "Yes\n";
    else cout << "No\n";
}
0