結果

問題 No.2090 否定論理積と充足可能性
ユーザー minimumminimum
提出日時 2022-09-30 22:09:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 1,489 ms
コンパイル使用メモリ 86,780 KB
実行使用メモリ 71,292 KB
最終ジャッジ日時 2023-08-24 15:43:06
合計ジャッジ時間 4,326 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,008 KB
testcase_01 AC 71 ms
70,896 KB
testcase_02 AC 71 ms
71,292 KB
testcase_03 AC 71 ms
70,896 KB
testcase_04 AC 71 ms
71,160 KB
testcase_05 AC 71 ms
71,192 KB
testcase_06 AC 72 ms
70,936 KB
testcase_07 AC 72 ms
71,080 KB
testcase_08 AC 71 ms
71,168 KB
testcase_09 AC 71 ms
70,924 KB
testcase_10 AC 73 ms
71,260 KB
testcase_11 AC 72 ms
71,164 KB
testcase_12 AC 73 ms
71,064 KB
testcase_13 AC 72 ms
71,084 KB
testcase_14 AC 72 ms
71,104 KB
testcase_15 AC 70 ms
70,936 KB
testcase_16 AC 72 ms
71,088 KB
testcase_17 AC 71 ms
71,132 KB
testcase_18 AC 71 ms
71,108 KB
testcase_19 AC 72 ms
71,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def NAND(x, y):
    return (1 - x) | (1 - y)

a = list(map(str, input().split()))
for i in range(1 << 6):
    p = []
    for j in range(6):
        if (i >> j) & 1:
            p.append(1)
        else:
            p.append(0)
    ok = 1
    for i in range(5):
        for j in range(i + 1, 6):
            if a[i] == a[j] and p[i] != p[j]:
                ok = 0
    if ok == 0:
        continue
    if NAND(NAND(NAND(p[0], p[1]), p[2]), NAND(NAND(p[3], p[4]), p[5])):
        if ok:
            print('YES')
            exit()

print('NO')
0