結果
| 問題 |
No.2090 否定論理積と充足可能性
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-30 22:51:42 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 2,000 ms |
| コード長 | 544 bytes |
| コンパイル時間 | 133 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-12-23 00:35:44 |
| 合計ジャッジ時間 | 2,859 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
コンパイルメッセージ
Syntax OK
ソースコード
def detect(x)
nand(nand(nand(x[0], x[1]), x[2]), nand(nand(x[3], x[4]), x[5]))
end
# 0 = true
# 1 = false
def nand(a, b)
if a == 0 and b == 0
1
else
0
end
end
a = gets.split.map(&:to_i)
u = a.uniq
as = [0,1].repeated_permutation(u.size).to_a
result = 1
as.size.times.each do |i|
if detect(a.map { |e| as[i][u.index(e)] }) == 0
result = 0
break
end
end
as.size.times.each do |i|
if detect(a.map { |e| as[i][u.index(e)] }) == 0
result = 0
break
end
end
if result == 0
puts 'YES'
else
puts 'NO'
end