結果
問題 | No.2090 否定論理積と充足可能性 |
ユーザー |
|
提出日時 | 2022-09-30 21:55:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 851 bytes |
コンパイル時間 | 2,135 ms |
コンパイル使用メモリ | 181,864 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-22 23:28:53 |
合計ジャッジ時間 | 2,949 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main(){ios::sync_with_stdio(false);cin.tie(0);vector<string> a(6);vector<string> c;for(auto &&s:a){cin >> s;c.push_back(s);}auto f = [&](int lhs, int rhs){return !(lhs & rhs);};auto g = [&](vector<int> b){return f(f(f(b[0], b[1]), b[2]), f(f(b[3], b[4]), b[5]));};sort(c.begin(), c.end());c.erase(unique(c.begin(), c.end()), c.end());for(int i = 0; i < (1 << c.size()); i++){vector<int> b(6);for(int j = 0; j < a.size(); j++){int k = lower_bound(c.begin(), c.end(), a[j]) - c.begin();b[j] = (i >> k & 1);}if(g(b)){cout << "YES" << '\n';return 0;}}cout << "NO" << '\n';}