結果

問題 No.792 真理関数をつくろう
ユーザー fV9TwBhUoa9S3eVfV9TwBhUoa9S3eV
提出日時 2019-10-28 14:03:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 571 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 14,896 KB
最終ジャッジ日時 2023-10-12 23:02:48
合計ジャッジ時間 5,489 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,208 KB
testcase_01 AC 20 ms
8,448 KB
testcase_02 AC 17 ms
7,856 KB
testcase_03 AC 28 ms
8,568 KB
testcase_04 AC 16 ms
7,884 KB
testcase_05 AC 28 ms
8,560 KB
testcase_06 AC 847 ms
9,876 KB
testcase_07 AC 18 ms
8,280 KB
testcase_08 AC 15 ms
7,832 KB
testcase_09 AC 15 ms
7,820 KB
testcase_10 AC 16 ms
7,844 KB
testcase_11 AC 16 ms
7,832 KB
testcase_12 AC 16 ms
7,828 KB
testcase_13 AC 16 ms
7,768 KB
testcase_14 AC 15 ms
7,816 KB
testcase_15 AC 17 ms
7,788 KB
testcase_16 AC 115 ms
9,020 KB
testcase_17 AC 16 ms
7,772 KB
testcase_18 AC 16 ms
7,824 KB
testcase_19 AC 16 ms
7,832 KB
testcase_20 AC 28 ms
9,004 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# No.792 真理関数をつくろう
n = int(input())
q = []
r = []

a = 'A='

for _ in range(2 ** n):
    s = input().split()
    q.append(s[:-1])
    r.append(s[-1])

if r.count('0') == 0:
    print(a + '⊤')
elif r.count('1') == 0:
    print(a + '⊥')
else:
    a += '('

    for i in range(2 ** n):
        if r[i] == '1':
            for j in range(n):
                if q[i][j] == '0':
                    a += '¬P_' + str(j + 1) + '∧'
                else:
                    a += 'P_' + str(j + 1) + '∧'
            a = a[:-1] + ')∨('
    print(a[:-2])
0