結果

問題 No.792 真理関数をつくろう
ユーザー ahe100ahe100
提出日時 2019-02-22 23:17:17
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 1,032 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 83,812 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-04 11:36:42
合計ジャッジ時間 1,774 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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;
}
0