結果

問題 No.792 真理関数をつくろう
ユーザー daku9640daku9640
提出日時 2019-02-22 22:26:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-05-04 03:12:11
合計ジャッジ時間 1,611 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,752 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 26 ms
10,752 KB
testcase_10 AC 25 ms
10,752 KB
testcase_11 RE -
testcase_12 WA -
testcase_13 AC 26 ms
10,752 KB
testcase_14 AC 27 ms
10,752 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 27 ms
10,752 KB
testcase_19 AC 26 ms
10,752 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 26 ms
10,752 KB
testcase_23 AC 28 ms
10,752 KB
testcase_24 AC 28 ms
10,752 KB
testcase_25 AC 27 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    QR = [input().split() for _ in range(n ** 2)]
    R = set(list(zip(*QR))[-1])
    print("A=", end="")
    if R == {"0"}:
        print("⊥")
        return
    if R == {"1"}:
        print("⊤")
        return
    ans = []
    for ss in QR:
        if ss[-1] == "1":
            ret = []
            for i, s in enumerate(ss[:-1], 1):
                if s == '1':
                    ret.append("P_" + str(i))
                else:
                    ret.append("¬P_" + str(i))
            ans.append("(" + "∧".join(ret) + ")")
    print("∨".join(ans))
solve()
0