結果
問題 | No.2090 否定論理積と充足可能性 |
ユーザー |
|
提出日時 | 2022-09-30 22:26:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 829 bytes |
コンパイル時間 | 2,486 ms |
コンパイル使用メモリ | 207,484 KB |
最終ジャッジ日時 | 2025-02-07 19:38:03 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef _RUTHEN#include <debug.hpp>#else#define show(...) true#endifusing ll = long long;#define rep(i, n) for (int i = 0; i < (n); i++)template <class T> using V = vector<T>;int main() {ios::sync_with_stdio(false);cin.tie(0);V<string> A(6);rep(i, 6) cin >> A[i];auto C = A;sort(A.begin(), A.end());A.erase(unique(A.begin(), A.end()), A.end());V<int> B(6);rep(i, 6) B[i] = lower_bound(A.begin(), A.end(), C[i]) - A.begin();auto f = [](int a, int b) -> int { return (a & b) ^ 1; };rep(b, 1 << 6) {if (f(f(f(b >> B[0] & 1, b >> B[1] & 1), b >> B[2] & 1), f(f(b >> B[3] & 1, b >> B[4] & 1), b >> B[5] & 1))) {cout << "YES\n";return 0;}}cout << "NO\n";return 0;}