結果

問題 No.2090 否定論理積と充足可能性
ユーザー miscalcmiscalc
提出日時 2022-09-30 21:52:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 8,336 KB
最終ジャッジ日時 2023-08-24 15:21:43
合計ジャッジ時間 1,386 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,124 KB
testcase_01 AC 15 ms
8,176 KB
testcase_02 AC 15 ms
8,112 KB
testcase_03 AC 15 ms
8,252 KB
testcase_04 AC 15 ms
7,856 KB
testcase_05 AC 15 ms
8,244 KB
testcase_06 AC 15 ms
8,336 KB
testcase_07 AC 15 ms
8,232 KB
testcase_08 AC 16 ms
8,172 KB
testcase_09 AC 15 ms
8,252 KB
testcase_10 AC 16 ms
7,824 KB
testcase_11 AC 15 ms
8,112 KB
testcase_12 AC 16 ms
8,140 KB
testcase_13 AC 16 ms
8,184 KB
testcase_14 AC 17 ms
8,120 KB
testcase_15 AC 15 ms
8,196 KB
testcase_16 AC 16 ms
8,124 KB
testcase_17 AC 16 ms
7,992 KB
testcase_18 AC 16 ms
7,800 KB
testcase_19 AC 15 ms
8,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

a = list(map(int, input().split()))
n = len(a)
def nand(x, y):
  return 0 if x == 1 and y == 1 else 1
for b in range(1 << n):
  c = [1 if (b & (1 << i)) else 0 for i in range(n)]
  ok = True
  for i in range(n):
    for j in range(i + 1, n):
      if c[i] != c[j] and a[i] == a[j]:
        ok = False
        break
  if not ok:
    continue
  if nand(nand(nand(c[0], c[1]), c[2]), nand(nand(c[3], c[4]), c[5])):
    print("YES")
    sys.exit()
print("NO")
0