#include #include using namespace std; // 575 int main() { int N, Q, R; cin >> N; stringstream S; bool showOr = false, isAllTrue = true, isAllFalse = true; for (int i = 0, l = 1 << N;i < l;++ i) { stringstream T; T << "("; for (int j = 0;j < N;++ j) { if (j != 0) T << "∧"; cin >> Q; if (Q == 0) T << "¬"; T << "P_" << j + 1; } cin >> R; isAllTrue &= R == 1; isAllFalse &= R == 0; if (R == 1) { if (showOr) S << "∨"; S << T.str() << ")"; showOr = true; } } cout << "A="; if (isAllTrue) cout << "⊤"; else if (isAllFalse) cout << "⊥"; else cout << S.str(); cout << endl; return 0; } /* 31536000のコメント解説欄 ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー あの、環境依存文字 */