結果
問題 |
No.792 真理関数をつくろう
|
ユーザー |
![]() |
提出日時 | 2019-02-22 22:02:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 675 bytes |
コンパイル時間 | 1,523 ms |
コンパイル使用メモリ | 167,140 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-25 08:25:47 |
合計ジャッジ時間 | 2,459 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 6 WA * 16 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int N;cin>>N; int Q[1<<N][N];int R[1<<N]; for(int i=0;i<(1<<N);i++){ for(int j=0;j<N;j++){ cin>>Q[i][j]; }cin>>R[i]; }for(int k=1;k<(1<<N);k++){ if(R[k-1]!=R[k]){ break; }if(k==(1<<N)-1){ if(R[k]==0){ cout<<"A=⊥"<<endl; }else{ cout<<"A=⊤"<<endl; }return 0; } }int count=0; cout<<"A="; for(int i=0;i<(1<<N);i++){ if(R[i]==1){ count++; cout<<"("; for(int j=0;j<N;j++){ if(Q[i][j]==1){ cout<<"P_"<<j+1; }else{ cout<<"¬P_"<<j+1; }if(j!=N-1){ cout<<"∧"; } }cout<<")"; if(count!=(1<<N)/2){ cout<<"∨"; } } }cout<<endl; }