結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,256 KB
testcase_01 AC 93 ms
71,404 KB
testcase_02 AC 98 ms
76,580 KB
testcase_03 AC 93 ms
71,560 KB
testcase_04 AC 102 ms
76,648 KB
testcase_05 AC 93 ms
71,300 KB
testcase_06 AC 92 ms
71,436 KB
testcase_07 AC 94 ms
71,408 KB
testcase_08 AC 94 ms
71,500 KB
testcase_09 AC 92 ms
71,252 KB
testcase_10 AC 101 ms
76,536 KB
testcase_11 AC 100 ms
76,372 KB
testcase_12 AC 100 ms
76,504 KB
testcase_13 AC 101 ms
76,716 KB
testcase_14 AC 99 ms
76,408 KB
testcase_15 AC 92 ms
71,420 KB
testcase_16 AC 99 ms
76,820 KB
testcase_17 AC 101 ms
76,888 KB
testcase_18 AC 100 ms
76,728 KB
testcase_19 AC 94 ms
71,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

def nand(x, y):
    return 1^(x&y)

def f(l):
    return nand(nand(nand(l[0], l[1]), l[2]), nand(nand(l[3], l[4]), l[5])) == 1

A = list(input().split())

for S in range(1<<6):
    l = []
    
    for i in range(6):
        l.append((S>>i)&1)
    
    ok = True
    
    for i in range(6):
        for j in range(6):
            if A[i]==A[j] and l[i]!=l[j]:
                ok = False
    
    if not ok:
        continue
    
    if f(l):
        exit(print('YES'))

print('NO')
0