結果
問題 | No.792 真理関数をつくろう |
ユーザー |
![]() |
提出日時 | 2019-02-22 22:23:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 875 bytes |
コンパイル時間 | 478 ms |
コンパイル使用メモリ | 67,856 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 09:25:20 |
合計ジャッジ時間 | 1,314 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 22 |
ソースコード
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; int q[5000][12] = {}, r[5000] = {}; for (int i = 0; i < (1<<n); i++) { for (int j = 0; j < n; j++) cin >> q[i][j]; cin >> r[i]; } cout << "A="; if (*max_element(r, r+(1<<n)) == 0) cout << "⊥\n"; else if (*min_element(r, r+(1<<n)) == 1) cout << "⊤\n"; else { bool fst = true; for (int i = 0; i < (1<<n); i++) { if (r[i]) { if (fst) fst = false; else cout << "∨"; cout << "("; for (int j = 0; j < n; j++) { if (j > 0) cout << "∧"; if (!q[i][j]) cout << "¬"; cout << "P_" << j+1; } cout << ")"; } } } cout << endl; }