結果

問題 No.2090 否定論理積と充足可能性
ユーザー 👑 KazunKazun
提出日時 2022-09-30 21:36:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 633 bytes
コンパイル時間 668 ms
コンパイル使用メモリ 86,672 KB
実行使用メモリ 71,360 KB
最終ジャッジ日時 2023-08-24 14:58:31
合計ジャッジ時間 2,625 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,124 KB
testcase_01 AC 70 ms
71,340 KB
testcase_02 AC 71 ms
71,340 KB
testcase_03 AC 70 ms
71,292 KB
testcase_04 AC 71 ms
71,340 KB
testcase_05 AC 71 ms
71,008 KB
testcase_06 AC 71 ms
70,808 KB
testcase_07 AC 70 ms
70,896 KB
testcase_08 AC 72 ms
71,184 KB
testcase_09 AC 71 ms
70,912 KB
testcase_10 AC 70 ms
70,904 KB
testcase_11 AC 70 ms
70,920 KB
testcase_12 AC 72 ms
70,812 KB
testcase_13 AC 73 ms
71,332 KB
testcase_14 AC 72 ms
71,216 KB
testcase_15 AC 73 ms
71,360 KB
testcase_16 AC 72 ms
71,016 KB
testcase_17 AC 73 ms
70,888 KB
testcase_18 AC 73 ms
71,020 KB
testcase_19 AC 72 ms
71,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    X=list(input().split())
    I={s:i for i,s in enumerate(X)}

    for T in range(1<<6):
        S=[0]*6
        for i in range(6):
            S[i]=(T>>i)&1

        M=[-1]*6
        flag=1
        for i in range(6):
            if M[I[X[i]]]==-1:
                M[I[X[i]]]=S[i]
            elif M[I[X[i]]]!=S[i]:
                flag=0
                break

        if flag==0:
            continue

        def nand(x,y):
            return 0 if x==y==1 else 1

        if nand(nand(nand(S[0],S[1]),S[2]), nand(nand(S[3], S[4]), S[5])):
            return True
    return False

print("YES" if solve() else "NO")
0