結果
| 問題 | No.792 真理関数をつくろう |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2021-08-26 17:20:54 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 63 ms / 2,000 ms |
| + 299µs | |
| コード長 | 585 bytes |
| 記録 | |
| コンパイル時間 | 61 ms |
| コンパイル使用メモリ | 81,832 KB |
| 実行使用メモリ | 93,176 KB |
| 最終ジャッジ日時 | 2026-09-25 19:19:32 |
| 合計ジャッジ時間 | 2,871 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
n = int(input())
grid = [list(map(int, input().split())) for _ in range(1 << n)]
ans = ["A="]
se = set()
for i in range(1 << n):
if grid[i][-1] == 0:
se.add(0)
continue
se.add(1)
ans.append("(")
for j in range(n):
if grid[i][j] == 1:
ans.append(f"P_{j + 1}")
else:
ans.append(f"¬P_{j + 1}")
ans.append("∧")
ans.pop()
ans.append(")")
ans.append("∨")
ans.pop()
if len(se) == 1:
if 0 in se:
print("A=⊥")
else:
print("A=⊤")
else:
print("".join(ans))