結果
| 問題 | No.792 真理関数をつくろう | 
| コンテスト | |
| ユーザー |  ahe100 | 
| 提出日時 | 2019-02-22 23:17:17 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 13 ms / 2,000 ms | 
| コード長 | 1,032 bytes | 
| コンパイル時間 | 669 ms | 
| コンパイル使用メモリ | 85,556 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-25 22:13:14 | 
| 合計ジャッジ時間 | 1,595 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
ソースコード
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<unordered_set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod = 1e9+7;
ll inf = 1e18;
ll n,a[4100][13],r[4100],cnt=0;
string ans="A=";
int main(void){
	cin>>n;
	rep(i,1<<n){
		rep(j,n)cin>>a[i][j];
		cin>>r[i];
	}
	rep(i,1<<n){
		if(r[i]==0)continue;//要らないので
		if(cnt!=0)ans+="∨";
		ans+="(";
		rep(j,n){
			if(j!=0)ans+="∧";
			if(a[i][j]==0){
				ans+="¬P_"+to_string(j+1);
			}else{
				ans+="P_"+to_string(j+1);
			}
		}
		ans+=")";
		cnt++;
	}
	if(cnt==0)ans+="⊥";
	if(cnt==(1<<n))ans="A=⊤";
	cout<<ans<<endl;
	return 0;
}
            
            
            
        