結果
| 問題 |
No.792 真理関数をつくろう
|
| コンテスト | |
| ユーザー |
rtia_iidx
|
| 提出日時 | 2019-02-22 22:00:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,707 bytes |
| コンパイル時間 | 1,189 ms |
| コンパイル使用メモリ | 108,156 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 08:21:55 |
| 合計ジャッジ時間 | 2,042 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | WA * 22 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<sstream>
using namespace std;
#define ll long long int
ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
ll t = 1 << n;
vector<vector<bool>> q(n,vector<bool>(t));
vector<bool> r(t);
for(int i = 0; i < t; i++){
int tmp;
for(int j = 0; j < n; j++){
cin >> tmp;
q[j][i] = (bool)tmp;
}
cin >> tmp;
r[i] = (bool)tmp;
}
bool allt = true;
bool allf = true;
int c = 0;
for(int i = 0; i < t; i++){
if(r[i])c++;
allt = allt && r[i];
allf = allf && (!r[i]);
}
if(allt){
cout << "A=⊤";
return 0;
}
if(allf){
cout << "A=⊥";
return 0;
}
cout << "A=";
bool flag = false;
for(int i = 0; i < t; i++){
if(r[i]){
if(flag){
cout << "∨";
}
cout << "(";
for(int j = 0; j < n; j++){
if(j > 0){
cout << "∧";
}
if(!q[j][i]){
cout << "¬";
}
cout << "P_";
std::stringstream s;
s << j+1;
cout << s.str();
}
flag = true;
}
}
cout <<endl;
return 0;
}
rtia_iidx