結果

問題 No.2090 否定論理積と充足可能性
ユーザー umezoumezo
提出日時 2022-09-30 23:17:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,101 bytes
コンパイル時間 11,916 ms
コンパイル使用メモリ 489,388 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-24 16:50:54
合計ジャッジ時間 12,819 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,356 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,384 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0