結果

問題 No.792 真理関数をつくろう
ユーザー first_vilfirst_vil
提出日時 2020-08-02 10:55:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 470 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 14,332 KB
最終ジャッジ日時 2023-09-25 11:05:58
合計ジャッジ時間 6,625 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,332 KB
testcase_01 AC 22 ms
8,456 KB
testcase_02 AC 15 ms
7,828 KB
testcase_03 AC 35 ms
8,580 KB
testcase_04 AC 16 ms
7,860 KB
testcase_05 AC 34 ms
8,524 KB
testcase_06 AC 1,312 ms
9,872 KB
testcase_07 AC 18 ms
8,308 KB
testcase_08 AC 15 ms
7,860 KB
testcase_09 AC 16 ms
7,780 KB
testcase_10 AC 16 ms
7,772 KB
testcase_11 AC 16 ms
7,780 KB
testcase_12 AC 16 ms
7,924 KB
testcase_13 AC 15 ms
7,864 KB
testcase_14 AC 16 ms
7,772 KB
testcase_15 AC 16 ms
7,928 KB
testcase_16 AC 162 ms
8,864 KB
testcase_17 AC 16 ms
7,872 KB
testcase_18 AC 15 ms
7,768 KB
testcase_19 AC 15 ms
7,772 KB
testcase_20 AC 35 ms
9,040 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
q=[list(map(int,input().split())) for _ in range(1<<n)]

r_sum=0
for i in range(1<<n):
    r_sum+=q[i][-1]

if r_sum%(1<<n)==0:
    if r_sum==0:
        print('A=⊥')
    else:
        print('A=⊤')
    exit(0)

a='A='
for i in range(1<<n):
    if q[i][-1]==0:
        continue
    a+='('
    for j in range(n):
        if q[i][j]==0:
            a+='¬'
        a+='P_'+str(j+1)
        if j!=n-1:
            a+='∧'
    a+=')∨'
print(a[:len(a)-1])
0