結果

問題 No.2090 否定論理積と充足可能性
ユーザー 👑 rin204rin204
提出日時 2022-09-30 21:31:49
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 71,388 KB
最終ジャッジ日時 2023-08-24 14:50:59
合計ジャッジ時間 2,815 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,324 KB
testcase_01 AC 72 ms
71,236 KB
testcase_02 AC 71 ms
71,084 KB
testcase_03 AC 70 ms
70,800 KB
testcase_04 AC 71 ms
71,136 KB
testcase_05 AC 71 ms
71,388 KB
testcase_06 AC 73 ms
71,040 KB
testcase_07 AC 73 ms
70,928 KB
testcase_08 AC 73 ms
71,012 KB
testcase_09 AC 71 ms
70,948 KB
testcase_10 AC 72 ms
71,032 KB
testcase_11 AC 71 ms
71,244 KB
testcase_12 AC 72 ms
71,336 KB
testcase_13 AC 71 ms
70,796 KB
testcase_14 AC 72 ms
71,032 KB
testcase_15 AC 71 ms
71,384 KB
testcase_16 AC 72 ms
71,008 KB
testcase_17 AC 72 ms
71,016 KB
testcase_18 AC 72 ms
71,268 KB
testcase_19 AC 72 ms
71,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A = input().split()

dic = {s:i for i, s in enumerate(sorted(set(A)))}
A = [dic[a] for a in A]
n = len(A)

def nand(x, y):
    if x and y:
        return False
    else:
        return True

def ok(P):
    x = nand(P[0], P[1])
    x = nand(x, P[1])
    y = nand(P[3], P[4])
    y = nand(y, P[5])
    return nand(x, y)


for bit in range(1 << n):
    B = [bit >> a & 1 for a in A]
    if ok(B):
        print("YES")
        exit()
print("NO")
0