結果

問題 No.2090 否定論理積と充足可能性
ユーザー momoyuumomoyuu
提出日時 2022-10-15 01:39:18
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,581 bytes
コンパイル時間 3,474 ms
コンパイル使用メモリ 257,104 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-09 01:47:43
合計ジャッジ時間 4,117 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template<class t> using vc = vector<t>;
template<class t> using vvc = vc<vc<t>>;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using vi = vc<int>;
using vvi = vvc<int>;
using vl = vc<ll>;
using vvl = vvc<ll>;

#define rep(i,a,b) for (int i = (int)(a); i < (int)(b); i++)
#define irep(i,a,b) for (int i = (int)(a); i > (int)(b); i--)
#define all(a) a.begin(),a.end()
#define print(n) cout << n << '\n'
#define pritn(n) print(n)
#define printv(n,a) {copy(all(n),ostream_iterator<a>(cout," ")); cout<<"\n";}
#define printvv(n,a) {for(auto itr:n) printv(itr,a);}
#define rup(a,b) (a+b-1)/b
#define input(A,N) rep(i,0,N) cin>>A[i]
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)


int main(){
    cout << fixed << setprecision(15);
    
    vc<string> a(6);
    input(a,6);
    vc<string>b = a;
    sort(all(b));
    b.erase(unique(all(b)),b.end());
    vi now(6);
    rep(i,0,6){
        int ni = lower_bound(all(b),a[i]) - b.begin();
        now[i] = ni;
    }
    bool p = false;

    for(int s = 0;s<(1<<now.size());s++){
        vi nn(6);
        rep(i,0,6){
            if(s>>now[i]&1) nn[i] = 1;
            else nn[i] = 0;
        }
        nn[1] = !(nn[0]&nn[1]);
        nn[2] = !(nn[2]&nn[1]);
        nn[4] = !(nn[3]&nn[4]);
        nn[5] = !(nn[5]&nn[4]);
        nn[2] = !(nn[2]&nn[5]);
        if(nn[2]) p = true;
        if(p) break;
    }
    if(p) print("YES");
    else print("NO");

    //system("pause");
    return 0;
}
0