結果

問題 No.792 真理関数をつくろう
ユーザー t33ft33f
提出日時 2019-02-22 22:11:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 873 bytes
コンパイル時間 541 ms
コンパイル使用メモリ 67,768 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-04 02:37:11
合計ジャッジ時間 1,372 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
6,944 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,940 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 WA -
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 11 ms
6,940 KB
testcase_21 WA -
testcase_22 AC 2 ms
6,944 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int q[5000][12] = {}, r[12] = {};
    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;
}
0