結果
| 問題 | No.792 真理関数をつくろう | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-06-26 12:04:18 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 646 bytes | 
| コンパイル時間 | 1,176 ms | 
| コンパイル使用メモリ | 82,196 KB | 
| 実行使用メモリ | 849,036 KB | 
| 最終ジャッジ日時 | 2024-11-16 14:15:43 | 
| 合計ジャッジ時間 | 35,797 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 MLE * 1 | 
| other | WA * 7 TLE * 4 MLE * 10 OLE * 1 | 
ソースコード
n = int(input())
q = [[int(i) for i in input().split()] for j in range(2**n)]
ans = "A="
f = False
f_all = True
for i in range(2**n):
    if q[i][-1] == 1:
        if ans != "A=":
            ans += ans.join("∨")
        f = True
        ans += ans.join("(")
        for j in range(n):
            if q[i][j] == 1:
                ans += ans.join("P_"+str(j+1))
            else:
                ans += ans.join("¬P_"+str(j+1))
            if j != n-1:
                ans += ans.join("∧")
        ans += ans.join(")")
    else:
        f_all = False
    
if f == False:
    ans = "A=⊥"
elif f_all == True:
    ans = "A=⊤"
print(ans)
            
            
            
        