結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(v) v.begin(),v.end()
#define dbg(x) cerr << #x << ": " << (x) << endl;
int n,m;
vector<int> a;
vector<bool> ex;
int main() {
    cin >> n >> m;
    ex.resize(1 << n);
    a.resize(m);
    for (int i = 0; i < m; ++i) {
        string s;
        cin >> s;
        int x = 0;
        for (int i = 0; i < n; ++i) {
            if (s[i] == '1') x |= 1 << i;
        }
        a[i] = x;
        ex[x] = true;
    }
    int tgt = (1 << n)-1;
    if (!ex[tgt]) {
        cout << "No\n";
        return 0;
    }
    if (!ex[0]) {
        cout << "No\n";
        return 0;
    }

    for (int i = 0; i < m; ++i) {
        for (int j = i+1; j < m; ++j) {
            if (!ex[a[i] & a[j]]) {
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";
}
0