結果

問題 No.792 真理関数をつくろう
ユーザー dangodango
提出日時 2023-06-24 17:51:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,937 ms / 2,000 ms
コード長 561 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 263,720 KB
最終ジャッジ日時 2023-09-14 13:27:06
合計ジャッジ時間 6,561 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,148 KB
testcase_01 AC 101 ms
77,136 KB
testcase_02 AC 70 ms
71,348 KB
testcase_03 AC 125 ms
77,652 KB
testcase_04 AC 72 ms
71,428 KB
testcase_05 AC 129 ms
77,452 KB
testcase_06 AC 597 ms
259,548 KB
testcase_07 AC 83 ms
75,716 KB
testcase_08 AC 71 ms
71,448 KB
testcase_09 AC 74 ms
71,256 KB
testcase_10 AC 68 ms
71,120 KB
testcase_11 AC 70 ms
71,268 KB
testcase_12 AC 70 ms
70,972 KB
testcase_13 AC 70 ms
71,416 KB
testcase_14 AC 71 ms
71,348 KB
testcase_15 AC 74 ms
71,392 KB
testcase_16 AC 180 ms
80,108 KB
testcase_17 AC 72 ms
71,224 KB
testcase_18 AC 71 ms
71,460 KB
testcase_19 AC 72 ms
70,944 KB
testcase_20 AC 105 ms
77,924 KB
testcase_21 AC 1,937 ms
263,720 KB
testcase_22 AC 71 ms
71,508 KB
testcase_23 AC 71 ms
71,388 KB
testcase_24 AC 71 ms
71,172 KB
testcase_25 AC 71 ms
71,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [list(map(int, input().split())) for _ in range(1 << n)]
all_true = True
all_false = True
ans = "A="
for i in range(1 << n):
    if a[i][n] == 1:
        all_false = False
        if len(ans) > 2:
            ans += "∨"
        ans += "("
        for j in range(n):
            if j > 0:
                ans += "∧"
            if a[i][j] == 0:
                ans += "¬"
            ans += "P_" + str(j+1)
        ans += ")"
    else:
        all_true = False
if all_true:
    ans = "A=⊤"
elif all_false:
    ans = "A=⊥"
print(ans)
0