結果
| 問題 |
No.792 真理関数をつくろう
|
| コンテスト | |
| ユーザー |
nmnmnmnmnmnmnm
|
| 提出日時 | 2019-02-22 21:48:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 2,000 ms |
| コード長 | 1,317 bytes |
| コンパイル時間 | 782 ms |
| コンパイル使用メモリ | 92,100 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 07:57:16 |
| 合計ジャッジ時間 | 1,779 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
#define MOD 1000000007
string ntos(long long n){
string s;
stringstream ss;
ss << n;
ss >> s;
return s;
}
int main(){
ll n;
cin>>n;
ll c = 0;
string s = "A=";
rep(i,0,pow(2,n)){
string s1 = "(";
vector<ll> v;
rep(j,1,n+1){
ll a;
cin>>a;
if(a)s1+="P_"+ntos(j);
else s1+="¬P_"+ntos(j);
if(j!=n)s1+="∧";
else s1+=")";
}
ll a;
cin>>a;
if(a==1){
if(s.sz!=2)s+="∨";
s+=s1;
c++;
}
}
if(c==0){
cout << "A=⊥" << endl;
}
else if(c==pow(2,n)){
cout << "A=⊤" << endl;
}
else{
cout << s << endl;
}
return 0;
}
nmnmnmnmnmnmnm