結果
| 問題 |
No.792 真理関数をつくろう
|
| コンテスト | |
| ユーザー |
sbite
|
| 提出日時 | 2019-02-22 23:14:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,175 bytes |
| コンパイル時間 | 1,527 ms |
| コンパイル使用メモリ | 168,156 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 22:07:44 |
| 合計ジャッジ時間 | 2,563 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | WA * 22 |
ソースコード
#include <bits/stdc++.h>
#define ll unsigned long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD (ll)(1000000000 + 7)
using namespace std;
int main()
{
ll n;
cin >> n;
map<ll, bool> mp;
bool T = true, F = true;
rep(i, powl(2, n))
{
ll key = 0ll;
rep(j, n)
{
ll t;
cin >> t;
key += t << j;
}
ll t;
cin >> t;
mp[key] = t;
if (t == 1)
F = false;
else
T = false;
}
if (T)
{
cout << "A=⊤" << endl;
return 0;
}
if (F)
{
cout << "A=⊥" << endl;
return 0;
}
cout << "A=";
rep(i, powl(2, n))
{
cout << "(";
rep(j, n)
{
if (((i >> j) & 1) ^ mp[i] == 0)
{
cout << "P_" << (j + 1);
}
else
{
cout << "¬P_" << (j + 1);
}
if (j != n - 1)
cout << "∧";
}
cout << ")";
if (i != powl(2, n) - 1)
cout << "∨";
}
cout << endl;
return 0;
}
sbite