結果
問題 | No.2090 否定論理積と充足可能性 |
ユーザー | a16784542 |
提出日時 | 2022-09-30 22:22:27 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,982 bytes |
コンパイル時間 | 4,853 ms |
コンパイル使用メモリ | 269,248 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-24 15:56:21 |
合計ジャッジ時間 | 5,931 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 2 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,376 KB |
testcase_11 | AC | 1 ms
4,376 KB |
testcase_12 | AC | 2 ms
4,380 KB |
testcase_13 | AC | 2 ms
4,376 KB |
testcase_14 | AC | 1 ms
4,376 KB |
testcase_15 | AC | 1 ms
4,380 KB |
testcase_16 | AC | 2 ms
4,380 KB |
testcase_17 | AC | 2 ms
4,376 KB |
testcase_18 | AC | 2 ms
4,376 KB |
testcase_19 | AC | 2 ms
4,376 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace atcoder; // using namespace __gnu_pbds; using ll=long long; #define int ll using ld = long double; #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=int(a);i<int(b);++i) #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define rrep(i,n) for(int i=int(n-1);i>=int(0);--i) #define fore(i,a) for(auto &i:a) #define all(x) x.begin(),x.end() #define sz(x) ((int)(x).size()) #define bp(x) (__builtin_popcount((long long)(x))) #define pb push_back #define eb emplace_back #define mpa make_pair #define bit(n) (1LL<<(n)) template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; template <class T> using max_heap = priority_queue<T>; template <class T> using min_heap = priority_queue<T, vector<T>, greater<>>; #define P pair<int,int> #define TP tuple<int,int,int> #define F first #define S second template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } const int INF = 1001001001; const ll INFL = 3e18; const int MAX = 2e6+1; bool f(bool a,bool b){ return !(a and b); } bool f1(V<bool> X){ // rep(i,6)cout<<X[i]<<" "; // cout<<endl; return f(f(f(X[0],X[1]),X[2]),f(f(X[3],X[4]),X[5])); } signed main() { int n=6; V<string> a(6); rep(i,n){ cin>>a[i]; } auto na=a; sort(all(na)); na.erase(unique(all(na)),na.end()); int m=sz(na); rep(i,bit(m)){ V<bool> b(m); rep(j,m)if(i&bit(j))b[j]=true; V<bool> c(n); rep(j,n){ c[j]=b[lower_bound(all(na),a[j])-na.begin()]; } if(f1(c)){ cout<<"YES"<<endl; return 0; } } cout<<"NO"<<endl; return 0; }