結果
| 問題 |
No.792 真理関数をつくろう
|
| コンテスト | |
| ユーザー |
TAISA_
|
| 提出日時 | 2019-02-22 21:40:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 2,000 ms |
| コード長 | 1,088 bytes |
| コンパイル時間 | 1,441 ms |
| コンパイル使用メモリ | 173,812 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 07:53:12 |
| 合計ジャッジ時間 | 2,211 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<62;
const double eps=1e-9;
const ll MOD=1000000007LL;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
int n;cin>>n;
vector<vector<int>> c(1<<n,vector<int>(n));
vector<int> r(1<<n);
bool f1=true,f2=true;
vector<string> s;
int en=-1;
for(int i=0;i<(1<<n);i++){
for(int j=0;j<n;j++){
cin>>c[i][j];
}
cin>>r[i];
if(r[i]==0)f1=false;
if(r[i]==1){
en=i;
f2=false;
}
}
if(f1){
cout<<"A=⊤"<<endl;
return 0;
}
if(f2){
cout<<"A=⊥"<<endl;
return 0;
}
cout<<"A=";
for(int i=0;i<(1<<n);i++){
if(r[i]==0)continue;
cout<<"(";
for(int j=0;j<n;j++){
if(c[i][j]==0)cout<<"¬";
cout<<"P_";
if(j+1>=10)cout<<'1';
cout<<(char)('0'+(j+1)%10);
if(j!=n-1)cout<<"∧";
}
cout<<")";
if(i!=en){
cout<<"∨";
}
}
cout<<endl;
}
TAISA_