結果

問題 No.792 真理関数をつくろう
ユーザー trineutrontrineutron
提出日時 2020-12-19 15:55:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 11,900 KB
実行使用メモリ 11,084 KB
最終ジャッジ日時 2023-10-21 09:17:52
合計ジャッジ時間 2,506 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,164 KB
testcase_01 AC 37 ms
10,476 KB
testcase_02 AC 29 ms
10,164 KB
testcase_03 AC 45 ms
10,544 KB
testcase_04 AC 29 ms
10,164 KB
testcase_05 AC 48 ms
10,544 KB
testcase_06 AC 101 ms
11,084 KB
testcase_07 AC 33 ms
10,360 KB
testcase_08 AC 30 ms
10,164 KB
testcase_09 AC 29 ms
10,164 KB
testcase_10 AC 29 ms
10,164 KB
testcase_11 AC 29 ms
10,164 KB
testcase_12 AC 30 ms
10,168 KB
testcase_13 AC 30 ms
10,164 KB
testcase_14 AC 31 ms
10,164 KB
testcase_15 AC 30 ms
10,248 KB
testcase_16 AC 63 ms
10,756 KB
testcase_17 AC 29 ms
10,188 KB
testcase_18 AC 29 ms
10,164 KB
testcase_19 AC 29 ms
10,164 KB
testcase_20 AC 51 ms
10,912 KB
testcase_21 AC 150 ms
11,084 KB
testcase_22 AC 30 ms
10,164 KB
testcase_23 AC 28 ms
10,164 KB
testcase_24 AC 29 ms
10,164 KB
testcase_25 AC 29 ms
10,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
q = []
r = []
for i in range(2 ** n):
    s = list(map(int, input().split()))
    q.append(s[:-1])
    r.append(s[-1])
if r.count(0) == 0:
    print('A=⊤')
    exit()
if r.count(1) == 0:
    print('A=⊥')
    exit()
print('A=', end='')
isfirst = True
for i in range(2 ** n):
    if r[i]:
        if not isfirst:
            print('∨', end='')
        isfirst = False
        print('(', end='')
        for j in range(n):
            if j:
                print('∧', end='')
            if q[i][j] == 0:
                print('¬', end='')
            print('P_%d' % (j + 1), end='')
        print(')', end='')
0