結果
| 問題 |
No.792 真理関数をつくろう
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-29 16:07:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 778 bytes |
| コンパイル時間 | 722 ms |
| コンパイル使用メモリ | 66,484 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-01-02 14:09:18 |
| 合計ジャッジ時間 | 2,275 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main(){
int N;bool top=true,btm=true;
cin >> N;
vector<vector<int>> Q((1<<N),vector<int>(N,0));
vector<int> R((1<<N),0);
for(int k=0;k<(1<<N);k++){
for(int id=0;id<N;id++){cin >> Q.at(k).at(id);}
cin >> R[k];
top&=R[k];btm&=~R[k];
}
//output
cout << "A=";
if(top)cout << "⊤" <<endl;
else if(btm)cout << "⊥" << endl;
else for(int k=0,cnt=0;k<(1<<N);k++){
if(R[k]){
if(cnt++>0)cout << "∨";
cout << "(";
for(int id=0;id<N;id++){
if(id>0)cout << "∧";
cout << ( Q[k][id] ?"":"¬") << "P_" << id+1;
}
cout << ")";
}
}
return 0;
}