結果
問題 | No.2090 否定論理積と充足可能性 |
ユーザー |
![]() |
提出日時 | 2022-09-30 23:17:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,101 bytes |
コンパイル時間 | 8,254 ms |
コンパイル使用メモリ | 444,316 KB |
最終ジャッジ日時 | 2025-02-07 19:47:21 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)#define ALL(v) v.begin(),v.end()typedef long long ll;#include <bits/stdc++.h>using namespace std;#include <boost/multiprecision/cpp_dec_float.hpp>#include <boost/multiprecision/cpp_int.hpp>namespace mp = boost::multiprecision;using Bint = mp::cpp_int;template <typename T>vector<T> compress(vector<T> &X){vector<T> vals=X;sort(vals.begin(),vals.end());vals.erase(unique(vals.begin(), vals.end()),vals.end());for(int i=0;i<(int)X.size(); i++){X[i]=lower_bound(vals.begin(),vals.end(),X[i])-vals.begin();}return vals;}int f(int x,int y){if(x && y) return 0;return 1;}int main(){ios::sync_with_stdio(false);std::cin.tie(nullptr);vector<Bint> A(6);rep(i,6) cin>>A[i];compress(A);int ma=0;rep(i,6) ma=max(ma,(int)A[i]);bool b=false;for(int bit=0;bit<(1<<(ma+1));bit++){vector<int> B(6);rep(i,6){if(bit&(1<<(int)A[i])) B[i]=1;}if(f(f(f(B[0],B[1]),B[2]),f(f(B[3],B[4]),B[5]))) b=true;}if(b) cout<<"YES"<<endl;else cout<<"NO"<<endl;return 0;}