結果
問題 | No.792 真理関数をつくろう |
ユーザー |
![]() |
提出日時 | 2019-02-22 22:51:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 1,321 bytes |
コンパイル時間 | 819 ms |
コンパイル使用メモリ | 93,988 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 17:22:42 |
合計ジャッジ時間 | 1,999 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#include <algorithm>#include <iostream>#include <iomanip>#include <cstring>#include <string>#include <vector>#include <queue>#include <cmath>#include <stack>#include <set>#include <map>typedef long long ll;typedef unsigned int uint;using namespace std;int main() {cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);int n;cin >> n;int m = 1 << n;bool q[m][n], r[m];bool all0 = true, all1 = true;for (int i = 0; i < m; i++) {for (int j = 0; j < n; j++) {cin >> q[i][j];}cin >> r[i];if (r[i]) all0 = false;else all1 = false;}cout << "A=";if (all0) {cout << "⊥";return 0;}if (all1) {cout << "⊤";return 0;}bool init = true;for (int i = 0; i < m; i++) {if (!r[i]) continue;if (init) {init = false;} else {cout << "∨";}cout << '(';bool ini = true;for (int j = 0; j < n; j++) {if (ini) {ini = false;} else {cout << "∧";}if (!q[i][j]) cout << "¬";cout << "P_" << to_string(j+1);}cout << ')';}return 0;}