結果

問題 No.792 真理関数をつくろう
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2019-02-24 19:15:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 973 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 11,012 KB
実行使用メモリ 8,520 KB
最終ジャッジ日時 2023-08-25 01:08:39
合計ジャッジ時間 1,704 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,000 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 15 ms
8,160 KB
testcase_10 AC 14 ms
8,028 KB
testcase_11 RE -
testcase_12 WA -
testcase_13 AC 14 ms
8,068 KB
testcase_14 AC 14 ms
8,160 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 15 ms
8,020 KB
testcase_19 AC 14 ms
8,092 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 15 ms
7,996 KB
testcase_23 AC 14 ms
8,064 KB
testcase_24 AC 14 ms
8,076 KB
testcase_25 AC 15 ms
8,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

ans = [[] for _ in range(n ** 2)]

not_all_ok_flg = False
not_all_ng_flg = False

for i in range(len(ans)):
    tmp = [int(x) for x in input().split()]
    q = [tmp[i] for i in range(n)]
    r = tmp[-1]

    if r == 1:
        ans[i] = [False for _ in range(n)]
        for j, v in enumerate(q):
            if v == 1:
                ans[i][j] = True
        not_all_ng_flg = True
    else:
        not_all_ok_flg = True

print("A=", end="")
if not not_all_ng_flg:
    print("⊥")
elif not not_all_ok_flg:
    print("⊤")
else:
    flg = False
    for ans_i in ans:
        if len(ans_i) == 0:
            continue
        if flg:
            print("∨", end="")
        print("(", end="")
        for j, v in enumerate(ans_i):
            if j != 0:
                print("∧", end="")
            if not v:
                print("¬", end="")
            print("P_", j + 1, sep="", end="")
        print(")", end="")
        flg = True
    print()
0