結果
問題 |
No.2911 位相の公理
|
ユーザー |
|
提出日時 | 2024-10-04 22:07:47 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 623 ms / 2,000 ms |
コード長 | 1,399 bytes |
コンパイル時間 | 1,605 ms |
コンパイル使用メモリ | 134,420 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 22:07:53 |
合計ジャッジ時間 | 4,895 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <set> #include <queue> #include <cmath> #include <atcoder/modint> #include <iomanip> using mint = atcoder::modint1000000007; using namespace std; typedef long long ll; const int INF = 1<<30; const ll INFLL = 1LL<<60; const ll MOD = 1000000007; //998244353; using Graph = vector<vector<int>>; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); int n, m; cin >> n >> m; vector<ll> S(m); for (int i = 0; i < m; i++){ string s; cin >> s; int val = 0; for (int j = 0; j < n; j++) if (s[j] == '1') val += 1<<j; S[i] = val; } sort(S.begin(), S.end()); bool ok0 = false; bool ok1 = false; bool ok2 = true; for (int i = 0; i < m; i++){ if (S[i] == 0) ok0 = true; if (S[i] == (1<<n) - 1) ok1 = true; for (int j = i; j < m; j++){ ll OR = S[i] | S[j]; ll AND = S[i] & S[j]; auto it_or = lower_bound(S.begin(), S.end(), OR); auto it_and = lower_bound(S.begin(), S.end(), AND); if (it_or == S.end() || *it_or != OR) ok2 = false; if (it_and == S.end() || *it_and != AND) ok2 = false; } } //cout << ok0 << ok1 << ok2 << endl; cout << (ok0 && ok1 && ok2 ? "Yes" : "No") << '\n'; }